aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorWill Newton <willnewton@sourceware.org>2013-06-07 07:49:10 +0000
committerWill Newton <willnewton@sourceware.org>2013-06-07 07:49:10 +0000
commitfe8400b4383bda9333b559255b63c2c659e9ad5f (patch)
treeb7d6eeb648a8e617a8f83677f62a1d6c5f71ccca /gdb/printcmd.c
parent20df6206ba0b4f41c842646a3f75a6743fb41090 (diff)
downloadgdb-fe8400b4383bda9333b559255b63c2c659e9ad5f.zip
gdb-fe8400b4383bda9333b559255b63c2c659e9ad5f.tar.gz
gdb-fe8400b4383bda9333b559255b63c2c659e9ad5f.tar.bz2
gdb/printcmd.c: Fix printing of Thumb minimal symbols.
In build_address_symbolic we call gdbarch_addr_bits_remove for symbols in the symbol table but not for minimal symbols. This causes a failure in gdb.cp/virtfunc.exp on ARM, as the address of the virtual thunk is given an offset of 1 when in Thumb mode. gdb/ChangeLog: 2013-06-07 Will Newton <will.newton@linaro.org> * printcmd.c (build_address_symbolic): Call gdbarch_addr_bits_remove for text minimal symbols.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 7beb334..99d4dba 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -689,6 +689,17 @@ build_address_symbolic (struct gdbarch *gdbarch,
{
if (SYMBOL_VALUE_ADDRESS (msymbol) > name_location || symbol == NULL)
{
+ /* 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. */
+ if (MSYMBOL_TYPE (msymbol) == mst_text
+ || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
+ || MSYMBOL_TYPE (msymbol) == mst_file_text
+ || MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
+ addr = gdbarch_addr_bits_remove (gdbarch, addr);
+
/* The msymbol is closer to the address than the symbol;
use the msymbol instead. */
symbol = 0;