From owner-svn-src-head@freebsd.org Tue Jul 21 23:07:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3CC9A775C; Tue, 21 Jul 2015 23:07:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51F531285; Tue, 21 Jul 2015 23:07:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6LN7vvm002626; Tue, 21 Jul 2015 23:07:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6LN7umu002624; Tue, 21 Jul 2015 23:07:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201507212307.t6LN7umu002624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 21 Jul 2015 23:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285774 - head/sys/ddb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2015 23:07:57 -0000 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;