svn commit: r285774 - head/sys/ddb
Mark Johnston
markj at FreeBSD.org
Tue Jul 21 23:07:57 UTC 2015
Author: markj
Date: Tue Jul 21 23:07:55 2015
New Revision: 285774
URL: https://svnweb.freebsd.org/changeset/base/285774
Log:
Don't return undefined symbols to a DDB symbol lookup.
Undefined symbols have a value of zero, so it makes no sense to return
such a symbol when performing a lookup by value. This occurs for example
when unwinding the stack after calling a NULL function pointer, and we
confusingly report the faulting function as uart_sab82532_class() on
amd64.
Convert db_print_loc_and_inst() to only attempt disassembly if we managed
to find a symbol corresponding to the IP. Otherwise we may fault and
re-enter the debugger.
Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D2858
Modified:
head/sys/ddb/db_examine.c
head/sys/ddb/db_main.c
Modified: head/sys/ddb/db_examine.c
==============================================================================
--- head/sys/ddb/db_examine.c Tue Jul 21 23:03:21 2015 (r285773)
+++ head/sys/ddb/db_examine.c Tue Jul 21 23:07:55 2015 (r285774)
@@ -232,9 +232,13 @@ db_print_cmd(db_expr_t addr, bool have_a
void
db_print_loc_and_inst(db_addr_t loc)
{
+ db_expr_t off;
+
db_printsym(loc, DB_STGY_PROC);
- db_printf(":\t");
- (void) db_disasm(loc, true);
+ if (db_search_symbol(loc, DB_STGY_PROC, &off) != C_DB_SYM_NULL) {
+ db_printf(":\t");
+ (void)db_disasm(loc, true);
+ }
}
/*
Modified: head/sys/ddb/db_main.c
==============================================================================
--- head/sys/ddb/db_main.c Tue Jul 21 23:03:21 2015 (r285773)
+++ head/sys/ddb/db_main.c Tue Jul 21 23:07:55 2015 (r285774)
@@ -110,7 +110,7 @@ X_db_search_symbol(db_symtab_t *symtab,
diff = ~0UL;
match = NULL;
for (sym = (Elf_Sym*)symtab->start; (char*)sym < symtab->end; sym++) {
- if (sym->st_name == 0)
+ if (sym->st_name == 0 || sym->st_shndx == SHN_UNDEF)
continue;
if (off < sym->st_value)
continue;
More information about the svn-src-all
mailing list