Add detection of IMB and IMBRange SWIs.
[deliverable/binutils-gdb.git] / gdb / maint.c
index ac86dd0b71ee50afc629fb330c8d97dd53d61cf7..46e96d9fb602f0a85fbd73bef49b7596013da6e4 100644 (file)
@@ -20,9 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 
 #include "defs.h"
-
-#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,11 +32,14 @@ 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>
 #endif
 
+extern void _initialize_maint_cmds PARAMS ((void));
+
 static void maintenance_command PARAMS ((char *, int));
 
 static void maintenance_dump_me PARAMS ((char *, int));
@@ -292,7 +293,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,25 +311,39 @@ 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 */
-
 void
 _initialize_maint_cmds ()
 {
-#if MAINTENANCE_CMDS   /* Entire file goes away if not including maint cmds */
   add_prefix_cmd ("maintenance", class_maintenance, maintenance_command,
                  "Commands for use by GDB maintainers.\n\
 Includes commands to dump specific internal GDB structures in\n\
@@ -422,5 +441,4 @@ When non-zero, this timeout is used instead of waiting forever for a target to\n
 finish a low-level step or continue operation.  If the specified amount of time\n\
 passes without a response from the target, an error occurs.", &setlist),
                     &showlist);
-#endif /* MAINTENANCE_CMDS */
 }
This page took 0.024382 seconds and 4 git commands to generate.