MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_nextframe

Function db_nextframe

freebsd/amd64/amd64/db_trace.c:172–264  ·  view source on GitHub ↗

* Figure out the next frame up in the call stack. */

Source from the content-addressed store, hash-verified

170 * Figure out the next frame up in the call stack.
171 */
172static void
173db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
174{
175 struct trapframe *tf;
176 int frame_type;
177 long rip, rsp, rbp;
178 db_expr_t offset;
179 c_db_sym_t sym;
180 const char *name;
181
182 rip = db_get_value((long) &(*fp)->f_retaddr, 8, FALSE);
183 rbp = db_get_value((long) &(*fp)->f_frame, 8, FALSE);
184
185 /*
186 * Figure out frame type. We look at the address just before
187 * the saved instruction pointer as the saved EIP is after the
188 * call function, and if the function being called is marked as
189 * dead (such as panic() at the end of dblfault_handler()), then
190 * the instruction at the saved EIP will be part of a different
191 * function (syscall() in this example) rather than the one that
192 * actually made the call.
193 */
194 frame_type = NORMAL;
195 sym = db_search_symbol(rip - 1, DB_STGY_ANY, &offset);
196 db_symbol_values(sym, &name, NULL);
197 if (name != NULL) {
198 if (strcmp(name, "calltrap") == 0 ||
199 strcmp(name, "fork_trampoline") == 0 ||
200 strcmp(name, "mchk_calltrap") == 0 ||
201 strcmp(name, "nmi_calltrap") == 0 ||
202 strcmp(name, "Xdblfault") == 0)
203 frame_type = TRAP;
204 else if (strncmp(name, "Xatpic_intr", 11) == 0 ||
205 strncmp(name, "Xapic_isr", 9) == 0 ||
206 strcmp(name, "Xxen_intr_upcall") == 0 ||
207 strcmp(name, "Xtimerint") == 0 ||
208 strcmp(name, "Xipi_intr_bitmap_handler") == 0 ||
209 strcmp(name, "Xcpustop") == 0 ||
210 strcmp(name, "Xcpususpend") == 0 ||
211 strcmp(name, "Xrendezvous") == 0)
212 frame_type = INTERRUPT;
213 else if (strcmp(name, "Xfast_syscall") == 0 ||
214 strcmp(name, "Xfast_syscall_pti") == 0 ||
215 strcmp(name, "fast_syscall_common") == 0)
216 frame_type = SYSCALL;
217#ifdef COMPAT_FREEBSD32
218 else if (strcmp(name, "Xint0x80_syscall") == 0)
219 frame_type = SYSCALL;
220#endif
221 }
222
223 /*
224 * Normal frames need no special processing.
225 */
226 if (frame_type == NORMAL) {
227 *ip = (db_addr_t) rip;
228 *fp = (struct amd64_frame *) rbp;
229 return;

Callers 1

db_backtraceFunction · 0.70

Calls 9

db_get_valueFunction · 0.85
db_search_symbolFunction · 0.85
db_symbol_valuesFunction · 0.85
strcmpFunction · 0.85
strncmpFunction · 0.85
db_printfFunction · 0.85
db_print_stack_entryFunction · 0.70
decode_syscallFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected