aboutsummaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-12-17 00:17:27 -0800
committerDoug Evans <xdje42@gmail.com>2014-12-17 00:17:27 -0800
commitcc485e620197e6db42d942820d499b01794aeb00 (patch)
tree639f0464adcd8c6807ff2a6bc66b3b5f30622c21 /gdb/minsyms.c
parent0ab9ce852ba65ef77cfc1fc82d1c48d03152f868 (diff)
downloadgdb-cc485e620197e6db42d942820d499b01794aeb00.zip
gdb-cc485e620197e6db42d942820d499b01794aeb00.tar.gz
gdb-cc485e620197e6db42d942820d499b01794aeb00.tar.bz2
New parameter "debug symbol-lookup".
gdb/ChangeLog: New parameter "debug symbol-lookup". * NEWS: Mention it. * cp-namespace.c (cp_lookup_symbol_imports_or_template): Add debug output. (cp_lookup_symbol_namespace, cp_lookup_symbol_nonlocal): Ditto. (cp_lookup_nested_symbol): Ditto. * language.c (language_lookup_primitive_type_by_name): Add debug output. * minsyms.c (lookup_minimal_symbol): Add debug output. * objfiles.c (objfile_debug_name): Moved here, and renamed ... * symfile-debug.c (debug_objfile_name): ... from here. All callers updated. * objfiles.h (objfile_debug_name): Declare. * symtab.h (symbol_lookup_debug): Declare. * symtab.c (symbol_lookup_debug): New global. (lookup_language_this): Add debug output. (lookup_symbol_aux, lookup_symbol_in_block): Ditto. (lookup_symbol_in_objfile_symtabs, lookup_symbol_via_quick_fns): Ditto. (lookup_symbol_in_static_block, lookup_symbol_in_objfile): Ditto. (_initialize_symtab): Add new parameter "debug symbol-lookup". gdb/doc/ChangeLog: * gdb.texinfo (Debugging Output): Document "debug symbol-lookup".
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 2463be4..2a421fc 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -203,6 +203,14 @@ lookup_minimal_symbol (const char *name, const char *sfile,
and the second over the demangled hash table. */
int pass;
+ if (symbol_lookup_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "lookup_minimal_symbol (%s, %s, %s)\n",
+ name, sfile != NULL ? sfile : "NULL",
+ objfile_debug_name (objfile));
+ }
+
for (pass = 1; pass <= 2 && found_symbol.minsym == NULL; pass++)
{
/* Select hash list according to pass. */
@@ -282,13 +290,42 @@ lookup_minimal_symbol (const char *name, const char *sfile,
/* External symbols are best. */
if (found_symbol.minsym != NULL)
- return found_symbol;
+ {
+ if (symbol_lookup_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "lookup_minimal_symbol (...) = %s"
+ " (external)\n",
+ host_address_to_string (found_symbol.minsym));
+ }
+ return found_symbol;
+ }
/* File-local symbols are next best. */
if (found_file_symbol.minsym != NULL)
- return found_file_symbol;
+ {
+ if (symbol_lookup_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "lookup_minimal_symbol (...) = %s"
+ " (file-local)\n",
+ host_address_to_string
+ (found_file_symbol.minsym));
+ }
+ return found_file_symbol;
+ }
/* Symbols for shared library trampolines are next best. */
+ if (symbol_lookup_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "lookup_minimal_symbol (...) = %s%s\n",
+ trampoline_symbol.minsym != NULL
+ ? host_address_to_string (trampoline_symbol.minsym)
+ : "NULL",
+ trampoline_symbol.minsym != NULL
+ ? " (trampoline)" : "");
+ }
return trampoline_symbol;
}