svn commit: r274735 - head/sys/powerpc/powerpc
Justin Hibbits
jhibbits at FreeBSD.org
Thu Nov 20 03:47:05 UTC 2014
Author: jhibbits
Date: Thu Nov 20 03:47:04 2014
New Revision: 274735
URL: https://svnweb.freebsd.org/changeset/base/274735
Log:
Use db_printsym() instead of our own in backtraces
Summary:
Currently if there are problems finding a symbol, backtrace ends up printing
something like:
0xdeadbeef: at +0x12345
Which is pretty useless. This on its own should be fixed (retrieving symbols),
but aside from that, using db_printsym() is a better solution anyway. If it
can't find a valid symbol it prints the actual address, and it has the added
benefit that if it can find the symbol, it might be able to print the file and
line as well.
Test Plan: Tested on my G4 PowerBook
Reviewers: #powerpc, nwhitehorn
Reviewed By: nwhitehorn
Differential Revision: https://reviews.freebsd.org/D1173
MFC after: 3 weeks
Modified:
head/sys/powerpc/powerpc/db_trace.c
Modified: head/sys/powerpc/powerpc/db_trace.c
==============================================================================
--- head/sys/powerpc/powerpc/db_trace.c Thu Nov 20 03:46:35 2014 (r274734)
+++ head/sys/powerpc/powerpc/db_trace.c Thu Nov 20 03:47:04 2014 (r274735)
@@ -135,9 +135,6 @@ static int
db_backtrace(struct thread *td, db_addr_t fp, int count)
{
db_addr_t stackframe, lr, *args;
- db_expr_t diff;
- c_db_sym_t sym;
- const char *symname;
boolean_t kernel_only = TRUE;
boolean_t full = FALSE;
@@ -265,16 +262,8 @@ db_backtrace(struct thread *td, db_addr_
print_trap:
lr = (db_addr_t) tf->srr0;
- diff = 0;
- symname = NULL;
- sym = db_search_symbol(lr, DB_STGY_ANY, &diff);
- db_symbol_values(sym, &symname, 0);
- if (symname == NULL || !strcmp(symname, "end")) {
- db_printf("%#zx: srr1=%#zx\n", lr, tf->srr1);
- } else {
- db_printf("%s+%#zx: srr1=%#zx\n", symname, diff,
- tf->srr1);
- }
+ db_printsym(lr, DB_STGY_ANY);
+ db_printf(": srr1=%#x\n", tf->srr1);
db_printf("%-10s r1=%#zx cr=%#x xer=%#x ctr=%#zx",
"", tf->fixreg[1], (uint32_t)tf->cr,
(uint32_t)tf->xer, tf->ctr);
@@ -288,14 +277,8 @@ db_backtrace(struct thread *td, db_addr_
goto next_frame;
}
- diff = 0;
- symname = NULL;
- sym = db_search_symbol(lr, DB_STGY_ANY, &diff);
- db_symbol_values(sym, &symname, 0);
- if (symname == NULL || !strcmp(symname, "end"))
- db_printf("at %zx", lr);
- else
- db_printf("at %s+%#zx", symname, diff);
+ db_printf("at ");
+ db_printsym(lr, DB_STGY_PROC);
if (full)
/* Print all the args stored in that stackframe. */
db_printf("(%zx, %zx, %zx, %zx, %zx, %zx, %zx, %zx)",
More information about the svn-src-all
mailing list