SHA256
8
0
forked from pool/gdb
Files
gdb/gdb-symtab-fix-gdb.base-fission-macro.exp-with-unix-.patch
Tom de Vries 356d71c00b - Update to fedora rawhide @ c65d4ba.
Patched dropped:
  * gdb-6.6-buildid-locate-tests.patch
  Patches modified:
  * gdb-add-rpm-suggestion-script.patch
- Update to fedora rawhide @ 12e32a6.
  Patches modified:
  * gdb-add-rpm-suggestion-script.patch
  * gdb-backport-buildid-related-changes.patch
  * gdb-remove-qnx-neutrino-support.patch
- Update to fedora rawhide @ 264209d.
  Maintenance script import-fedora.sh:
  * Drop gdb-rhbz1156192-recursive-dlopen-test.patch
    from skip_patches.
- Update to fedora rawhide @ 020018c.
  Maintenance script import-fedora.sh:
  * Drop gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch from
    skip_patches.
- Update to fedora rawhide @ 1e3eb79.
  Maintenance script import-fedora.sh:
  * Drop gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch from
    skip_patches.
- Update to fedora rawhide @ 1a098a7.
  Patches dropped:
  * gdb-6.3-gstack-20050411.patch
  * gdb-testsuite-require-can_spawn_for_attach-in-gdb.ba.patch
- Update to fedora rawhide @ 5fc2d96.
  Patches dropped:
  * gdb-backport-buildid-related-changes.patch
  * gdb-catchpoint-re-set.patch
  * gdb-remove-qnx-neutrino-support.patch
