mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
gas/Dwarf: improve debug info generation from .irp and alike blocks
Tying the bumping of the logical line number to reading from the original source file looks wrong: Upon finishing of the processing of an sb the original values will be restored anyway. Yet without bumping the line counter uses of .line inside e.g. an .irp construct won't have the intended effect: Such uses may be necessary to ensure proper debug info is emitted in particular when switching sections inside the .irp body, as dwarf2_gen_line_info() would bail without doing anything when it finds the line number unchanged from what it saw last.
This commit is contained in:
parent
36e2d65d26
commit
7992631e8c
@ -429,11 +429,10 @@ void
|
||||
bump_line_counters (void)
|
||||
{
|
||||
if (sb_index == (size_t) -1)
|
||||
{
|
||||
++physical_input_line;
|
||||
if (logical_input_line != -1u)
|
||||
++logical_input_line;
|
||||
}
|
||||
++physical_input_line;
|
||||
|
||||
if (logical_input_line != -1u)
|
||||
++logical_input_line;
|
||||
}
|
||||
|
||||
/* Tells us what the new logical line number and file are.
|
||||
|
80
gas/testsuite/gas/elf/dwarf-5-irp.d
Normal file
80
gas/testsuite/gas/elf/dwarf-5-irp.d
Normal file
@ -0,0 +1,80 @@
|
||||
#as: --gdwarf-5
|
||||
#name: line number entries for section changes inside .irp
|
||||
#readelf: -W -wlrR
|
||||
# The cr16 crx ft32 mn10* msp430 nds32* and rl78 targets do not evaluate the subtraction of symbols at assembly time.
|
||||
# The bfin target does not allow .subsection with an equated symbol as operand.
|
||||
# The d30v target emits sufficiently different debug info, apparently also covering padding it inserts.
|
||||
# The riscv targets do not support the subtraction of symbols.
|
||||
#xfail: bfin-* cr16-* crx-* d30v-* ft32-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
|
||||
|
||||
Raw dump of debug contents .*
|
||||
#...
|
||||
Line Number Statements:
|
||||
.*Extended opcode 2: .*
|
||||
.*Special opcode .* and Line by 2 to 3
|
||||
.*Set File Name to entry 2 .*
|
||||
.*Advance Line by 15 to 18
|
||||
.*Special opcode .* and Line by 0 to 18
|
||||
.*Special opcode .* and Line by 1 to 19
|
||||
.*Special opcode .* and Line by -1 to 18
|
||||
.*Special opcode .* and Line by 1 to 19
|
||||
.*Special opcode .* and Line by -1 to 18
|
||||
.*Special opcode .* and Line by 1 to 19
|
||||
.*Set File Name to entry 3 .*
|
||||
.*Advance Line by 9 to 28
|
||||
.*Special opcode .* and Line by 0 to 28
|
||||
.*Special opcode .* and Line by 1 to 29
|
||||
.*Special opcode .* and Line by -1 to 28
|
||||
.*Special opcode .* and Line by 1 to 29
|
||||
.*Special opcode .* and Line by -1 to 28
|
||||
.*Special opcode .* and Line by 1 to 29
|
||||
.*Advance PC by .*
|
||||
.*Extended opcode 1: End of Sequence
|
||||
|
||||
.*Set File Name to entry 4 .*
|
||||
.*Extended opcode 2: .*
|
||||
.*Special opcode .* and Line by 8 to 9
|
||||
.*Special opcode .* and Line by 1 to 10
|
||||
.*Advance PC by .*
|
||||
.*Extended opcode 1: End of Sequence
|
||||
|
||||
.*Set File Name to entry 4 .*
|
||||
.*Extended opcode 2: .*
|
||||
.*Special opcode .* and Line by 8 to 9
|
||||
.*Special opcode .* and Line by 1 to 10
|
||||
.*Advance PC by .*
|
||||
.*Extended opcode 1: End of Sequence
|
||||
|
||||
.*Set File Name to entry 4 .*
|
||||
.*Extended opcode 2: .*
|
||||
.*Special opcode .* and Line by 8 to 9
|
||||
.*Special opcode .* and Line by 1 to 10
|
||||
.*Advance PC by .*
|
||||
.*Extended opcode 1: End of Sequence
|
||||
|
||||
|
||||
Contents of the \.debug_aranges section:
|
||||
|
||||
Length: .*
|
||||
Version: +2
|
||||
Offset into \.debug_info: .*
|
||||
Pointer Size: +[248]
|
||||
Segment Size: +0
|
||||
|
||||
Address +Length
|
||||
0+ [0-9a-f]+ ?
|
||||
0+ [0-9a-f]+ ?
|
||||
0+ [0-9a-f]+ ?
|
||||
0+ [0-9a-f]+ ?
|
||||
0+ 0+ ?
|
||||
|
||||
Contents of the \.debug_rnglists section:
|
||||
|
||||
Offset +Begin +End
|
||||
[0-9a-f]+ 0+ [0-9a-f]+ ?
|
||||
[0-9a-f]+ 0+ [0-9a-f]+ ?
|
||||
[0-9a-f]+ 0+ [0-9a-f]+ ?
|
||||
[0-9a-f]+ 0+ [0-9a-f]+ ?
|
||||
[0-9a-f]+ <End of list>
|
||||
|
||||
#pass
|
31
gas/testsuite/gas/elf/dwarf-5-irp.s
Normal file
31
gas/testsuite/gas/elf/dwarf-5-irp.s
Normal file
@ -0,0 +1,31 @@
|
||||
.text
|
||||
_start:
|
||||
.nop
|
||||
|
||||
.irp n, ab, ij, xy
|
||||
.file "irp.s"
|
||||
.line 7
|
||||
.section .text.\n, "ax"
|
||||
.nop
|
||||
.nop
|
||||
.endr
|
||||
|
||||
.text
|
||||
|
||||
.irpc n, 123
|
||||
.file "irpc.s"
|
||||
.line 16
|
||||
.subsection \n
|
||||
.nop
|
||||
.nop
|
||||
.endr
|
||||
|
||||
n = 9
|
||||
.rept 3
|
||||
.file "rept.s"
|
||||
.line 26
|
||||
.subsection n
|
||||
.nop
|
||||
.nop
|
||||
n = n - 1
|
||||
.endr
|
@ -306,6 +306,7 @@ if { [is_elf_format] } then {
|
||||
run_dump_test "dwarf-4-cu" $dump_opts
|
||||
run_dump_test "dwarf-5-cu" $dump_opts
|
||||
run_dump_test "dwarf-5-nop-for-line-table" $dump_opts
|
||||
run_dump_test "dwarf-5-irp" $dump_opts
|
||||
run_dump_test "pr25917"
|
||||
run_dump_test "bss"
|
||||
run_dump_test "bad-bss"
|
||||
|
Loading…
Reference in New Issue
Block a user