146 uintptr_t ubase, utop;
147 uintptr_t kbase, ktop;
148 uintptr_t win, sp;
149
150 fsip->fsi_failed = 0;
151 fsip->fsi_pc = 0;
152 fsip->fsi_sp = 0;
153 fsip->fsi_depth = 0;
154 fsip->fsi_overflow = 0;
155
156 if (mdb_ctf_vread(&thr, "kthread_t", "mdb_findstack_kthread_t",
157 addr, print_warnings ? 0 : MDB_CTF_VREAD_QUIET) == -1) {
158 fsip->fsi_failed = FSI_FAIL_BADTHREAD;
159 return (DCMD_ERR);
160 }
161
162 fsip->fsi_sobj_ops = (uintptr_t)thr.t_sobj_ops;
163 fsip->fsi_tstate = thr.t_state;
164 fsip->fsi_panic = !!(thr.t_flag & T_PANIC);
165
166 if ((thr.t_schedflag & TS_LOAD) == 0) {
167 if (print_warnings)
168 mdb_warn("thread %p isn't in memory\n", addr);
169 fsip->fsi_failed = FSI_FAIL_NOTINMEMORY;
170 return (DCMD_ERR);
171 }
172
173 if (thr.t_stk < thr.t_stkbase) {
174 if (print_warnings)
175 mdb_warn(
176 "stack base or stack top corrupt for thread %p\n",
177 addr);
178 fsip->fsi_failed = FSI_FAIL_THREADCORRUPT;
179 return (DCMD_ERR);
180 }
181
182 kbase = (uintptr_t)thr.t_stkbase;
183 ktop = (uintptr_t)thr.t_stk;
184 stksz = ktop - kbase;
185
186 #ifdef __amd64
187 /*
188 * The stack on amd64 is intentionally misaligned, so ignore the top
189 * half-frame. See thread_stk_init(). When handling traps, the frame
190 * is automatically aligned by the hardware, so we only alter ktop if
191 * needed.
192 */
|
146 uintptr_t ubase, utop;
147 uintptr_t kbase, ktop;
148 uintptr_t win, sp;
149
150 fsip->fsi_failed = 0;
151 fsip->fsi_pc = 0;
152 fsip->fsi_sp = 0;
153 fsip->fsi_depth = 0;
154 fsip->fsi_overflow = 0;
155
156 if (mdb_ctf_vread(&thr, "kthread_t", "mdb_findstack_kthread_t",
157 addr, print_warnings ? 0 : MDB_CTF_VREAD_QUIET) == -1) {
158 fsip->fsi_failed = FSI_FAIL_BADTHREAD;
159 return (DCMD_ERR);
160 }
161
162 fsip->fsi_sobj_ops = (uintptr_t)thr.t_sobj_ops;
163 fsip->fsi_tstate = thr.t_state;
164 fsip->fsi_panic = !!(thr.t_flag & T_PANIC);
165
166 if (thr.t_stk < thr.t_stkbase) {
167 if (print_warnings)
168 mdb_warn(
169 "stack base or stack top corrupt for thread %p\n",
170 addr);
171 fsip->fsi_failed = FSI_FAIL_THREADCORRUPT;
172 return (DCMD_ERR);
173 }
174
175 kbase = (uintptr_t)thr.t_stkbase;
176 ktop = (uintptr_t)thr.t_stk;
177 stksz = ktop - kbase;
178
179 #ifdef __amd64
180 /*
181 * The stack on amd64 is intentionally misaligned, so ignore the top
182 * half-frame. See thread_stk_init(). When handling traps, the frame
183 * is automatically aligned by the hardware, so we only alter ktop if
184 * needed.
185 */
|