RFC: objdump: Always load separate debug info files when disassemblying

Message ID 87wly9d015.fsf@redhat.com
State New
Headers
Series RFC: objdump: Always load separate debug info files when disassemblying |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Nick Clifton April 14, 2026, 3:39 p.m. UTC
  Hi Guys,

  Attached is a patch to make objdump follow links to separate debug
  information files when it is disassembling.  The separate files may
  contain symbol tables that will help to improve the disassembler's
  output.

  The patch also removes the 'dump_any_debugging' static variable since
  it is no longer needed.  The function might_need_separate_debug_info()
  is sufficient to determine if there is a need to load the separate
  files.

  Any comments or suggestions for improvements ?

Cheers
  Nick
  

Patch

diff --git a/binutils/objdump.c b/binutils/objdump.c
index 8b6021a20fe..944b81b17e0 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -160,7 +160,6 @@  static enum color_selection
   off;
 #endif
 
-static int dump_any_debugging;
 static int demangle_flags = DMGL_ANSI | DMGL_PARAMS;
 
 /* This is reset to false each time we enter the disassembler, and set true
@@ -4402,9 +4405,6 @@  load_debug_section (enum dwarf_section_display_enum debug, void *file)
   asection *sec;
   const char *name;
 
-  if (!dump_any_debugging)
-    return false;
-
   /* If it is already loaded, do nothing.  */
   if (section->start != NULL)
     {
@@ -5742,6 +5742,9 @@  might_need_separate_debug_info (bool is_mainfile)
     return true;
   
   if (process_links || dump_symtab || dump_debugging
+      /* Disassembly benefits from symbol tables, which might
+	 be stored in the separate debug info file.  */
+      || disassemble
       || dump_dwarf_section_info || with_source_code)
     return true;
 
@@ -6474,12 +6482,6 @@  main (int argc, char **argv)
   if (!seenflag)
     usage (stderr, 2);
 
-  dump_any_debugging = (dump_debugging
-			|| dump_dwarf_section_info
-			|| dump_global_vars
-			|| process_links
-			|| with_source_code);
-
   if (formats_info)
     exit_status = display_info ();
   else