aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2009-12-28 21:12:24 +0000
committerDaniel Jacobowitz <drow@false.org>2009-12-28 21:12:24 +0000
commit22e722e1995bffc3b891dbcac05b8c274f14194e (patch)
tree9143006604048400d691b1b62b517e85f8551180 /gdb/printcmd.c
parent957f3f49de19d92c755ccc59e36fffc1f65afd63 (diff)
downloadgdb-22e722e1995bffc3b891dbcac05b8c274f14194e.zip
gdb-22e722e1995bffc3b891dbcac05b8c274f14194e.tar.gz
gdb-22e722e1995bffc3b891dbcac05b8c274f14194e.tar.bz2
* defs.h (print_address_symbolic, build_address_symbolic): Update
prototypes. * printcmd.c (print_address_symbolic): Take a gdbarch argument. Pass it to build_address_symbolic. All callers updated. (build_address_symbolic): Take a gdbarch argument. Use gdbarch_addr_bits_remove for functions. All callers updated.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 9be742e..dd66f19 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -562,7 +562,8 @@ set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
settings of the demangle and asm_demangle variables. */
void
-print_address_symbolic (CORE_ADDR addr, struct ui_file *stream,
+print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct ui_file *stream,
int do_demangle, char *leadin)
{
char *name = NULL;
@@ -575,7 +576,7 @@ print_address_symbolic (CORE_ADDR addr, struct ui_file *stream,
struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &name);
make_cleanup (free_current_contents, &filename);
- if (build_address_symbolic (addr, do_demangle, &name, &offset,
+ if (build_address_symbolic (gdbarch, addr, do_demangle, &name, &offset,
&filename, &line, &unmapped))
{
do_cleanups (cleanup_chain);
@@ -615,7 +616,8 @@ print_address_symbolic (CORE_ADDR addr, struct ui_file *stream,
success, when all the info in the OUT paramters is valid. Return 1
otherwise. */
int
-build_address_symbolic (CORE_ADDR addr, /* IN */
+build_address_symbolic (struct gdbarch *gdbarch,
+ CORE_ADDR addr, /* IN */
int do_demangle, /* IN */
char **name, /* OUT */
int *offset, /* OUT */
@@ -658,6 +660,13 @@ build_address_symbolic (CORE_ADDR addr, /* IN */
if (symbol)
{
+ /* If this is a function (i.e. a code address), strip out any
+ non-address bits. For instance, display a pointer to the
+ first instruction of a Thumb function as <function>; the
+ second instruction will be <function+2>, even though the
+ pointer is <function+3>. This matches the ISA behavior. */
+ addr = gdbarch_addr_bits_remove (gdbarch, addr);
+
name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol));
if (do_demangle || asm_demangle)
name_temp = SYMBOL_PRINT_NAME (symbol);
@@ -722,7 +731,7 @@ print_address (struct gdbarch *gdbarch,
CORE_ADDR addr, struct ui_file *stream)
{
fputs_filtered (paddress (gdbarch, addr), stream);
- print_address_symbolic (addr, stream, asm_demangle, " ");
+ print_address_symbolic (gdbarch, addr, stream, asm_demangle, " ");
}
/* Return a prefix for instruction address:
@@ -763,11 +772,11 @@ print_address_demangle (struct gdbarch *gdbarch, CORE_ADDR addr,
else if (opts.addressprint)
{
fputs_filtered (paddress (gdbarch, addr), stream);
- print_address_symbolic (addr, stream, do_demangle, " ");
+ print_address_symbolic (gdbarch, addr, stream, do_demangle, " ");
}
else
{
- print_address_symbolic (addr, stream, do_demangle, "");
+ print_address_symbolic (gdbarch, addr, stream, do_demangle, "");
}
}