From: Daniel Jacobowitz Date: Mon, 28 Dec 2009 21:12:24 +0000 (+0000) Subject: * defs.h (print_address_symbolic, build_address_symbolic): Update X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22e722e1995bffc3b891dbcac05b8c274f14194e;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 101f7e06e64..a12ca6ba266 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2009-12-28 Daniel Jacobowitz + + * 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 * ax-gdb.c (gen_expr) : Lookup `this' in the context of diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6875e8e59be..f041e647c0d 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 diff --git a/gdb/defs.h b/gdb/defs.h index b944ffb4d8e..542615c155d 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -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 592736727fd..21f767ed956 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 9be742ecf32..dd66f1973f8 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 ; the + second instruction will be , even though the + pointer is . 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 54d091df482..1055f171353 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