]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: move debug output inside block in dwarf_record_line_1
authorAndrew Burgess <aburgess@redhat.com>
Sat, 25 Jan 2025 13:05:46 +0000 (13:05 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 29 Jan 2025 09:21:42 +0000 (09:21 +0000)
The debug output that says a line has been recorded is currently
outside the `if` block which decides if the line should be recorded or
not.  This means the debug output will claim the line was recorded,
when actually it wasn't!

Fixed by moving the debug output inside the `if` block.

Should be no user visible changes after this commit (except if debug
output is turned on).

Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/read.c

index 9e3d13c9875e75d3b945699b5244d2925f88ff96..63319458a4f8167b8bfd551b060e1e61c5f33e73 100644 (file)
@@ -17785,16 +17785,15 @@ dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile,
     = unrelocated_addr (gdbarch_addr_bits_remove (gdbarch,
                                                  (CORE_ADDR) address));
 
-  if (dwarf_line_debug)
+  if (cu != nullptr)
     {
-      gdb_printf (gdb_stdlog,
-                 "Recording line %u, file %s, address %s\n",
-                 line, lbasename (subfile->name.c_str ()),
-                 paddress (gdbarch, (CORE_ADDR) address));
-    }
+      if (dwarf_line_debug)
+       gdb_printf (gdb_stdlog, "Recording line %u, file %s, address %s\n",
+                   line, lbasename (subfile->name.c_str ()),
+                   paddress (gdbarch, (CORE_ADDR) address));
 
-  if (cu != nullptr)
-    cu->get_builder ()->record_line (subfile, line, addr, flags);
+      cu->get_builder ()->record_line (subfile, line, addr, flags);
+    }
 }
 
 /* Subroutine of dwarf_decode_lines_1 to simplify it.