[gdb] Make maint info sections print relocated addresses
[deliverable/binutils-gdb.git] / gdb / maint.c
index f7485dc3ab76413f6cd72437111ce37157770662..837ed23cfb6b9217aacab4103b687eb7ba51ec15 100644 (file)
@@ -329,33 +329,36 @@ maintenance_info_sections (const char *arg, int from_tty)
 {
   if (exec_bfd)
     {
+      struct obj_section *osect;
+      bool allobj = false;
+
       printf_filtered (_("Exec file:\n"));
       printf_filtered ("    `%s', ", bfd_get_filename (exec_bfd));
       wrap_here ("        ");
       printf_filtered (_("file type %s.\n"), bfd_get_target (exec_bfd));
-      if (arg && *arg && match_substring (arg, "ALLOBJ"))
-       {
-         struct obj_section *osect;
 
-         /* Only this function cares about the 'ALLOBJ' argument; 
-            if 'ALLOBJ' is the only argument, discard it rather than
-            passing it down to print_objfile_section_info (which 
-            wouldn't know how to handle it).  */
-         if (strcmp (arg, "ALLOBJ") == 0)
-           arg = NULL;
+      /* Only this function cares about the 'ALLOBJ' argument;
+        if 'ALLOBJ' is the only argument, discard it rather than
+        passing it down to print_objfile_section_info (which
+        wouldn't know how to handle it).  */
+      if (arg && strcmp (arg, "ALLOBJ") == 0)
+       {
+         arg = NULL;
+         allobj = true;
+       }
 
-         for (objfile *ofile : current_program_space->objfiles ())
+      for (objfile *ofile : current_program_space->objfiles ())
+       {
+         if (allobj)
+           printf_filtered (_("  Object file: %s\n"),
+                            bfd_get_filename (ofile->obfd));
+         ALL_OBJFILE_OSECTIONS (ofile, osect)
            {
-             printf_filtered (_("  Object file: %s\n"), 
-                              bfd_get_filename (ofile->obfd));
-             ALL_OBJFILE_OSECTIONS (ofile, osect)
-               {
-                 print_objfile_section_info (ofile->obfd, osect, arg);
-               }
+             if (!allobj && ofile->obfd != exec_bfd)
+               continue;
+             print_objfile_section_info (ofile->obfd, osect, arg);
            }
        }
-      else 
-       bfd_map_over_sections (exec_bfd, print_bfd_section_info, (void *) arg);
     }
 
   if (core_bfd)
This page took 0.028811 seconds and 4 git commands to generate.