- Update to fedora rawhide @ 6b0ca99 (gdb 16.2).
  Patches updated (fedora):
  * gdb-add-rpm-suggestion-script.patch
  Maintenance script qa-local.sh:
  * Update version to 16.2.
  Patches updated:
  * gdb-testsuite-ada-pie.patch
  * gdb-tui-enable-work-around-libncurses-segfault.patch
  * gdb-guile-use-scm_debug_typing_strictness-0.patch
  * add-gdbarch_dwarf2_reg_piece_offset-hook.patch
  * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-on-s3.patch
  * gdb-cli-add-ignore-errors-command.patch
  * fixup-gdb-add-rpm-suggestion-script.patch
  Patches dropped:
  * gdb-testsuite-fix-another-regexp-in-gdb.threads-step.patch  
  * gdb-testsuite-fix-error-in-gdb.server-server-kill-py.patch
  * gdb-testsuite-fix-timeout-in-gdb.tui-resize-2.exp.patch
  * fix-gdb.dap-step-out.exp-on-s390x.patch
  * fix-gdb.dwarf2-shortpiece.exp-on-s390x.patch
  * gdb-build-fix-unused-var-in-corelow.c.patch
  * gdb-exp-fix-gdb.fortran-intrinsics.exp-fail-on-arm.patch
  * gdb-prune-inferior-after-switching-inferior.patch
  * gdb-record-fix-out-of-bounds-write-in-aarch64_record.patch
  * gdb-symtab-fix-target-type-of-complex-long-double-on.patch
  * gdb-symtab-return-correct-reader-for-top-level-cu-in.patch
  * gdb-tdep-fix-arm-thumb2-hw-breakpoint.patch
  * gdb-tdep-fix-recording-of-t1-push.patch
  * gdb-tdep-handle-sycall-statx-for-arm-linux.patch
  * gdb-tdep-handle-syscall-clock_gettime64-for-arm-linu.patch
  * gdb-tdep-s390-add-arch15-record-replay-support.patch
  * gdb-testsuite-avoid-intermittent-failures-on-a-debug.patch
  * gdb-testsuite-don-t-use-set-auto-solib-add-off.patch
  * gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-on-arm-lin.patch
  * gdb-testsuite-fix-gdb.arch-arm-pseudo-unwind.exp-wit.patch
  * gdb-testsuite-fix-gdb.arch-arm-single-step-kernel-he.patch
  * gdb-testsuite-fix-gdb.arch-riscv-tdesc-regs.exp.patch
  * gdb-testsuite-fix-gdb.base-empty-host-env-vars.exp.patch
  * gdb-testsuite-fix-gdb.base-list-dot-nodebug-and-make.patch
  * gdb-testsuite-fix-gdb.cp-m-static.exp-on-arm.patch
  * gdb-testsuite-fix-gdb.dwarf2-dw2-fixed-point.exp-on-.patch
  * gdb-testsuite-fix-gdb.dwarf2-dw2-lines.exp-on-arm-li.patch
  * gdb-testsuite-fix-gdb.fortran-array-bounds.exp-on-ar.patch
  * gdb-testsuite-fix-gdb.python-py-format-address.exp-o.patch
  * gdb-testsuite-fix-gdb.python-py-format-string.exp-wi.patch
  * gdb-testsuite-fix-gdb.python-py-mi-cmd.exp-with-pyth.patch
  * gdb-testsuite-fix-gdb.threads-leader-exit-attach.exp.patch
  * gdb-testsuite-fix-regexp-in-gdb.ada-mi_var_access.ex.patch
  * gdb-testsuite-fix-regexp-in-gdb.arch-i386-disp-step-.patch
  * gdb-testsuite-fix-regexp-in-gdb.threads-stepi-over-c.patch
  * gdb-testsuite-fix-timeout-in-gdb.mi-mi-multi-command.patch
  * handle-address-class-annotation-for-s390x-in-some-te.patch
  * opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch
  * s390-add-arch15-concurrent-functions-facility-insns.patch
  * s390-add-arch15-instruction-names.patch
  * s390-add-arch15-instructions.patch
  * s390-align-opcodes-to-lower-case.patch
  * s390-fix-disassembly-of-optional-addressing-operands.patch
  * s390-relax-risbg-n-z-risb-h-l-gz-rns-ros-rxs-bgt-ope.patch
  * s390-simplify-dis-assembly-of-insn-operands-with-con.patch
  * s390-treat-addressing-operand-sequence-as-one-in-dis.patch
  * use-setvariable-in-gdb.dap-scopes.exp.patch
  Patches added:
  * gdb-testsuite-fix-gdb.dwarf2-implptr.exp-regression.patch
  * gdb-testsuite-work-around-pr32850.patch
  * gdb-symtab-fix-gdb.base-fission-macro.exp-with-unix-.patch
  * gdb-testsuite-fix-another-timeout-in-gdb.base-bg-exe.patch
- Add "BuildRequires: glibc-locale" for gdb:testsuite to fix
  SLFO testsuite failures.

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=454
2025-04-10 03:19:12 +00:00

103 lines
3.4 KiB
Diff

From f60ba4bfaa3d9f499aa0b16d278b969a3074b0e1 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 21 Jan 2025 15:23:19 +0100
Subject: [PATCH] [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
---
gdb/dwarf2/read.c | 12 +++++++++++-
gdb/testsuite/gdb.base/fission-macro.exp | 8 ++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 49fb219f03d..f0873f189d3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -21610,7 +21610,17 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
str_offsets_section = &cu->dwo_unit->dwo_file
->sections.str_offsets;
str_section = &cu->dwo_unit->dwo_file->sections.str;
- str_offsets_base = cu->header.addr_size;
+ if (cu->header.version <= 4)
+ str_offsets_base = 0;
+ else
+ {
+ bfd *abfd = str_offsets_section->get_bfd_owner ();
+ unsigned int bytes_read = 0;
+ read_initial_length (abfd, str_offsets_section->buffer, &bytes_read,
+ false);
+ const bool is_dwarf64 = bytes_read != 4;
+ str_offsets_base = is_dwarf64 ? 16 : 8;
+ }
}
else
{
diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp
index 705e3dd0c4b..9e5d5c0a0d5 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
}
base-commit: 6d61b107f71d644ab35e8d7fe1c156d4f00c33fc
--
2.43.0