* A few more improvements to gx jit prototype.
[deliverable/binutils-gdb.git] / gdb / maint.c
index 28dde7647334300fb7f36a504f754a84dd117633..cf4ceb7e9a1b3edb40888dbc53d8934e3e355508 100644 (file)
@@ -294,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;
@@ -308,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.024061 seconds and 4 git commands to generate.