readelf: Add -N option, speeds up DWARF printing without address->name lookups.
authorRoland McGrath <roland@redhat.com>
Sun, 28 Jun 2009 21:48:02 +0000 (14:48 -0700)
committerRoland McGrath <roland@redhat.com>
Sun, 28 Jun 2009 21:48:02 +0000 (14:48 -0700)
NEWS
src/ChangeLog
src/readelf.c

diff --git a/NEWS b/NEWS
index e3106f7..2933d35 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ libelf: Add elf_getshdrnum alias for elf_getshnum and elf_getshdrstrndx alias
         for elf_getshstrndx and deprecate original names.  Sun screwed up
         their implementation and asked for a solution.
 
+readelf: Add -N option, speeds up DWARF printing without address->name lookups.
+
 Version 0.141:
 
 libebl: sparc backend fixes;
index f74b31d..a1078ab 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-28  Roland McGrath  <roland@redhat.com>
+
+       * readelf.c (print_address_names): New static variable.
+       (options, parse_opt): Grok -N/--numeric-addresses to clear it.
+       (format_dwarf_addr): Don't look up name if !print_address_names.
+
 2009-06-13  Ulrich Drepper  <drepper@redhat.com>
 
        * ldgeneric.c: Don't use deprecated libelf functions.
index ca9772e..2ab2ab5 100644 (file)
@@ -100,6 +100,8 @@ static const struct argp_option options[] =
     0 },
 
   { NULL, 0, NULL, 0, N_("Output control:"), 0 },
+  { "numeric-addresses", 'N', NULL, 0,
+    N_("Do not find symbol names for addresses in DWARF data"), 0 },
 
   { NULL, 0, NULL, 0, NULL, 0 }
 };
@@ -165,6 +167,9 @@ static bool print_archive_index;
 /* True if any of the control options except print_archive_index is set.  */
 static bool any_control_option;
 
+/* True if we should print addresses from DWARF in symbolic form.  */
+static bool print_address_names = true;
+
 /* Select printing of debugging sections.  */
 static enum section_e
 {
@@ -406,6 +411,9 @@ parse_opt (int key, char *arg,
       add_dump_section (arg);
       any_control_option = true;
       break;
+    case 'N':
+      print_address_names = false;
+      break;
     case ARGP_KEY_NO_ARGS:
       fputs (gettext ("Missing file name.\n"), stderr);
       goto do_argp_help;
@@ -3061,7 +3069,8 @@ format_dwarf_addr (Dwfl_Module *dwflmod,
 {
   /* See if there is a name we can give for this address.  */
   GElf_Sym sym;
-  const char *name = dwfl_module_addrsym (dwflmod, address, &sym, NULL);
+  const char *name = print_address_names
+    ? dwfl_module_addrsym (dwflmod, address, &sym, NULL) : NULL;
   if (name != NULL)
     sym.st_value = address - sym.st_value;