aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-01-21 17:43:32 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-01-21 17:43:32 +0000
commitcd5ee294397a341ad9e26c6b260d8b61a296e6c1 (patch)
treeef05a160164b9386a6e9aac72a4776af567af553 /gdb/printcmd.c
parent40df7e2729a6a01e1623f7893fb19278e2d56a19 (diff)
downloadgdb-cd5ee294397a341ad9e26c6b260d8b61a296e6c1.zip
gdb-cd5ee294397a341ad9e26c6b260d8b61a296e6c1.tar.gz
gdb-cd5ee294397a341ad9e26c6b260d8b61a296e6c1.tar.bz2
Thu Jan 20 15:04:24 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* printcmd.c (print_address_symbolic): Unconditionally use msymbol if we did not find a symbol.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 48bc4fc..95259fb 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -519,14 +519,22 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
struct minimal_symbol *msymbol;
struct symbol *symbol;
struct symtab *symtab = 0;
- CORE_ADDR name_location;
+ CORE_ADDR name_location = 0;
char *name;
/* First try to find the address in the symbol table, then
in the minsyms. Take the closest one. */
- symbol = fast_symbolic_addr? 0:
- find_addr_symbol (addr, &symtab, &name_location);
+ if (fast_symbolic_addr)
+ {
+ /* This is defective in the sense that it only finds text symbols. */
+ symbol = find_pc_function (addr);
+ if (symbol)
+ name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol));
+ }
+ else
+ find_addr_symbol (addr, &symtab, &name_location);
+
if (symbol)
{
if (do_demangle)
@@ -538,7 +546,7 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
msymbol = lookup_minimal_symbol_by_pc (addr);
if (msymbol != NULL)
{
- if (SYMBOL_VALUE_ADDRESS (msymbol) > name_location)
+ if (SYMBOL_VALUE_ADDRESS (msymbol) > name_location || symbol == NULL)
{
/* The msymbol is closer to the address than the symbol;
use the msymbol instead. */
@@ -551,6 +559,8 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
name = SYMBOL_LINKAGE_NAME (msymbol);
}
}
+ if (symbol == NULL && msymbol == NULL)
+ return;
/* If the nearest symbol is too far away, don't print anything symbolic. */