diff options
author | jhb <jhb@FreeBSD.org> | 2002-09-19 18:46:29 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-09-19 18:46:29 +0000 |
commit | 03dc7bc4a4835049f8702ae7cd0097de1673c8f5 (patch) | |
tree | c1476f925d34a2b15d6347328a15e33a91997d2f /sys/i386 | |
parent | 862a7a02065e4deed0e9939de05e07f75b74325c (diff) | |
download | FreeBSD-src-03dc7bc4a4835049f8702ae7cd0097de1673c8f5.zip FreeBSD-src-03dc7bc4a4835049f8702ae7cd0097de1673c8f5.tar.gz |
Implement db_print_backtrace() if DDB is compiled into the kernel. This
MD function is just a wrapper around db_stack_trace_cmd() that prints out
a backtrace of curthread. Currently, this function is only implemented
on i386 and alpha (and the alpha version isn't quite tested yet, will do
that in a bit). Other changes:
- For i386, fix a bug in the raw frame address case. The eip we extract
from the passed in frame address does not match the frame we received.
Thus, instead of printing a bogus frame with the wrong eip, go ahead
and advance frame down to the same frame as the eip we are using.
- For alpha, attempt to add a way of doing a raw trace for alpha. Instead
of passing a frame address in 'addr', pass in a pointer to a structure
containing PC and KSP and use those to start the backtrace. The alpha
db_print_backtrace() uses asm to read in the current PC and KSP values
into such a request.
Tested on: i386
Requested by: many
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/db_trace.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 8ac4c01..f3688c5 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -350,6 +350,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif) p = NULL; frame = (struct i386_frame *)addr; callpc = (db_addr_t)db_get_value((int)&frame->f_retaddr, 4, FALSE); + frame = frame->f_frame; } first = TRUE; @@ -470,6 +471,14 @@ DB_DRX_FUNC(dr6) DB_DRX_FUNC(dr7) +void +db_print_backtrace(void) +{ + register_t ebp; + + __asm __volatile("mov %%ebp,%0\n" : "=r" (ebp)); + db_stack_trace_cmd(ebp, 1, -1, NULL); +} int i386_set_watch(watchnum, watchaddr, size, access, d) |