diff options
author | Tom de Vries <tdevries@suse.de> | 2024-05-13 18:10:15 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-05-14 14:00:13 +0200 |
commit | b7003b4cc5e263343f047fe64ed1ae12f561b2d1 (patch) | |
tree | 1c79750e228edee4b5b06a3391ddb70d67643855 /gcc/expr.cc | |
parent | 1ec49897253e093e1ef6261eb104ac0c111bac83 (diff) | |
download | gcc-b7003b4cc5e263343f047fe64ed1ae12f561b2d1.zip gcc-b7003b4cc5e263343f047fe64ed1ae12f561b2d1.tar.gz gcc-b7003b4cc5e263343f047fe64ed1ae12f561b2d1.tar.bz2 |
[debug] Fix dwarf v4 .debug_macro.dwo
Consider a hello world, compiled with -gsplit-dwarf and dwarf version 4, and
-g3:
...
$ gcc -gdwarf-4 -gsplit-dwarf /data/vries/hello.c -g3 -save-temps -dA
...
In section .debug_macro.dwo, we have:
...
.Ldebug_macro0:
.value 0x4 # DWARF macro version number
.byte 0x2 # Flags: 32-bit, lineptr present
.long .Lskeleton_debug_line0
.byte 0x3 # Start new file
.uleb128 0 # Included from line number 0
.uleb128 0x1 # file /data/vries/hello.c
.byte 0x5 # Define macro strp
.uleb128 0 # At line number 0
.uleb128 0x1d0 # The macro: "__STDC__ 1"
...
Given that we use a DW_MACRO_define_strp, we'd expect 0x1d0 to be an
offset into a .debug_str.dwo section.
But in fact, 0x1d0 is an index into the string offset table in
section .debug_str_offsets.dwo:
...
.long 0x34f0 # indexed string 0x1d0: __STDC__ 1
...
Add asserts that catch this inconsistency, and fix this by using
DW_MACRO_define_strx instead.
Tested on x86_64.
gcc/ChangeLog:
2024-05-14 Tom de Vries <tdevries@suse.de>
PR debug/115066
* dwarf2out.cc (output_macinfo_op): Fix DW_MACRO_define_strx/strp
choice for v4 .debug_macro.dwo. Add asserts to check that choice.
gcc/testsuite/ChangeLog:
2024-05-14 Tom de Vries <tdevries@suse.de>
PR debug/115066
* gcc.dg/pr115066.c: New test.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions