aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2025-01-21 15:23:19 +0100
committerTom de Vries <tdevries@suse.de>2025-01-21 15:23:19 +0100
commit8935725a44715b687908dc3daeee26597aa40dab (patch)
tree9c41193a7a43fa8583bd16eff703640866cc294c /gdb/testsuite
parent94b3bbb668e86021713489bb501cb6e3823ae1c1 (diff)
downloadgdb-8935725a44715b687908dc3daeee26597aa40dab.zip
gdb-8935725a44715b687908dc3daeee26597aa40dab.tar.gz
gdb-8935725a44715b687908dc3daeee26597aa40dab.tar.bz2
[gdb/symtab] Fix gdb.base/fission-macro.exp with unix/-m32
When running test-case gdb.base/fission-macro.exp on openSUSE Tumbleweed (using gcc 14) with target board unix/-m32, I get: ... (gdb) info macro FIRST^M Defined at /data/vries/gdb/src/gdb/testsuite/gdb.base/fission-macro.c:0^M -DFIRST=1^M (gdb) FAIL: $exp: \ dwarf_version=5: dwarf_bits=32: strict_dwarf=0: info macro FIRST ... instead of the expected: ... (gdb) info macro FIRST^M Defined at /data/vries/gdb/src/gdb/testsuite/gdb.base/fission-macro.c:18^M (gdb) PASS: $exp: \ dwarf_version=5: dwarf_bits=32: strict_dwarf=0: info macro FIRST ... A dwarf-5 .debug_str_offsets section starts with a header consisting of: - an initial length (4 bytes for 32-bit and 12 bytes for 64-bit), - a 2 byte version string, and - 2 bytes padding so in total 8 bytes for 32-bit and 16 bytes for 64-bit. This offset is calculated here in dwarf_decode_macros: ... str_offsets_base = cu->header.addr_size; ... which is wrong for both dwarf-5 cases (and also happens to be wrong for dwarf-4). Fix this by computing str_offsets_base correctly for dwarf-5, for both the 32-bit and 64-bit case. Likewise, fix this for dwarf-4, using str_offsets_base 0. We can only test this with gcc-15, because gcc 14 and earlier don't have the fix for PR debug/115066. Tested on x86_64-linux. Tested test-case using a current gcc trunk build, and gcc 14. Approved-By: Tom Tromey <tom@tromey.com> PR symtab/31897 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31897
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/fission-macro.exp8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp
index 705e3dd..9e5d5c0 100644
--- a/gdb/testsuite/gdb.base/fission-macro.exp
+++ b/gdb/testsuite/gdb.base/fission-macro.exp
@@ -66,8 +66,12 @@ proc do_tests { dwarf_version dwarf_bits strict_dwarf } {
gdb_test "info macro FOURTH" "#define FOURTH 4"
}
-foreach_with_prefix dwarf_version {5} {
- foreach_with_prefix dwarf_bits {32} {
+foreach_with_prefix dwarf_version {4 5} {
+ if { $dwarf_version == 4 && [gcc_major_version] < 15 } {
+ # Gcc does not contain fix for PR debug/115066.
+ continue
+ }
+ foreach_with_prefix dwarf_bits {32 64} {
foreach_with_prefix strict_dwarf {0 1} {
do_tests $dwarf_version $dwarf_bits $strict_dwarf
}