* defs.h (print_address_symbolic, build_address_symbolic): Update
authorDaniel Jacobowitz <drow@false.org>
Mon, 28 Dec 2009 21:12:24 +0000 (21:12 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 28 Dec 2009 21:12:24 +0000 (21:12 +0000)
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.

gdb/ChangeLog
gdb/breakpoint.c
gdb/defs.h
gdb/disasm.c
gdb/printcmd.c
gdb/tui/tui-stack.c

index 101f7e06e64ded5de4ef741dcec1884cf760158e..a12ca6ba266b92b67249805b720810fd1d321c54 100644 (file)
@@ -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
index 6875e8e59be150aae3d33541505d0dc36fce1f83..f041e647c0d199f4e3218ca67580f907e4460aba 100644 (file)
@@ -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
index b944ffb4d8e0a724df17a92ecf6d5b29cadb6c3d..542615c155dcf2712a124b2849458fe609919006 100644 (file)
@@ -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, 
index 592736727fdff7af4f6391ccad80c0870b40edea..21f767ed9562cbd3ea8ccd67c99d477bbc792faf 100644 (file)
@@ -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
index 9be742ecf328d79812b857814ed6c52f08078a65..dd66f1973f892ee3a74772d2f3f80793242c4349 100644 (file)
@@ -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, "");
     }
 }
 \f
index 54d091df482bb6d6e56daca4422ff1acfa2c6af7..1055f17135302ff068fd1340c98ea3a7571e2e03 100644 (file)
@@ -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