* A few more improvements to gx jit prototype.
[deliverable/binutils-gdb.git] / gdb / maint.c
index ac86dd0b71ee50afc629fb330c8d97dd53d61cf7..cf4ceb7e9a1b3edb40888dbc53d8934e3e355508 100644 (file)
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #if MAINTENANCE_CMDS   /* Entire rest of file goes away if not including maint cmds */
 
+#include <ctype.h>
 #include <signal.h>
 #include "command.h"
 #include "gdbcmd.h"
@@ -34,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "language.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "value.h"
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -292,7 +294,11 @@ maintenance_translate_address (arg, from_tty)
   CORE_ADDR address;
   asection *sect;
   char *p;
-  struct symbol *sym;
+  struct minimal_symbol *sym;
+  struct objfile *objfile;
+
+  if (arg == NULL || *arg == 0)
+    error ("requires argument (address or section + address)");
 
   sect = NULL;
   p = arg;
@@ -306,17 +312,34 @@ maintenance_translate_address (arg, from_tty)
       *p++ = '\000';
       while (isspace (*p)) p++;        /* Skip whitespace */
 
-      sect = bfd_get_section_by_name (exec_bfd, arg);
+      ALL_OBJFILES (objfile)
+       {
+         sect = bfd_get_section_by_name (objfile->obfd, arg);
+         if (sect != NULL)
+           break;
+       }
+
       if (!sect)
        error ("Unknown section %s.", arg);
     }
 
   address = parse_and_eval_address (p);
 
-  return;
-/*  sym = find_pc_function_section (address, sect);*/
+  if (sect)
+    sym = lookup_minimal_symbol_by_pc_section (address, sect);
+  else
+    sym = lookup_minimal_symbol_by_pc (address);
+
+  if (sym)
+    printf_filtered ("%s+%u\n", 
+                    SYMBOL_SOURCE_NAME (sym), 
+                    address - SYMBOL_VALUE_ADDRESS (sym));
+  else if (sect)
+    printf_filtered ("no symbol at %s:0x%08x\n", sect->name, address);
+  else
+    printf_filtered ("no symbol at 0x%08x\n", address);
 
-  printf_unfiltered ("%s+%u\n", SYMBOL_SOURCE_NAME (sym), address - SYMBOL_VALUE_ADDRESS (sym));
+  return;
 }
 
 #endif /* MAINTENANCE_CMDS */
This page took 0.024763 seconds and 4 git commands to generate.