Index: sys/amd64/amd64/db_trace.c =================================================================== --- sys/amd64/amd64/db_trace.c +++ sys/amd64/amd64/db_trace.c @@ -202,7 +202,7 @@ db_addr_t callpc, void *frame) { - db_printf("%s() at ", name); + db_printf("%s() at ", name != NULL ? name : "??"); db_printsym(callpc, DB_STGY_PROC); if (frame != NULL) db_printf("/frame 0x%lx", (register_t)frame); @@ -334,7 +334,7 @@ static int db_backtrace(struct thread *td, struct amd64_frame *frame, db_addr_t pc, - int count) + register_t rsp, int count) { struct amd64_frame *actframe; #define MAXNARG 16 @@ -356,7 +356,20 @@ actframe = frame; if (first) { - if (strcmp(name, "fork_trampoline") == 0) { + first = FALSE; + if (sym == C_DB_SYM_NULL && rsp != 0) { + /* + * If a symbol couldn't be found, we've probably + * jumped to a bogus location, so try and use + * the return address to find our caller. + */ + db_print_stack_entry(name, 0, 0, 0, pc, NULL); + pc = db_get_value(rsp, 8, FALSE); + if (db_search_symbol(pc, DB_STGY_PROC, + &offset) == C_DB_SYM_NULL) + break; + continue; + } else if (strcmp(name, "fork_trampoline") == 0) { /* * Don't try to walk back on a stack for a * process that hasn't actually been run yet. @@ -365,7 +378,6 @@ actframe); break; } - first = FALSE; } argp = &actframe->f_arg0; @@ -412,7 +424,7 @@ frame = (struct amd64_frame *)rbp; callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE); frame = frame->f_frame; - db_backtrace(curthread, frame, callpc, -1); + db_backtrace(curthread, frame, callpc, 0, -1); } int @@ -422,7 +434,7 @@ ctx = kdb_thr_ctx(thr); return (db_backtrace(thr, (struct amd64_frame *)ctx->pcb_rbp, - ctx->pcb_rip, count)); + ctx->pcb_rip, ctx->pcb_rsp, count)); } int