From: Andrew Burgess Date: Sat, 25 Jan 2025 13:05:46 +0000 (+0000) Subject: gdb: move debug output inside block in dwarf_record_line_1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5e7d55dcb225be1a488e01d43cbce5fdec83a0f;p=thirdparty%2Fbinutils-gdb.git gdb: move debug output inside block in dwarf_record_line_1 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 --- diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9e3d13c9875..63319458a4f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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.