From: Will Newton Date: Fri, 7 Jun 2013 07:49:10 +0000 (+0000) Subject: gdb/printcmd.c: Fix printing of Thumb minimal symbols. X-Git-Tag: sid-snapshot-20130701~226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe8400b4383bda9333b559255b63c2c659e9ad5f;p=external%2Fbinutils.git 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 * printcmd.c (build_address_symbolic): Call gdbarch_addr_bits_remove for text minimal symbols. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 81abaab..6661193 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-06-07 Will Newton + * printcmd.c (build_address_symbolic): Call + gdbarch_addr_bits_remove for text minimal symbols. + +2013-06-07 Will Newton + * MAINTAINERS: Add myself to Write After Approval. 2013-06-07 Yao Qi 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 ; the + second instruction will be , even though the + pointer is . 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;