diff options
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/breakpoint.c | 3 | ||||
-rw-r--r-- | gdb/defs.h | 7 | ||||
-rw-r--r-- | gdb/disasm.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 21 | ||||
-rw-r--r-- | gdb/tui/tui-stack.c | 3 |
6 files changed, 33 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 101f7e0..a12ca6b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-12-28 Daniel Jacobowitz <dan@codesourcery.com> + + * 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. + 2009-12-28 Pedro Alves <pedro@codesourcery.com> * ax-gdb.c (gen_expr) <OP_THIS>: Lookup `this' in the context of diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6875e8e..f041e64 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3982,7 +3982,8 @@ static void print_breakpoint_location (struct breakpoint *b, } else if (loc) { - print_address_symbolic (loc->address, stb->stream, demangle, ""); + print_address_symbolic (loc->gdbarch, loc->address, stb->stream, + demangle, ""); ui_out_field_stream (uiout, "at", stb); } else @@ -596,10 +596,11 @@ extern int info_verbose; extern void set_next_address (struct gdbarch *, CORE_ADDR); -extern void print_address_symbolic (CORE_ADDR, struct ui_file *, int, - char *); +extern void print_address_symbolic (struct gdbarch *, CORE_ADDR, + struct ui_file *, int, char *); -extern int build_address_symbolic (CORE_ADDR addr, +extern int build_address_symbolic (struct gdbarch *, + CORE_ADDR addr, int do_demangle, char **name, int *offset, diff --git a/gdb/disasm.c b/gdb/disasm.c index 5927367..21f767e 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -116,7 +116,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, ui_out_text (uiout, pc_prefix (pc)); ui_out_field_core_addr (uiout, "address", gdbarch, pc); - if (!build_address_symbolic (pc, 0, &name, &offset, &filename, + if (!build_address_symbolic (gdbarch, pc, 0, &name, &offset, &filename, &line, &unmapped)) { /* We don't care now about line, filename and 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, ""); } } diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 54d091d..1055f17 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -218,7 +218,8 @@ tui_get_function_from_frame (struct frame_info *fi) struct ui_file *stream = tui_sfileopen (256); char *p; - print_address_symbolic (get_frame_pc (fi), stream, demangle, ""); + print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi), + stream, demangle, ""); p = tui_file_get_strbuf (stream); /* Use simple heuristics to isolate the function name. The symbol |