* Figure out the next frame up in the call stack. */
| 293 | * Figure out the next frame up in the call stack. |
| 294 | */ |
| 295 | static void |
| 296 | db_nextframe(struct i386_frame **fp, db_addr_t *ip, struct thread *td) |
| 297 | { |
| 298 | struct trapframe *tf; |
| 299 | int frame_type; |
| 300 | int eip, esp, ebp; |
| 301 | db_expr_t offset; |
| 302 | c_db_sym_t sym; |
| 303 | const char *name; |
| 304 | |
| 305 | eip = db_get_value((int) &(*fp)->f_retaddr, 4, false); |
| 306 | ebp = db_get_value((int) &(*fp)->f_frame, 4, false); |
| 307 | |
| 308 | /* |
| 309 | * Figure out frame type. We look at the address just before |
| 310 | * the saved instruction pointer as the saved EIP is after the |
| 311 | * call function, and if the function being called is marked as |
| 312 | * dead (such as panic() at the end of dblfault_handler()), then |
| 313 | * the instruction at the saved EIP will be part of a different |
| 314 | * function (syscall() in this example) rather than the one that |
| 315 | * actually made the call. |
| 316 | */ |
| 317 | frame_type = NORMAL; |
| 318 | |
| 319 | if (eip >= PMAP_TRM_MIN_ADDRESS) { |
| 320 | sym = db_search_symbol(eip - 1 - setidt_disp, DB_STGY_ANY, |
| 321 | &offset); |
| 322 | } else { |
| 323 | sym = db_search_symbol(eip - 1, DB_STGY_ANY, &offset); |
| 324 | } |
| 325 | db_symbol_values(sym, &name, NULL); |
| 326 | if (name != NULL) { |
| 327 | if (strcmp(name, "calltrap") == 0 || |
| 328 | strcmp(name, "fork_trampoline") == 0) |
| 329 | frame_type = TRAP; |
| 330 | else if (strncmp(name, "Xatpic_intr", 11) == 0 || |
| 331 | strncmp(name, "Xapic_isr", 9) == 0) { |
| 332 | frame_type = INTERRUPT; |
| 333 | } else if (strcmp(name, "Xlcall_syscall") == 0 || |
| 334 | strcmp(name, "Xint0x80_syscall") == 0) |
| 335 | frame_type = SYSCALL; |
| 336 | else if (strcmp(name, "dblfault_handler") == 0) |
| 337 | frame_type = DOUBLE_FAULT; |
| 338 | else if (strcmp(name, "Xtimerint") == 0 || |
| 339 | strcmp(name, "Xxen_intr_upcall") == 0) |
| 340 | frame_type = INTERRUPT; |
| 341 | else if (strcmp(name, "Xcpustop") == 0 || |
| 342 | strcmp(name, "Xrendezvous") == 0 || |
| 343 | strcmp(name, "Xipi_intr_bitmap_handler") == 0) { |
| 344 | /* No arguments. */ |
| 345 | frame_type = INTERRUPT; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | /* |
| 350 | * Normal frames need no special processing. |
| 351 | */ |
| 352 | if (frame_type == NORMAL) { |
no test coverage detected