- Patch added (swo#31524, bsc#1222188):

* make-pascal_language-print_type-handle-varstring-nul.patch
- Renable gcc-fortran for SLE-11.
- Use system compiler (gcc 4.3.4) for testing all languages on
  SLE-11.
- Maintenance script qa.sh:
  * Ignore all fails for SLE-11.
- Maintenance script import-fedora.sh:
  * Use %patch -P N instead of deprecated %patchN.
  * Drop patch skips:
    * gdb-6.5-readline-long-line-crash-test.patch
    * gdb-6.7-charsign-test.patch
    * gdb-test-ivy-bridge.patch
    * gdb-ppc-power7-test.patch
    * gdb-6.3-bz140532-ppc-unwinding-test.patch
- Patches added (import from fedora rawhide @ a27201b):
  * gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
  * gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
  * gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
  * gdb-rhbz-2232086-generate-gdb-index-consistently.patch
  * gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
  * gdb-rhbz2232086-refactor-selftest-support.patch
- Patches updated (import from fedora rawhide @ a27201b):
  * gdb-6.6-buildid-locate-rpm.patch
  * gdb-6.6-buildid-locate.patch
  * gdb-fedora-libncursesw.patch
  * gdb-rhbz2233961-CVE-2022-4806.patch
  * gdb-rhbz2233965-memory-leak.patch
- Patches updated:  
  * gdb-6.6-buildid-locate-rpm-suse.patch
- Patches deleted (import from fedora rawhide @ a27201b):
  * gdb-rhbz1553104-s390x-arch12-test.patch
  * gdb-lineno-makeup-test.patch
  * gdb-6.3-bz202689-exec-from-pthread-test.patch
  * gdb-6.5-bz109921-DW_AT_decl_file-test.patch
  * gdb-6.5-ia64-libunwind-leak-test.patch
  * gdb-6.5-last-address-space-byte-test.patch
  * gdb-6.5-missed-trap-on-step-test.patch
  * gdb-6.5-sharedlibrary-path.patch
  * gdb-6.7-testsuite-stable-results.patch
  * gdb-6.8-bz442765-threaded-exec-test.patch
  * gdb-ccache-workaround.patch
  * gdb-opcodes-clflushopt-test.patch
  * gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
  * gdb-rhbz1350436-type-printers-error.patch
  * gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
  * gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
  * gdb-test-pid0-core.patch
- Patches deleted:
  * fixup-gdb-rhbz1553104-s390x-arch12-test.patch
  * fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
  * fixup-gdb-lineno-makeup-test.patch
  * fixup-gdb-6.6-buildid-locate-rpm.patch
- Remove commented out mention of dropped patch
  gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch.

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=383
This commit is contained in:
Tom de Vries 2024-04-24 09:31:51 +00:00 committed by Git OBS Bridge
parent 5a54e3fd0b
commit 4a53ebe1ed
37 changed files with 1113 additions and 2718 deletions

View File

@ -1,29 +0,0 @@
fixup-2-gdb-rhbz1553104-s390x-arch12-test
---
gdb/testsuite/gdb.arch/s390x-arch12.exp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
index 246c1e1c69a..7939a2d6932 100644
--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
@@ -31,4 +31,18 @@ gdb_exit
gdb_start
gdb_load $ofile
+set supported 0
+gdb_test_multiple "show arch" "" {
+ -re -wrap "\"s390:64-bit\".*" {
+ set supported 1
+ }
+ -re -wrap "" {
+ }
+}
+
+if { ! $supported } {
+ unsupported "No s390x support"
+ return -1
+}
+
gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*"

View File

@ -1,39 +0,0 @@
From 95ef5612ccbf31696e05e8699196eb7dd1c78918 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Sat, 9 Mar 2024 11:48:38 +0100
Subject: [PATCH] fixup
---
gdb/configure | 1 +
gdb/configure.ac | 1 +
2 files changed, 2 insertions(+)
diff --git a/gdb/configure b/gdb/configure
index a4e6de5bdbd..304e90ab07b 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -17920,6 +17920,7 @@ else
#include <rpm/rpmlib.h>
#include <dlfcn.h>
#include <errno.h>
+#include <string.h>
int
main ()
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 831ecbb136b..845710f9098 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -206,6 +206,7 @@ if test "x$with_rpm" != "xno"; then
#include <rpm/rpmlib.h>
#include <dlfcn.h>
#include <errno.h>
+#include <string.h>
]], [[
void *h;
const char *const *rpmverp;
base-commit: 6ff01b957d8b1bb00484e9c0f2c695f27e0bb7cd
--
2.35.3

View File

@ -1,26 +0,0 @@
From 266359a17e77a53d4ebaa4f3b15c2ae39e43fca0 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 13 Jun 2023 15:07:22 +0200
Subject: [PATCH 6/6] fixup gdb-lineno-makeup-test.patch
---
gdb/testsuite/gdb.base/lineno-makeup.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
index 9e11d78bf9c..d31e063bdc2 100644
--- a/gdb/testsuite/gdb.base/lineno-makeup.exp
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
@@ -21,7 +21,8 @@ set binfuncfile [standard_output_file ${testfile}-func.bin]
set binfile [standard_output_file ${testfile}]
if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ unsupported "Testcase compile failed, so all tests in this file will automatically fail."
+ return
}
set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
--
2.35.3

View File

@ -1,19 +0,0 @@
fixup-gdb-rhbz1553104-s390x-arch12-test.patch
---
gdb/testsuite/gdb.arch/s390x-arch12.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
index 4e902ff960d..246c1e1c69a 100644
--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
@@ -20,7 +20,7 @@
set testfile "s390x-arch12"
set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
-set ofile "${srcdir}/${subdir}/${testfile}.o"
+set ofile [standard_output_file ${testfile}.o]
if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
untested "failed uudecode"

View File

@ -1,109 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-bz202689-exec-from-pthread-test.patch
;; Testcase for exec() from threaded program (BZ 202689).
;;=fedoratest
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files.
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
@@ -0,0 +1,46 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <stddef.h>
+#include <pthread.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static void *
+threader (void *arg)
+{
+ return NULL;
+}
+
+int
+main (void)
+{
+ pthread_t t1;
+ int i;
+
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
+ assert (i == 0);
+ i = pthread_join (t1, NULL);
+ assert (i == 0);
+
+ execl ("/bin/true", "/bin/true", NULL);
+ abort ();
+}
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
@@ -0,0 +1,41 @@
+# threaded-exec.exp -- Check reset of the tracked threads on exec*(2)
+# Copyright (C) 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+set testfile threaded-exec
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_load ${binfile}
+
+gdb_run_cmd
+
+gdb_test_multiple {} "Program exited" {
+ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
+ pass "Program exited"
+ }
+}

View File

@ -1,134 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
;; Find symbols properly at their original (included) file (BZ 109921).
;;=fedoratest
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
It is duplicite to its upstream variant:
http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html
http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdb.base/included.c, gdb.base/included.exp,
gdb.base/included.h: New files.
------------------------------------------------------------------------------
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
gdb.dwarf2/dw2-included.h: New files.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.c
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include "dw2-included.h"
+
+int
+main()
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.exp b/gdb/testsuite/gdb.dwarf2/dw2-included.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.exp
@@ -0,0 +1,47 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Minimal DWARF-2 unit test
+
+# This test can only be run on targets which support DWARF-2.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-included"
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set listsize 1" ""
+gdb_test "list integer" "int integer;\r"
+gdb_test "ptype integer" "type = int\r"
+# Path varies depending on the build location.
+gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\n${decimal}:.*int integer;\r"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.h b/gdb/testsuite/gdb.dwarf2/dw2-included.h
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-included.h
@@ -0,0 +1,20 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+int integer;

View File

@ -1,135 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-ia64-libunwind-leak-test.patch
;; Test ia64 memory leaks of the code using libunwind.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unwind-leak.c
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <unistd.h>
+
+int main()
+{
+ for (;;)
+ alarm (0);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unwind-leak.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unwind-leak.exp
@@ -0,0 +1,88 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+set testfile unwind-leak
+set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh]
+set binfile [standard_output_file ${testfile}]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid [exp_pid -i [board_info host fileid]]
+
+# For C programs, "start" should stop in main().
+
+gdb_test "start" \
+ "main \\(\\) at .*$srcfile.*" \
+ "start"
+
+set loc [gdb_get_line_number "alarm"]
+gdb_breakpoint $loc
+
+proc memory_get {} {
+ global pid
+ set fd [open "/proc/$pid/statm"]
+ gets $fd line
+ close $fd
+ # number of pages of data/stack
+ scan $line "%*d%*d%*d%*d%*d%d" drs
+ return $drs
+}
+
+set cycles 100
+# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB
+set permit_kb 100
+verbose -log "cycles = $cycles, permit_kb = $permit_kb"
+
+set fail 0
+set test "breakpoint stop/continue cycles"
+for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} {
+ gdb_test_multiple "continue" $test {
+ -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" {
+ }
+ -re "Segmentation fault" {
+ fail $test
+ set i 0
+ set fail 1
+ }
+ }
+ if ![info exists from] {
+ set from [memory_get]
+ }
+}
+set to [memory_get]
+if {!$fail} {
+ verbose -log "from = $from KB, to = $to KB"
+ if {$from > 0 && $to > 10 && $to < $from + $permit_kb} {
+ pass $test
+ } else {
+ fail $test
+ }
+}

View File

@ -1,62 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-last-address-space-byte-test.patch
;; Testcase for deadlocking on last address space byte; for corrupted backtraces.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp
@@ -0,0 +1,49 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+
+# i386 (32-bit) only: gdb with Red Hat largecore patch did lock up:
+# https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=103263
+# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=210614
+
+# i386: Bug exists when the `target_xfer_memory' condition
+# `(memaddr + len < region->hi)' operates on 64-bit operands on
+# largecore-patched with 32-bit addresses and so it can get `false' with
+# arbitrary `len'.
+
+# x86_64: The bug is not present as the operands and calculations have the same
+# bit size. Would would still need to pass there the highest address
+# (`memaddr == 0xffffffffffffffff') but we would need to pass `len == 0'
+# to make the condition `(memaddr + len < region->hi)' false.
+# `len == 0' would get caught eariler.
+
+# Error in the success case is immediate.
+set timeoutold ${timeout}
+set timeout 10
+
+gdb_test "x/xb 0xffffffff" \
+ "Cannot access memory at address 0xffffffff" \
+ "Read the last address space byte"
+
+set timeout ${timeoutold}

View File

@ -1,95 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-missed-trap-on-step-test.patch
;; Test hiding unexpected breakpoints on intentional step commands.
;;=fedoratest
Fix has been committed to:
gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.c
@@ -0,0 +1,30 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+static int var;
+
+int main()
+{
+ var = 1;
+ var = 2;
+ var = 3;
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.exp b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-during-step.exp
@@ -0,0 +1,44 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile watchpoint-during-step
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+runto_main
+
+gdb_breakpoint [gdb_get_line_number "var = 2"]
+gdb_continue_to_breakpoint "Find the first var set"
+
+gdb_test "step" ".*var = 3;" "Step to the next var set"
+
+gdb_test "watch var" "atchpoint .*: var" "Set the watchpoint"
+
+# Here is the target point. Be careful to not have breakpoint set on the line
+# we step from as in this case it is a valid upstream KFAIL gdb/38
+
+gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint"

View File

@ -1,193 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.5-sharedlibrary-path.patch
;; Fix TLS symbols resolving for shared libraries with a relative pathname.
;; The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
;;=fedoratest: One should recheck if it is really fixed upstream.
If you provided some relative path to the shared library, such as with
export LD_LIBRARY_PATH=.
then gdb would fail to match the shared library name during the TLS lookup.
Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed?
The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'.
The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
requested pathnames to the internal loaded relative pathnames.
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to gdb-6.7.50.20080227.
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <pthread.h>
+
+extern __thread int var;
+
+int main()
+{
+ /* Ensure we link against pthreads even with --as-needed. */
+ pthread_testcancel();
+ return var;
+}
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2006 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+__thread int var = 42;
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp
@@ -0,0 +1,94 @@
+# Copyright 2006 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# This test uses gdb_exit and gdb_start, which are not supported
+# on non-extended-remote sessions.
+if {[use_gdb_stub]} {
+ untested "skipping test because of stub"
+ return 0
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile tls-sepdebug
+set srcmainfile ${testfile}-main.c
+set srcsharedfile ${testfile}-shared.c
+
+set binmainfile [standard_output_file ${testfile}-main]
+set binsharedbase ${testfile}-shared.so
+set binsharedfile [standard_output_file ${binsharedbase}]
+set binshareddebugfile [standard_output_file ${binsharedbase}.debug]
+
+# Use explicit -soname as otherwise the full path to the library would get
+# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless.
+
+# FIXME: gcc dependency (-Wl,-soname).
+
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
+ untested "Couldn't compile test library"
+ return -1
+}
+
+# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'.
+if 0 then {
+ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}"
+} else {
+ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}"
+ remote_exec build "objcopy --strip-debug ${binsharedfile}"
+ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}"
+}
+
+# Do not use `shlib=' as it will automatically add also -rpath for gcc.
+
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+# Test also the proper resolving of relative library names to absolute ones.
+# \$PWD is easy - it is the absolute way
+# ${subdir} would fail on "print var"
+
+set absdir [file dirname [standard_output_file ${binsharedbase}]]
+foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] name { absolute relative } {
+
+ gdb_exit
+ gdb_start
+ ###gdb_reinitialize_dir $srcdir/$subdir
+
+ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \
+ "" \
+ "set env LD_LIBRARY_PATH is $name"
+
+ gdb_load ${binmainfile}
+
+ # For C programs, "start" should stop in main().
+
+ gdb_test "start" \
+ "main \\(\\) at .*${srcmainfile}.*" \
+ "start"
+
+ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list
+ # as happens with TLS variables and `separate_debug_objfile_backlink'.
+
+ gdb_test "print var" \
+ "\\\$1 = \[0-9\].*" \
+ "print TLS variable from a shared library with $name-directory separate debug info file"
+}

View File

@ -1,14 +1,5 @@
From 444f438fe775a9480b93dc7d63418e0e169b4fbd Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 21 Apr 2023 09:08:03 +0200
Subject: [PATCH 1/5] gdb-6.6-buildid-locate-rpm-suse.patch
---
gdb/build-id.c | 71 +++++++++-----------------------------------------
1 file changed, 13 insertions(+), 58 deletions(-)
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 86dfc8409b5..29aa10d8225 100644
index 059a72fc050..58d73e70bad 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -863,10 +863,8 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
@ -109,28 +100,24 @@ index 86dfc8409b5..29aa10d8225 100644
for (const char *el : array)
{
gdb_printf (" %s", el);
@@ -1295,13 +1251,12 @@ debug_print_missing (const char *binary, const char *debug)
gdb_printf (gdb_stdlog,
_("Missing separate debuginfo for %s\n"), binary);
if (debug != NULL)
- gdb_printf (gdb_stdlog, _("Try: %s %s\n"),
@@ -1296,14 +1252,15 @@ debug_print_missing (const char *binary, const char *debug)
_("Missing separate debuginfo for %s.\n"), binary);
if (debug != NULL)
{
+#ifdef HAVE_LIBRPM
if (access (debug, F_OK) == 0) {
- gdb_printf (gdb_stdlog, _("Try: %s %s\n"),
-#ifdef DNF_DEBUGINFO_INSTALL
- "dnf"
-#else
- "yum"
-#endif
- " --enablerepo='*debug*' install", debug);
+ {
- "dnf"
#else
- "yum"
+ if (1) {
#endif
- " --enablerepo='*debug*' install", debug);
+ const char *p = strrchr (debug, '/');
+ gdb_printf (gdb_stdlog, _("Try: %s%.2s%.38s\"\n"),
+ "zypper install -C \"debuginfo(build-id)=",
+ p - 2, p + 1);
+ }
}
}
base-commit: 91ac179279557e27e6a149cbb78e4052a348f109
--
2.35.3
} else
gdb_printf (gdb_stdlog, _("The debuginfo package for this file is probably broken.\n"));
}

View File

@ -339,7 +339,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
@@ -17848,6 +17860,494 @@ _ACEOF
@@ -17848,6 +17860,495 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
@ -403,6 +403,7 @@ diff --git a/gdb/configure b/gdb/configure
+#include <rpm/rpmlib.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <string.h>
+
+int
+main ()
@ -837,7 +838,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -160,6 +160,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
@@ -160,6 +160,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
@ -887,6 +888,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
+#include <rpm/rpmlib.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <string.h>
+ ]], [[
+ void *h;
+ const char *const *rpmverp;

View File

@ -561,7 +561,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
- if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+ struct stat statbuf_trash;
+
- return {};
+ /* `access' automatically dereferences LINK. */
+ if (lstat (link.c_str (), &statbuf_trash) != 0)
+ {
@ -596,8 +597,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ {
+ if (separate_debug_file_debug)
+ gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
- return {};
+
+ continue;
+ }
+
@ -628,13 +628,13 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* If none of the real files is found report as missing file
+ always the non-.%u-suffixed file. */
+ std::string link0 = orig_link;
- return {};
+
+ /* If the symlink has target request to install the target.
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
+ std::string link0_resolved (link_resolve (link0.c_str (), 0));
+
- return {};
+ if (link_all.empty ())
+ link_all = link0_resolved;
+ else
@ -703,7 +703,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL)
return debug_bfd;
}
@@ -183,30 +687,655 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@@ -183,30 +687,660 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {};
}
@ -1313,15 +1313,20 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ already requires its own separate lines. */
+
+ gdb_printf (gdb_stdlog,
+ _("Missing separate debuginfo for %s\n"), binary);
+ if (debug != NULL)
+ gdb_printf (gdb_stdlog, _("Try: %s %s\n"),
+ _("Missing separate debuginfo for %s.\n"), binary);
+ if (debug != NULL)
+ {
+ if (access (debug, F_OK) == 0) {
+ gdb_printf (gdb_stdlog, _("Try: %s %s\n"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf"
+ "dnf"
+#else
+ "yum"
+ "yum"
+#endif
+ " --enablerepo='*debug*' install", debug);
+ " --enablerepo='*debug*' install", debug);
+ } else
+ gdb_printf (gdb_stdlog, _("The debuginfo package for this file is probably broken.\n"));
+ }
+ }
+}
+
@ -1365,7 +1370,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (build_id != NULL)
{
if (separate_debug_file_debug)
@@ -214,8 +1343,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -214,8 +1348,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
_("\nLooking for separate debug info (build-id) for "
"%s\n"), objfile_name (objfile));
@ -1388,7 +1393,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* Prevent looping on a stripped .debug file. */
if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()),
@@ -228,3 +1370,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -228,3 +1375,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string ();
}

View File

@ -1,104 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.7-testsuite-stable-results.patch
;; Testsuite fixes for more stable/comparable results.
;;=fedoratest
gdb/testsuite/gdb.base/fileio.c:
gdb/testsuite/gdb.base/fileio.exp:
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
ROOTSUBDIR if we are being run as root.
* gdb.base/fileio.exp: Change the startup and finish cleanup.
Change the test file reference to be into the `fileio.dir' directory.
sources/gdb/testsuite/gdb.base/dump.exp:
Found on RHEL-5.s390x.
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
frames-invalid can happen asynchronously.
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -559,6 +559,28 @@ strerrno (int err)
int
main ()
{
+ /* These tests
+ Open for write but no write permission returns EACCES
+ Unlinking a file in a directory w/o write access returns EACCES
+ fail if we are being run as root - drop the privileges here. */
+
+ if (geteuid () == 0)
+ {
+ uid_t uid = 99;
+
+ if (chown (OUTDIR, uid, uid) != 0)
+ {
+ printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid,
+ OUTDIR, strerror (errno));
+ exit (1);
+ }
+ if (setuid (uid) || geteuid () == 0)
+ {
+ printf ("setuid %d: %s\n", (int) uid, strerror (errno));
+ exit (1);
+ }
+ }
+
/* Don't change the order of the calls. They partly depend on each other */
test_open ();
test_write ();
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -24,9 +24,9 @@ if [target_info exists gdb,nofileio] {
standard_testfile
if {[is_remote host]} {
- set outdir .
+ set outdir "fileio.dir"
} else {
- set outdir [standard_output_file {}]
+ set outdir [standard_output_file "fileio.dir"]
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
@@ -40,7 +40,8 @@ set dir2 [standard_output_file dir2.fileio.test]
if {[file exists $dir2] && ![file writable $dir2]} {
system "chmod +w $dir2"
}
-system "rm -rf [standard_output_file *.fileio.test]"
+system "rm -rf [standard_output_file fileio.dir]"
+system "mkdir -m777 [standard_output_file fileio.dir]"
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
@@ -81,7 +82,7 @@ gdb_test continue \
gdb_test "continue" ".*" ""
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
+catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\""
gdb_test continue \
"Continuing\\..*open 5:.*EACCES$stop_msg" \
@@ -268,9 +269,7 @@ gdb_test continue \
gdb_exit
# Make dir2 writable again so rm -rf of a build tree Just Works.
-if {[file exists $dir2] && ![file writable $dir2]} {
- system "chmod +w $dir2"
-}
+system "chmod -R +w $outdir"
set timeout $oldtimeout
return 0

View File

@ -1,181 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.8-bz442765-threaded-exec-test.patch
;; Test various forms of threads tracking across exec() (BZ 442765).
;;=fedoratest
Test various forms of threads tracking across exec(2).
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
--- a/gdb/testsuite/gdb.threads/threaded-exec.c
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
@@ -18,21 +18,95 @@
Boston, MA 02111-1307, USA. */
#include <stddef.h>
-#include <pthread.h>
#include <assert.h>
#include <stdlib.h>
#include <unistd.h>
+#include <stdio.h>
+#ifdef THREADS
+
+# include <pthread.h>
static void *
threader (void *arg)
{
- return NULL;
+ return NULL;
}
+#endif
+
int
-main (void)
+main (int argc, char **argv)
{
+ char *exec_nothreads, *exec_threads, *cmd;
+ int phase;
+ char phase_s[8];
+
+ setbuf (stdout, NULL);
+
+ if (argc != 4)
+ {
+ fprintf (stderr, "%s <non-threaded> <threaded> <phase>\n", argv[0]);
+ return 1;
+ }
+
+#ifdef THREADS
+ puts ("THREADS: Y");
+#else
+ puts ("THREADS: N");
+#endif
+ exec_nothreads = argv[1];
+ printf ("exec_nothreads: %s\n", exec_nothreads);
+ exec_threads = argv[2];
+ printf ("exec_threads: %s\n", exec_threads);
+ phase = atoi (argv[3]);
+ printf ("phase: %d\n", phase);
+
+ /* Phases: threading
+ 0: N -> N
+ 1: N -> Y
+ 2: Y -> Y
+ 3: Y -> N
+ 4: N -> exit */
+
+ cmd = NULL;
+
+#ifndef THREADS
+ switch (phase)
+ {
+ case 0:
+ cmd = exec_nothreads;
+ break;
+ case 1:
+ cmd = exec_threads;
+ break;
+ case 2:
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
+ phase);
+ return 1;
+ case 3:
+ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
+ phase);
+ return 1;
+ case 4:
+ return 0;
+ default:
+ assert (0);
+ }
+#else /* THREADS */
+ switch (phase)
+ {
+ case 0:
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
+ argv[0], phase);
+ return 1;
+ case 1:
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
+ argv[0], phase);
+ return 1;
+ case 2:
+ cmd = exec_threads;
+ {
pthread_t t1;
int i;
@@ -40,7 +114,34 @@ main (void)
assert (i == 0);
i = pthread_join (t1, NULL);
assert (i == 0);
+ }
+ break;
+ case 3:
+ cmd = exec_nothreads;
+ {
+ pthread_t t1;
+ int i;
+
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
+ assert (i == 0);
+ i = pthread_join (t1, NULL);
+ assert (i == 0);
+ }
+ break;
+ case 4:
+ fprintf (stderr, "%s: We should not have threads for phase %d!\n",
+ argv[0], phase);
+ return 1;
+ default:
+ assert (0);
+ }
+#endif /* THREADS */
+
+ assert (cmd != NULL);
+
+ phase++;
+ snprintf (phase_s, sizeof phase_s, "%d", phase);
- execl ("/bin/true", "/bin/true", NULL);
- abort ();
+ execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL);
+ assert (0);
}
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
--- a/gdb/testsuite/gdb.threads/threaded-exec.exp
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
@@ -20,9 +20,14 @@
set testfile threaded-exec
set srcfile ${testfile}.c
-set binfile [standard_output_file ${testfile}]
+set binfile_nothreads [standard_output_file ${testfile}N]
+set binfile_threads [standard_output_file ${testfile}Y]
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } {
+ return -1
+}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } {
return -1
}
@@ -30,9 +35,9 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+gdb_load ${binfile_nothreads}
-gdb_run_cmd
+gdb_run_cmd [list ${binfile_nothreads} ${binfile_threads} 0]
gdb_test_multiple {} "Program exited" {
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {

View File

@ -1,7 +1,7 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Tue, 20 Jun 2023 09:46:35 +0100
Subject: gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
Subject: gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
;; Backport upstream commit f3eee5861743d635 to fix a crash triggered
;; when debuginfod makes use of particular openssl settings.

View File

@ -1,26 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-ccache-workaround.patch
;; Workaround ccache making lineno non-zero for command-line definitions.
;;=fedoratest: ccache is rarely used and it is even fixed now.
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -20,6 +20,14 @@ set objfile [standard_output_file ${testfile}.o]
set options {debug macros additional_flags=-DFROM_COMMANDLINE=ARG}
+# Workaround ccache making lineno non-zero for command-line definitions.
+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} {
+ set result [catch "exec which gcc" output]
+ if {$result == 0 && [string first "/ccache/" $output] > -1} {
+ lappend options "compiler=/usr/bin/gcc"
+ }
+}
+
# Generate the intermediate object file. This is required by Darwin to
# have access to the .debug_macinfo section.
if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -20915,6 +20915,7 @@ if test x"$prefer_curses" = xyes; then
@@ -20916,6 +20916,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
$as_echo_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then :
@@ -20939,7 +20940,7 @@ return waddstr ();
@@ -20940,7 +20941,7 @@ return waddstr ();
return 0;
}
_ACEOF
@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -21013,6 +21014,7 @@ case $host_os in
@@ -21014,6 +21015,7 @@ case $host_os in
esac
# These are the libraries checked by Readline.
@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then :
@@ -21037,7 +21039,7 @@ return tgetent ();
@@ -21038,7 +21040,7 @@ return tgetent ();
return 0;
}
_ACEOF
@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -704,7 +704,8 @@ if test x"$prefer_curses" = xyes; then
@@ -705,7 +705,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -746,7 +747,8 @@ case $host_os in
@@ -747,7 +748,8 @@ case $host_os in
esac
# These are the libraries checked by Readline.

View File

@ -1,165 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-lineno-makeup-test.patch
;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
;;=fedoratest
New testcase for:
https://bugzilla.redhat.com/show_bug.cgi?id=466222
(for the first / customer recommended fix)
and the upstream fix:
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
[rfc] Do not make up line information
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
@@ -0,0 +1,21 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+void
+func (void)
+{
+}
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineno-makeup.c
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
+ information (.debug_line) so we cannot use an external object file.
+
+ It must not be just a label as it would alias on the next function even for
+ correct GDB. Therefore some stub data must be placed there.
+
+ We need to provide a real stub function body as at least s390
+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */
+
+extern void func (void);
+asm ("func: .incbin \"" BINFILENAME "\"");
+
+int
+main (void)
+{
+ func ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
@@ -0,0 +1,78 @@
+# Copyright 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile "lineno-makeup"
+set srcfuncfile ${testfile}-func.c
+set srcfile ${testfile}.c
+set objfuncfile [standard_output_file ${testfile}-func.o]
+set binfuncfile [standard_output_file ${testfile}-func.bin]
+set binfile [standard_output_file ${testfile}]
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
+verbose -log "objcopy=$objcopy: $output"
+if { $objcopy != 0 } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+set binfuncfilesize [file size $binfuncfile]
+verbose -log "file size $binfuncfile = $binfuncfilesize"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=-DBINFILENAME=\"$binfuncfile\"]] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set b_addr ""
+set test "break func"
+gdb_test_multiple $test $test {
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
+ set b_addr $expect_out(1,string)
+ pass $test
+ }
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
+ set b_addr $expect_out(1,string)
+ fail $test
+ }
+}
+verbose -log "b_addr=<$b_addr>"
+
+set p_addr ""
+set test "print func"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
+ set p_addr $expect_out(1,string)
+ pass $test
+ }
+}
+verbose -log "p_addr=<$p_addr>"
+
+set test "break address belongs to func"
+if {$b_addr == $p_addr} {
+ pass "$test (exact match)"
+} else {
+ set skip [expr $b_addr - $p_addr]
+ if {$skip > 0 && $skip < $binfuncfilesize} {
+ pass "$test (prologue skip by $skip bytes)"
+ } else {
+ fail $test
+ }
+}

View File

@ -1,62 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-opcodes-clflushopt-test.patch
;; Test clflushopt instruction decode (for RH BZ 1262471).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.S
@@ -0,0 +1,19 @@
+/* Copyright 2016 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ This file is part of the gdb testsuite. */
+
+_start: .globl _start
+ clflushopt (%edi)
diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.exp b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp
@@ -0,0 +1,25 @@
+# Copyright 2016 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { ![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"] } then {
+ verbose "Skipping amd64 clflushopt test."
+ return
+}
+
+if [prepare_for_testing amd64-clflushopt.exp amd64-clflushopt amd64-clflushopt.S [list debug "additional_flags=-nostdlib"]] {
+ return -1
+}
+
+gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt"

View File

@ -0,0 +1,264 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Sat, 25 Nov 2023 10:35:37 +0000
Subject: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
;; Back-port upstream commit acc117b57f7 as part of a fix for
;; non-deterministic gdb-index generation (RH BZ 2232086).
gdb: C++-ify mapped_symtab from dwarf2/index-write.c
Make static the functions add_index_entry, find_slot, and hash_expand,
member functions of the mapped_symtab class.
Fold an additional snippet of code from write_gdbindex into
mapped_symtab::minimize, this code relates to minimisation, so this
seems like a good home for it.
Make the n_elements, data, and m_string_obstack member variables of
mapped_symtab private. Provide a new obstack() member function to
provide access to the obstack when needed, and also add member
functions begin(), end(), cbegin(), and cend() so that the
mapped_symtab class can be treated like a contained and iterated
over.
I've also taken this opportunity to split out the logic for whether
the hash table (m_data) needs expanding, this is the new function
hash_needs_expanding. This will be useful in a later commit.
There should be no user visible changes after this commit.
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -187,86 +187,135 @@ struct mapped_symtab
{
mapped_symtab ()
{
- data.resize (1024);
+ m_data.resize (1024);
}
- /* Minimize each entry in the symbol table, removing duplicates. */
+ /* If there are no elements in the symbol table, then reduce the table
+ size to zero. Otherwise call symtab_index_entry::minimize each entry
+ in the symbol table. */
+
void minimize ()
{
- for (symtab_index_entry &item : data)
+ if (m_element_count == 0)
+ m_data.resize (0);
+
+ for (symtab_index_entry &item : m_data)
item.minimize ();
}
- offset_type n_elements = 0;
- std::vector<symtab_index_entry> data;
+ /* Add an entry to SYMTAB. NAME is the name of the symbol. CU_INDEX is
+ the index of the CU in which the symbol appears. IS_STATIC is one if
+ the symbol is static, otherwise zero (global). */
+
+ void add_index_entry (const char *name, int is_static,
+ gdb_index_symbol_kind kind, offset_type cu_index);
+
+ /* Access the obstack. */
+ struct obstack *obstack ()
+ { return &m_string_obstack; }
+
+private:
+
+ /* Find a slot in SYMTAB for the symbol NAME. Returns a reference to
+ the slot.
+
+ Function is used only during write_hash_table so no index format
+ backward compatibility is needed. */
+
+ symtab_index_entry &find_slot (const char *name);
+
+ /* Expand SYMTAB's hash table. */
+
+ void hash_expand ();
+
+ /* Return true if the hash table in data needs to grow. */
+
+ bool hash_needs_expanding () const
+ { return 4 * m_element_count / 3 >= m_data.size (); }
+
+ /* A vector that is used as a hash table. */
+ std::vector<symtab_index_entry> m_data;
+
+ /* The number of elements stored in the m_data hash. */
+ offset_type m_element_count = 0;
/* Temporary storage for names. */
auto_obstack m_string_obstack;
-};
-/* Find a slot in SYMTAB for the symbol NAME. Returns a reference to
- the slot.
+public:
+ using iterator = decltype (m_data)::iterator;
+ using const_iterator = decltype (m_data)::const_iterator;
- Function is used only during write_hash_table so no index format backward
- compatibility is needed. */
+ iterator begin ()
+ { return m_data.begin (); }
-static symtab_index_entry &
-find_slot (struct mapped_symtab *symtab, const char *name)
+ iterator end ()
+ { return m_data.end (); }
+
+ const_iterator cbegin ()
+ { return m_data.cbegin (); }
+
+ const_iterator cend ()
+ { return m_data.cend (); }
+};
+
+/* See class definition. */
+
+symtab_index_entry &
+mapped_symtab::find_slot (const char *name)
{
offset_type index, step, hash = mapped_index_string_hash (INT_MAX, name);
- index = hash & (symtab->data.size () - 1);
- step = ((hash * 17) & (symtab->data.size () - 1)) | 1;
+ index = hash & (m_data.size () - 1);
+ step = ((hash * 17) & (m_data.size () - 1)) | 1;
for (;;)
{
- if (symtab->data[index].name == NULL
- || strcmp (name, symtab->data[index].name) == 0)
- return symtab->data[index];
- index = (index + step) & (symtab->data.size () - 1);
+ if (m_data[index].name == NULL
+ || strcmp (name, m_data[index].name) == 0)
+ return m_data[index];
+ index = (index + step) & (m_data.size () - 1);
}
}
-/* Expand SYMTAB's hash table. */
+/* See class definition. */
-static void
-hash_expand (struct mapped_symtab *symtab)
+void
+mapped_symtab::hash_expand ()
{
- auto old_entries = std::move (symtab->data);
+ auto old_entries = std::move (m_data);
- symtab->data.clear ();
- symtab->data.resize (old_entries.size () * 2);
+ gdb_assert (m_data.size () == 0);
+ m_data.resize (old_entries.size () * 2);
for (auto &it : old_entries)
if (it.name != NULL)
{
- auto &ref = find_slot (symtab, it.name);
+ auto &ref = this->find_slot (it.name);
ref = std::move (it);
}
}
-/* Add an entry to SYMTAB. NAME is the name of the symbol.
- CU_INDEX is the index of the CU in which the symbol appears.
- IS_STATIC is one if the symbol is static, otherwise zero (global). */
+/* See class definition. */
-static void
-add_index_entry (struct mapped_symtab *symtab, const char *name,
- int is_static, gdb_index_symbol_kind kind,
- offset_type cu_index)
+void
+mapped_symtab::add_index_entry (const char *name, int is_static,
+ gdb_index_symbol_kind kind,
+ offset_type cu_index)
{
- symtab_index_entry *slot = &find_slot (symtab, name);
+ symtab_index_entry *slot = &this->find_slot (name);
if (slot->name == NULL)
{
/* This is a new element in the hash table. */
- ++symtab->n_elements;
+ ++this->m_element_count;
/* We might need to grow the hash table. */
- if (4 * symtab->n_elements / 3 >= symtab->data.size ())
+ if (this->hash_needs_expanding ())
{
- hash_expand (symtab);
+ this->hash_expand ();
/* This element will have a different slot in the new table. */
- slot = &find_slot (symtab, name);
+ slot = &this->find_slot (name);
/* But it should still be a new element in the hash table. */
gdb_assert (slot->name == nullptr);
@@ -388,7 +437,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
/* We add all the index vectors to the constant pool first, to
ensure alignment is ok. */
- for (symtab_index_entry &entry : symtab->data)
+ for (symtab_index_entry &entry : *symtab)
{
if (entry.name == NULL)
continue;
@@ -417,7 +466,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
/* Now write out the hash table. */
std::unordered_map<c_str_view, offset_type, c_str_view_hasher> str_table;
- for (const auto &entry : symtab->data)
+ for (const auto &entry : *symtab)
{
offset_type str_off, vec_off;
@@ -1149,7 +1198,7 @@ write_cooked_index (cooked_index_vector *table,
const auto it = cu_index_htab.find (entry->per_cu);
gdb_assert (it != cu_index_htab.cend ());
- const char *name = entry->full_name (&symtab->m_string_obstack);
+ const char *name = entry->full_name (symtab->obstack ());
if (entry->per_cu->lang () == language_ada)
{
@@ -1169,7 +1218,7 @@ write_cooked_index (cooked_index_vector *table,
gdb, it has to use the encoded name, with any
suffixes stripped. */
std::string encoded = ada_encode (name, false);
- name = obstack_strdup (&symtab->m_string_obstack,
+ name = obstack_strdup (symtab->obstack (),
encoded.c_str ());
}
}
@@ -1202,8 +1251,8 @@ write_cooked_index (cooked_index_vector *table,
else
kind = GDB_INDEX_SYMBOL_KIND_TYPE;
- add_index_entry (symtab, name, (entry->flags & IS_STATIC) != 0,
- kind, it->second);
+ symtab->add_index_entry (name, (entry->flags & IS_STATIC) != 0,
+ kind, it->second);
}
}
@@ -1281,8 +1330,6 @@ write_gdbindex (dwarf2_per_objfile *per_objfile,
symtab.minimize ();
data_buf symtab_vec, constant_pool;
- if (symtab.n_elements == 0)
- symtab.data.resize (0);
write_hash_table (&symtab, symtab_vec, constant_pool);

View File

@ -0,0 +1,101 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Mon, 27 Nov 2023 13:19:39 +0000
Subject: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
;; Back-port upstream commit 3644f41dc80 as part of a fix for
;; non-deterministic gdb-index generation (RH BZ 2232086).
gdb: generate dwarf-5 index identically as worker-thread count changes
Similar to the previous commit, this commit ensures that the dwarf-5
index files are generated identically as the number of worker-threads
changes.
Building the dwarf-5 index makes use of a closed hash table, the
bucket_hash local within debug_names::build(). Entries are added to
bucket_hash from m_name_to_value_set, which, in turn, is populated
by calls to debug_names::insert() in write_debug_names. The insert
calls are ordered based on the entries within the cooked_index, and
the ordering within cooked_index depends on the number of worker
threads that GDB is using.
My proposal is to sort each chain within the bucket_hash closed hash
table prior to using this to build the dwarf-5 index.
The buckets within bucket_hash will always have the same ordering (for
a given GDB build with a given executable), and by sorting the chains
within each bucket, we can be sure that GDB will see each entry in a
deterministic order.
I've extended the index creation test to cover this case.
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -453,6 +453,11 @@ class c_str_view
return strcmp (m_cstr, other.m_cstr) == 0;
}
+ bool operator< (const c_str_view &other) const
+ {
+ return strcmp (m_cstr, other.m_cstr) < 0;
+ }
+
/* Return the underlying C string. Note, the returned string is
only a reference with lifetime of this object. */
const char *c_str () const
@@ -770,10 +775,18 @@ class debug_names
}
for (size_t bucket_ix = 0; bucket_ix < bucket_hash.size (); ++bucket_ix)
{
- const std::forward_list<hash_it_pair> &hashitlist
- = bucket_hash[bucket_ix];
+ std::forward_list<hash_it_pair> &hashitlist = bucket_hash[bucket_ix];
if (hashitlist.empty ())
continue;
+
+ /* Sort the items within each bucket. This ensures that the
+ generated index files will be the same no matter the order in
+ which symbols were added into the index. */
+ hashitlist.sort ([] (const hash_it_pair &a, const hash_it_pair &b)
+ {
+ return a.it->first < b.it->first;
+ });
+
uint32_t &bucket_slot = m_bucket_table[bucket_ix];
/* The hashes array is indexed starting at 1. */
store_unsigned_integer (reinterpret_cast<gdb_byte *> (&bucket_slot),
diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
--- a/gdb/testsuite/gdb.gdb/index-file.exp
+++ b/gdb/testsuite/gdb.gdb/index-file.exp
@@ -47,6 +47,9 @@ remote_exec host "mkdir -p ${dir1}"
with_timeout_factor $timeout_factor {
gdb_test_no_output "save gdb-index $dir1" \
"create gdb-index file"
+
+ gdb_test_no_output "save gdb-index -dwarf-5 $dir1" \
+ "create dwarf-index files"
}
# Close GDB.
@@ -143,13 +146,16 @@ if { $worker_threads > 1 } {
with_timeout_factor $timeout_factor {
gdb_test_no_output "save gdb-index $dir2" \
"create second gdb-index file"
+
+ gdb_test_no_output "save gdb-index -dwarf-5 $dir2" \
+ "create second dwarf-index files"
}
# Close GDB.
gdb_exit
# Now check that the index files are identical.
- foreach suffix { gdb-index } {
+ foreach suffix { gdb-index debug_names debug_str } {
set result \
[remote_exec host \
"cmp -s \"$dir1/${index_filename_base}.${suffix}\" \"$dir2/${index_filename_base}.${suffix}\""]

View File

@ -0,0 +1,230 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Fri, 24 Nov 2023 12:04:36 +0000
Subject: gdb-rhbz-2232086-generate-gdb-index-consistently.patch
;; Back-port upstream commit aff250145af as part of a fix for
;; non-deterministic gdb-index generation (RH BZ 2232086).
gdb: generate gdb-index identically regardless of work thread count
It was observed that changing the number of worker threads that GDB
uses (maintenance set worker-threads NUM) would have an impact on the
layout of the generated gdb-index.
The cause seems to be how the CU are distributed between threads, and
then symbols that appear in multiple CU can be encountered earlier or
later depending on whether a particular CU moves between threads.
I certainly found this behaviour was reproducible when generating an
index for GDB itself, like:
gdb -q -nx -nh -batch \
-eiex 'maint set worker-threads NUM' \
-ex 'save gdb-index /tmp/'
And then setting different values for NUM will change the generated
index.
Now, the question is: does this matter?
I would like to suggest that yes, this does matter. At Red Hat we
generate a gdb-index as part of the build process, and we would
ideally like to have reproducible builds: for the same source,
compiled with the same tool-chain, we should get the exact same output
binary. And we do .... except for the index.
Now we could simply force GDB to only use a single worker thread when
we build the index, but, I don't think the idea of reproducible builds
is that strange, so I think we should ensure that our generated
indexes are always reproducible.
To achieve this, I propose that we add an extra step when building the
gdb-index file. After constructing the initial symbol hash table
contents, we will pull all the symbols out of the hash, sort them,
then re-insert them in sorted order. This will ensure that the
structure of the generated hash will remain consistent (given the same
set of symbols).
I've extended the existing index-file test to check that the generated
index doesn't change if we adjust the number of worker threads used.
Given that this test is already rather slow, I've only made one change
to the worker-thread count. Maybe this test should be changed to use
a smaller binary, which is quicker to load, and for which we could
then try many different worker thread counts.
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -210,6 +210,13 @@ struct mapped_symtab
void add_index_entry (const char *name, int is_static,
gdb_index_symbol_kind kind, offset_type cu_index);
+ /* When entries are originally added into the data hash the order will
+ vary based on the number of worker threads GDB is configured to use.
+ This function will rebuild the hash such that the final layout will be
+ deterministic regardless of the number of worker threads used. */
+
+ void sort ();
+
/* Access the obstack. */
struct obstack *obstack ()
{ return &m_string_obstack; }
@@ -296,6 +303,65 @@ mapped_symtab::hash_expand ()
}
}
+/* See mapped_symtab class declaration. */
+
+void mapped_symtab::sort ()
+{
+ /* Move contents out of this->data vector. */
+ std::vector<symtab_index_entry> original_data = std::move (m_data);
+
+ /* Restore the size of m_data, this will avoid having to expand the hash
+ table (and rehash all elements) when we reinsert after sorting.
+ However, we do reset the element count, this allows for some sanity
+ checking asserts during the reinsert phase. */
+ gdb_assert (m_data.size () == 0);
+ m_data.resize (original_data.size ());
+ m_element_count = 0;
+
+ /* Remove empty entries from ORIGINAL_DATA, this makes sorting quicker. */
+ auto it = std::remove_if (original_data.begin (), original_data.end (),
+ [] (const symtab_index_entry &entry) -> bool
+ {
+ return entry.name == nullptr;
+ });
+ original_data.erase (it, original_data.end ());
+
+ /* Sort the existing contents. */
+ std::sort (original_data.begin (), original_data.end (),
+ [] (const symtab_index_entry &a,
+ const symtab_index_entry &b) -> bool
+ {
+ /* Return true if A is before B. */
+ gdb_assert (a.name != nullptr);
+ gdb_assert (b.name != nullptr);
+
+ return strcmp (a.name, b.name) < 0;
+ });
+
+ /* Re-insert each item from the sorted list. */
+ for (auto &entry : original_data)
+ {
+ /* We know that ORIGINAL_DATA contains no duplicates, this data was
+ taken from a hash table that de-duplicated entries for us, so
+ count this as a new item.
+
+ As we retained the original size of m_data (see above) then we
+ should never need to grow m_data_ during this re-insertion phase,
+ assert that now. */
+ ++m_element_count;
+ gdb_assert (!this->hash_needs_expanding ());
+
+ /* Lookup a slot. */
+ symtab_index_entry &slot = this->find_slot (entry.name);
+
+ /* As discussed above, we should not find duplicates. */
+ gdb_assert (slot.name == nullptr);
+
+ /* Move this item into the slot we found. */
+ slot = std::move (entry);
+ }
+}
+
/* See class definition. */
void
@@ -1325,6 +1391,9 @@ write_gdbindex (dwarf2_per_objfile *per_objfile,
for (auto map : table->get_addrmaps ())
write_address_map (map, addr_vec, cu_index_htab);
+ /* Ensure symbol hash is built domestically. */
+ symtab.sort ();
+
/* Now that we've processed all symbols we can shrink their cu_indices
lists. */
symtab.minimize ();
diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
--- a/gdb/testsuite/gdb.gdb/index-file.exp
+++ b/gdb/testsuite/gdb.gdb/index-file.exp
@@ -38,6 +38,9 @@ with_timeout_factor $timeout_factor {
clean_restart $filename
}
+# Record how many worker threads GDB is using.
+set worker_threads [gdb_get_worker_threads]
+
# Generate an index file.
set dir1 [standard_output_file "index_1"]
remote_exec host "mkdir -p ${dir1}"
@@ -116,3 +119,41 @@ proc check_symbol_table_usage { filename } {
set index_filename_base [file tail $filename]
check_symbol_table_usage "$dir1/${index_filename_base}.gdb-index"
+
+# If GDB is using more than 1 worker thread then reduce the number of
+# worker threads, regenerate the index, and check that we get the same
+# index file back. At one point the layout of the index would vary
+# based on the number of worker threads used.
+if { $worker_threads > 1 } {
+ # Start GDB, but don't load a file yet.
+ clean_restart
+
+ # Adjust the number of threads to use.
+ set reduced_threads [expr $worker_threads / 2]
+ gdb_test_no_output "maint set worker-threads $reduced_threads"
+
+ with_timeout_factor $timeout_factor {
+ # Now load the test binary.
+ gdb_file_cmd $filename
+ }
+
+ # Generate an index file.
+ set dir2 [standard_output_file "index_2"]
+ remote_exec host "mkdir -p ${dir2}"
+ with_timeout_factor $timeout_factor {
+ gdb_test_no_output "save gdb-index $dir2" \
+ "create second gdb-index file"
+ }
+
+ # Close GDB.
+ gdb_exit
+
+ # Now check that the index files are identical.
+ foreach suffix { gdb-index } {
+ set result \
+ [remote_exec host \
+ "cmp -s \"$dir1/${index_filename_base}.${suffix}\" \"$dir2/${index_filename_base}.${suffix}\""]
+ gdb_assert { [lindex $result 0] == 0 } \
+ "$suffix files are identical"
+ }
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9274,6 +9274,21 @@ proc gdb_step_until { regexp {test_name ""} {max_steps 10} } {
}
}
+# Return the number of worker threads that GDB is currently using.
+
+proc gdb_get_worker_threads { {testname ""} } {
+ set worker_threads "UNKNOWN"
+ gdb_test_multiple "maintenance show worker-threads" $testname {
+ -wrap -re "The number of worker threads GDB can use is unlimited \\(currently ($::decimal)\\)\\." {
+ set worker_threads $expect_out(1,string)
+ }
+ -wrap -re "The number of worker threads GDB can use is ($::decimal)\\." {
+ set worker_threads $expect_out(1,string)
+ }
+ }
+ return $worker_threads
+}
+
# Check if the compiler emits epilogue information associated
# with the closing brace or with the last statement line.
#

View File

@ -0,0 +1,222 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Fri, 24 Nov 2023 11:50:35 +0000
Subject: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
;; Back-port upstream commit aa19bc1d259 as part of a fix for
;; non-deterministic gdb-index generation (RH BZ 2232086).
gdb: reduce size of generated gdb-index file
I noticed in passing that out algorithm for generating the gdb-index
file is incorrect. When building the hash table in add_index_entry we
count every incoming entry rehash when the number of entries gets too
large. However, some of the incoming entries will be duplicates,
which don't actually result in new items being added to the hash
table.
As a result, we grow the gdb-index hash table far too often.
With an unmodified GDB, generating a gdb-index for GDB, I see a file
size of 90M, with a hash usage (in the generated index file) of just
2.6%.
With a patched GDB, generating a gdb-index for the _same_ GDB binary,
I now see a gdb-index file size of 30M, with a hash usage of 41.9%.
This is a 67% reduction in gdb-index file size.
Obviously, not every gdb-index file is going to see such big savings,
however, the larger a program, and the more symbols that are
duplicated between compilation units, the more GDB would over count,
and so, over-grow the index.
The gdb-index hash table we create has a minimum size of 1024, and
then we grow the hash when it is 75% full, doubling the hash table at
that time. Given this, then we expect that either:
a. The hash table is size 1024, and less than 75% full, or
b. The hash table is between 37.5% and 75% full.
I've include a test that checks some of these constraints -- I've not
bothered to check the upper limit, and over full hash table isn't
really a problem here, but if the fill percentage is less than 37.5%
then this indicates that we've done something wrong (obviously, I also
check for the 1024 minimum size).
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -254,20 +254,29 @@ add_index_entry (struct mapped_symtab *symtab, const char *name,
int is_static, gdb_index_symbol_kind kind,
offset_type cu_index)
{
- offset_type cu_index_and_attrs;
+ symtab_index_entry *slot = &find_slot (symtab, name);
+ if (slot->name == NULL)
+ {
+ /* This is a new element in the hash table. */
+ ++symtab->n_elements;
- ++symtab->n_elements;
- if (4 * symtab->n_elements / 3 >= symtab->data.size ())
- hash_expand (symtab);
+ /* We might need to grow the hash table. */
+ if (4 * symtab->n_elements / 3 >= symtab->data.size ())
+ {
+ hash_expand (symtab);
- symtab_index_entry &slot = find_slot (symtab, name);
- if (slot.name == NULL)
- {
- slot.name = name;
+ /* This element will have a different slot in the new table. */
+ slot = &find_slot (symtab, name);
+
+ /* But it should still be a new element in the hash table. */
+ gdb_assert (slot->name == nullptr);
+ }
+
+ slot->name = name;
/* index_offset is set later. */
}
- cu_index_and_attrs = 0;
+ offset_type cu_index_and_attrs = 0;
DW2_GDB_INDEX_CU_SET_VALUE (cu_index_and_attrs, cu_index);
DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE (cu_index_and_attrs, is_static);
DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE (cu_index_and_attrs, kind);
@@ -279,7 +288,7 @@ add_index_entry (struct mapped_symtab *symtab, const char *name,
the last entry pushed), but a symbol could have multiple kinds in one CU.
To keep things simple we don't worry about the duplication here and
sort and uniquify the list after we've processed all symbols. */
- slot.cu_indices.push_back (cu_index_and_attrs);
+ slot->cu_indices.push_back (cu_index_and_attrs);
}
/* See symtab_index_entry. */
diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.gdb/index-file.exp
@@ -0,0 +1,118 @@
+# Copyright 2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Load the GDB executable, and then 'save gdb-index', and make some
+# checks of the generated index file.
+
+load_lib selftest-support.exp
+
+# Can't save an index with readnow.
+if {[readnow]} {
+ untested "cannot create an index when readnow is in use"
+ return -1
+}
+
+# A multiplier used to ensure slow tasks are less likely to timeout.
+set timeout_factor 20
+
+set filename [selftest_prepare]
+if { $filename eq "" } {
+ unsupported "${gdb_test_file_name}.exp"
+ return -1
+}
+
+with_timeout_factor $timeout_factor {
+ # Start GDB, load FILENAME.
+ clean_restart $filename
+}
+
+# Generate an index file.
+set dir1 [standard_output_file "index_1"]
+remote_exec host "mkdir -p ${dir1}"
+with_timeout_factor $timeout_factor {
+ gdb_test_no_output "save gdb-index $dir1" \
+ "create gdb-index file"
+}
+
+# Close GDB.
+gdb_exit
+
+# Validate that the index-file FILENAME has made efficient use of its
+# symbol hash table. Calculate the number of symbols in the hash
+# table and the total hash table size. The hash table starts with
+# 1024 entries, and then doubles each time it is filled to 75%. At
+# 75% filled, doubling the size takes it to 37.5% filled.
+#
+# Thus, the hash table is correctly filled if:
+# 1. Its size is 1024 (i.e. it has not yet had its first doubling), or
+# 2. Its filled percentage is over 37%
+#
+# We could check that it is not over filled, but I don't as that's not
+# really an issue. But we did once have a bug where the table was
+# doubled incorrectly, in which case we'd see a filled percentage of
+# around 2% in some cases, which is a huge waste of disk space.
+proc check_symbol_table_usage { filename } {
+ # Open the file in binary mode and read-only mode.
+ set fp [open $filename rb]
+
+ # Configure the channel to use binary translation.
+ fconfigure $fp -translation binary
+
+ # Read the first 8 bytes of the file, which contain the header of
+ # the index section.
+ set header [read $fp [expr 7 * 4]]
+
+ # Scan the header to get the version, the CU list offset, and the
+ # types CU list offset.
+ binary scan $header iiiiii version \
+ _ _ _ symbol_table_offset shortcut_offset
+
+ # The length of the symbol hash table (in entries).
+ set len [expr ($shortcut_offset - $symbol_table_offset) / 8]
+
+ # Now walk the hash table and count how many entries are in use.
+ set offset $symbol_table_offset
+ set count 0
+ while { $offset < $shortcut_offset } {
+ seek $fp $offset
+ set entry [read $fp 8]
+ binary scan $entry ii name_ptr flags
+ if { $name_ptr != 0 } {
+ incr count
+ }
+
+ incr offset 8
+ }
+
+ # Close the file.
+ close $fp
+
+ # Calculate how full the cache is.
+ set pct [expr (100 * double($count)) / $len]
+
+ # Write our results out to the gdb.log.
+ verbose -log "Hash table size: $len"
+ verbose -log "Hash table entries: $count"
+ verbose -log "Percentage usage: $pct%"
+
+ # The minimum fill percentage is actually 37.5%, but we give TCL a
+ # little flexibility in case the FP maths give a result a little
+ # off.
+ gdb_assert { $len == 1024 || $pct > 37 } \
+ "symbol hash table usage"
+}
+
+set index_filename_base [file tail $filename]
+check_symbol_table_usage "$dir1/${index_filename_base}.gdb-index"

View File

@ -1,135 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
;; description: 'C++ (and objc): Internal error on unqualified name
;; re-set', PR 11657] (RH BZ 1186476).
;;=fedoratest
Comments from Sergio Durigan Junior:
The "proper" fix for this whole problem would be to backport the
"ambiguous linespec" patch series. However, it is really not
recommended to do that for RHEL GDB, because the patch series is too
big and could introduce unwanted regressions. Instead, what we
chose to do was to replace the gdb_assert call by a warning (which
allows the user to continue the debugging session), and tell the
user that, although more than one location was found for his/her
breakpoint, only one will be used.
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main (int argc, char *argv[])
+{
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+class C
+ {
+ public:
+ C () {}
+ C (int x) {}
+ };
+
+C a;
+C b (1);
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
@@ -0,0 +1,51 @@
+# Copyright 2015 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+if { [skip_shlib_tests] } { continue }
+if { [is_remote target] } { continue }
+if { [target_info exists use_gdb_stub] } { continue }
+
+set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main
+set srcfile $testfile.cc
+set executable $testfile
+set binfile [standard_output_file $executable]
+
+set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set
+set libsrcfile $libtestfile.cc
+set sofile [standard_output_file lib$libtestfile.so]
+
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info "c++"] {
+ return -1
+}
+
+if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != ""
+ || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} {
+ untested $libtestfile.exp
+ return -1
+}
+
+clean_restart $executable
+
+gdb_test_no_output "set breakpoint pending on"
+# gdb_breakpoint would print a failure because of some warning messages
+gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending."
+
+#gdb_test "run" "warning: Found more than one location for breakpoint #$decimal; only the first location will be used.(\r\n)+Breakpoint $decimal, C::C.*"
+gdb_test "run"
+
+gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"

View File

@ -1,83 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhbz1350436-type-printers-error.patch
;; Test 'info type-printers' Python error (RH BZ 1350436).
;;=fedoratest
Typo in Python support breaks info type-printers command
https://bugzilla.redhat.com/show_bug.cgi?id=1350436
[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers
https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html
diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
--- a/gdb/testsuite/gdb.python/py-typeprint.cc
+++ b/gdb/testsuite/gdb.python/py-typeprint.cc
@@ -31,6 +31,12 @@ templ<basic_string> s;
basic_string bs;
+class Other
+{
+};
+
+Other ovar;
+
int main()
{
return 0;
diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
--- a/gdb/testsuite/gdb.python/py-typeprint.exp
+++ b/gdb/testsuite/gdb.python/py-typeprint.exp
@@ -50,3 +50,7 @@ gdb_test_no_output "enable type-printer string"
gdb_test "whatis bs" "string" "whatis with enabled printer"
gdb_test "whatis s" "templ<string>"
+
+gdb_test "info type-printers" "Type printers for \[^\r\n\]*/py-typeprint:\r\n *other\r\n.*" \
+ "info type-printers for other"
+gdb_test "whatis ovar" "type = Another"
diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
--- a/gdb/testsuite/gdb.python/py-typeprint.py
+++ b/gdb/testsuite/gdb.python/py-typeprint.py
@@ -15,8 +15,7 @@
import gdb
-
-class Recognizer(object):
+class StringRecognizer(object):
def __init__(self):
self.enabled = True
@@ -32,7 +31,27 @@ class StringTypePrinter(object):
self.enabled = True
def instantiate(self):
- return Recognizer()
+ return StringRecognizer()
gdb.type_printers.append(StringTypePrinter())
+
+class OtherRecognizer(object):
+ def __init__(self):
+ self.enabled = True
+
+ def recognize(self, type_obj):
+ if type_obj.tag == 'Other':
+ return 'Another'
+ return None
+
+class OtherTypePrinter(object):
+ def __init__(self):
+ self.name = 'other'
+ self.enabled = True
+
+ def instantiate(self):
+ return OtherRecognizer()
+
+import gdb.types
+gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter())

View File

@ -1,81 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Fri, 23 Mar 2018 20:42:44 +0100
Subject: gdb-rhbz1553104-s390x-arch12-test.patch
;; [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
;; =fedoratest
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.S
@@ -0,0 +1,4 @@
+.text
+.globl load_guarded
+load_guarded:
+.byte 0xeb,0xbf,0xf0,0x58,0x00,0x24,0xe3,0xf0,0xff,0x50,0xff,0x71,0xb9,0x04,0x00,0xbf,0xe3,0x20,0xb0,0xa0,0x00,0x24,0xe3,0x10,0xb0,0xa0,0x00,0x04,0xe3,0x10,0x10,0x00,0x00,0x4c,0xe3,0x10,0xb0,0xa8,0x00,0x24,0xe3,0x10,0xb0,0xa8,0x00,0x04,0xb9,0x04,0x00,0x21,0xe3,0x40,0xb1,0x20,0x00,0x04,0xeb,0xbf,0xb1,0x08,0x00,0x04,0x07,0xf4
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp
@@ -0,0 +1,34 @@
+# Copyright 2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#if { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
+# verbose "Skipping s390x-prologue-skip.exp"
+# return
+#}
+
+set testfile "s390x-arch12"
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
+set ofile "${srcdir}/${subdir}/${testfile}.o"
+
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
+ untested "failed uudecode"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_load $ofile
+
+gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*"
diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.o.uu b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu
@@ -0,0 +1,20 @@
+begin 644 s390x-arch12.o
+M?T5,1@("`0`````````````!`!8````!````````````````````````````
+M``$X``````!```````!```<`!.N_\%@`)./P_U#_<;D$`+_C(+"@`"3C$+"@
+M``3C$!```$SC$+"H`"3C$+"H``2Y!``AXT"Q(``$Z[^Q"``$!_0`+G-Y;71A
+M8@`N<W1R=&%B`"YS:'-T<G1A8@`N=&5X=``N9&%T80`N8G-S````````````
+M`````````````````````````````````P```0``````````````````````
+M`````P```@```````````````````````````P```P``````````````````
+M```````!$````0``````````````````````;&]A9%]G=6%R9&5D````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````!L````!``````````8`````````````````
+M``!``````````$`````````````````````$```````````````A`````0``
+M```````#````````````````````@```````````````````````````````
+M!```````````````)P````@``````````P```````````````````(``````
+M``````````````````````````0``````````````!$````#````````````
+M``````````````````"``````````"P````````````````````!````````
+M```````!`````@``````````````````````````````L`````````!X````
+M!@````0`````````"``````````8````"0````,`````````````````````
+H`````````2@`````````#@````````````````````$`````````````
+`
+end

View File

@ -0,0 +1,77 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Fri, 24 Nov 2023 11:10:08 +0000
Subject: gdb-rhbz2232086-refactor-selftest-support.patch
;; Back-port upstream commit 1f0fab7ff86 as part of a fix for
;; non-deterministic gdb-index generation (RH BZ 2232086).
gdb/testsuite: small refactor in selftest-support.exp
Split out the code that makes a copy of the GDB executable ready for
self testing into a new proc. A later commit in this series wants to
load the GDB executable into GDB (for creating an on-disk debug
index), but doesn't need to make use of the full do_self_tests proc.
There should be no changes in what is tested after this commit.
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -92,11 +92,13 @@ proc selftest_setup { executable function } {
return 0
}
-# A simple way to run some self-tests.
-
-proc do_self_tests {function body} {
- global GDB tool
-
+# Prepare for running a self-test by moving the GDB executable to a
+# location where we can use it as the inferior. Return the filename
+# of the new location.
+#
+# If the current testing setup is not suitable for running a
+# self-test, then return an empty string.
+proc selftest_prepare {} {
# Are we testing with a remote board? In that case, the target
# won't have access to the GDB's auxilliary data files
# (data-directory, etc.). It's simpler to just skip.
@@ -120,19 +122,31 @@ proc do_self_tests {function body} {
# Run the test with self. Copy the file executable file in case
# this OS doesn't like to edit its own text space.
- set GDB_FULLPATH [find_gdb $GDB]
+ set gdb_fullpath [find_gdb $::GDB]
if {[is_remote host]} {
- set xgdb x$tool
+ set xgdb x$::tool
} else {
- set xgdb [standard_output_file x$tool]
+ set xgdb [standard_output_file x$::tool]
}
# Remove any old copy lying around.
remote_file host delete $xgdb
+ set filename [remote_download host $gdb_fullpath $xgdb]
+
+ return $filename
+}
+
+# A simple way to run some self-tests.
+
+proc do_self_tests {function body} {
+ set file [selftest_prepare]
+ if { $file eq "" } {
+ return
+ }
+
gdb_start
- set file [remote_download host $GDB_FULLPATH $xgdb]
# When debugging GDB with GDB, some operations can take a relatively long
# time, especially if the build is non-optimized. Bump the timeout for the

View File

@ -1,6 +1,6 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Thu, 21 Sep 2023 18:52:49 +0200
Date: Sun, 17 Sep 2023 13:36:13 +0200
Subject: gdb-rhbz2233961-CVE-2022-4806.patch
;; Backport PR29922, SHT_NOBITS section
@ -8,9 +8,9 @@ Subject: gdb-rhbz2233961-CVE-2022-4806.patch
PR29922, SHT_NOBITS section avoids section size sanity check
PR 29922
* dwarf2.c (find_debug_info): Ignore sections without
SEC_HAS_CONTENTS.
PR 29922
* dwarf2.c (find_debug_info): Ignore sections without
SEC_HAS_CONTENTS.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
--- a/bfd/dwarf2.c

View File

@ -1,6 +1,6 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Sat, 14 Oct 2023 12:37:50 +0200
Date: Sun, 1 Oct 2023 10:36:06 +0200
Subject: gdb-rhbz2233965-memory-leak.patch
;; Backport PR29925, Memory leak in find_abstract_instance

View File

@ -1,731 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
;; Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/xlf-variable.S
@@ -0,0 +1,638 @@
+/* Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file has been generated from the file named `xlf-variable.f', which
+ should be present in this directory. The command used to generate this
+ file was:
+
+ xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S
+
+ After issuing this command, you must hand-edit this file and remove the
+ mentions for `_xlfExit', since it is only present in XLF-specific
+ libraries. You must also make sure to remove the file named `mod1.mod'
+ which will be created in the compilation directory.
+
+ In order to generated this file, the following XLF package was used:
+
+ xlf.14.1.0.0.linux.eval.tar.gz
+
+ These instructions may be different for different versions of the XLF
+ compiler. */
+
+.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4
+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
+.set r30,30; .set r31,31
+.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4
+.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9
+.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14
+.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19
+.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24
+.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29
+.set fp30,30; .set fp31,31
+.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4
+.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9
+.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14
+.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19
+.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24
+.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29
+.set v30,30; .set v31,31
+.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4
+.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9
+.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14
+.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19
+.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24
+.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29
+.set q30,30; .set q31,31
+.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6
+.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20
+.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26
+.set SRR_1,27
+.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1
+.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3
+.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6
+.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9
+.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12
+.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16
+.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19
+.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22
+.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25
+.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28
+.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31
+.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3
+.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7
+.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11
+.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15
+.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19
+.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23
+.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27
+.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31
+.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1
+
+ .file "xlf-variable.f"
+ .globl __mod1_NMOD_____mod1
+ .type __mod1_NMOD_____mod1,@function
+ .size __mod1_NMOD_____mod1,32
+ .globl main
+ .type main,@function
+ .size main,68
+ .globl __mod1_NMOD_sub1
+ .type __mod1_NMOD_sub1,@function
+ .size __mod1_NMOD_sub1,136
+ .globl _main
+ .type _main,@function
+ .size _main,68
+
+ .section ".text"
+ .align 7
+.LC.text:
+__mod1_NMOD_____mod1:
+ stwu SP,-32(SP)
+ stw r31,28(SP)
+ or r31,SP,SP
+ b $+0x4
+ addi r11,r31,32
+ lwz r31,-4(r11)
+ or SP,r11,r11
+ bclr BO_ALWAYS,CR0_LT
+.LC.text32:
+
+__mod1_NMOD_sub1:
+ stwu SP,-32(SP)
+ stw r31,28(SP)
+ stw r30,24(SP)
+ or r31,SP,SP
+ addis r30,r0,.const_dr@ha
+ addi r30,r30,.const_dr@l
+ addis r3,r0,__N_mod1@ha
+ addi r3,r3,__N_mod1@l
+ addi r0,r0,1
+ stb r0,4(r3)
+ addi r4,r0,14
+ stb r4,5(r3)
+ stb r0,7(r3)
+ addis r5,r0,__N__mod1@ha
+ addi r5,r5,__N__mod1@l
+ stw r5,0(r3)
+ lbz r5,6(r3)
+ rlwinm r5,r5,0,25,25
+ ori r5,r5,0x0040
+ stb r5,6(r3)
+ lwz r5,0(r3)
+ lfs fp0,0(r30)
+ stfs fp0,0(r5)
+ stb r0,4(r3)
+ stb r4,5(r3)
+ addi r4,r0,0
+ stb r4,6(r3)
+ stb r0,7(r3)
+ b $+0x4
+ addi r11,r31,32
+ lwz r30,-8(r11)
+ lwz r31,-4(r11)
+ or SP,r11,r11
+ bclr BO_ALWAYS,CR0_LT
+.LC.text168:
+ .long 0
+ .skip 0x54
+.LC.text256:
+
+main:
+_main:
+ mfspr r0,LR
+ stwu SP,-32(SP)
+ stw r31,28(SP)
+ stw r0,36(SP)
+ or r31,SP,SP
+ bl __mod1_NMOD_sub1
+ addi r3,r0,0
+.LC.text288:
+
+ tw TO_EQ,r14,r14
+ addi r3,r0,0
+ b $+0x4
+ addi r11,r31,32
+ lwz r31,-4(r11)
+ lwz r0,4(r11)
+ mtspr LR,r0
+ or SP,r11,r11
+ bclr BO_ALWAYS,CR0_LT
+.LC.text324:
+
+
+ .section ".rodata","a"
+ .align 2
+.LC.rodata:
+ .type .const_dr,@object
+ .size .const_dr,4
+.const_dr:
+ .long 0x40400000
+
+ .section ".eh_frame","wa"
+ .align 2
+.LC.eh_frame:
+ .long 0x0000000c
+ .long 0x00000000
+ .long 0x0100047c
+ .long 0x410c0100
+ .long 0x0000001c
+ .long 0x00000014
+ .long .LC.text
+ .long 0x00000020
+ .long 0x410e2041
+ .long 0x9f01410d
+ .long 0x1f410a42
+ .long 0xdf420b00
+ .long 0x00000020
+ .long 0x00000034
+ .long .LC.text32
+ .long 0x00000088
+ .long 0x410e2041
+ .long 0x9f01419e
+ .long 0x02410d1f
+ .long 0x590a42de
+ .long 0x41df420b
+ .long 0x0000000c
+ .long 0x00000000
+ .long 0x0100047c
+ .long 0x410c0100
+ .long 0x00000020
+ .long 0x00000014
+ .long .LC.text256
+ .long 0x00000044
+ .long 0x420e2041
+ .long 0x9f014111
+ .long 0x417f410d
+ .long 0x1f460a42
+ .long 0xdf440b00
+
+ .section ".data","wa"
+ .align 4
+.LC.data:
+ .globl __N_mod1
+ .type __N_mod1,@object
+ .size __N_mod1,8
+__N_mod1:
+ .long 0x00000000
+ .long 0x01000001
+
+ .section ".except.1","wa"
+ .align 1
+.LC.except.1:
+ .long .LC.text288
+ .byte 0x01
+ .byte 0x09
+
+ .ident "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000."
+
+ .section ".debug_aranges"
+ .align 0
+.LC.debug_aranges:
+ .long 0x0000001c
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_info
+ .long 0x04000000
+ .byte 0x00
+ .byte 0x00
+ .long .LC.text
+ .long 0x000000a8
+ .long 0x00000000
+ .long 0x00000000
+ .long 0x0000001c
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_info273
+ .long 0x04000000
+ .byte 0x00
+ .byte 0x00
+ .long .LC.text256
+ .long 0x00000044
+ .long 0x00000000
+ .long 0x00000000
+
+ .section ".debug_pubnames"
+ .align 0
+.LC.debug_pubnames:
+ .long 0x0000002f
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_info
+ .long 0x00000111
+ .long 0x000000dc
+ .long 0x79000000
+ .long 0x00ec7a00
+ .long 0x000000fc
+ .long 0x5f5f6d6f
+ .long 0x64315f4e
+ .long 0x4d4f445f
+ .long 0x73756231
+ .long 0x00000000
+ .long 0x00000000
+ .byte 0x18
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_info273
+ .long 0x00000127
+ .long 0x0000010f
+ .long 0x5f6d6169
+ .long 0x6e000000
+ .byte 0x00
+ .byte 0x00
+
+ .section ".debug_info"
+ .align 0
+.LC.debug_info:
+ .long 0x0000010d
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_abbrev
+ .long 0x0401786c
+ .long 0x662d7661
+ .long 0x72696162
+ .long 0x6c652e66
+ .byte 0x00
+ .long .LC.debug_line
+ .long .LC.text
+ .long .LC.text168
+ .long 0x082f726f
+ .long 0x6f742f73
+ .long 0x65726769
+ .long 0x6f646a2f
+ .long 0x6764622d
+ .long 0x372e302e
+ .long 0x312d3432
+ .long 0x2e656c35
+ .long 0x2f676462
+ .long 0x2d372e30
+ .long 0x2e312f67
+ .long 0x64622f74
+ .long 0x65737473
+ .long 0x75697465
+ .long 0x2f676462
+ .long 0x2e666f72
+ .long 0x7472616e
+ .long 0x0049424d
+ .long 0x20584c20
+ .long 0x466f7274
+ .long 0x72616e20
+ .long 0x666f7220
+ .long 0x4c696e75
+ .long 0x782c2056
+ .long 0x31342e31
+ .long 0x20283537
+ .long 0x36352d4a
+ .long 0x30352c20
+ .long 0x35373235
+ .long 0x2d433735
+ .long 0x29205665
+ .long 0x7273696f
+ .long 0x6e203134
+ .long 0x2e30312e
+ .long 0x30303030
+ .long 0x2e303030
+ .long 0x30000249
+ .long 0x4e544547
+ .long 0x45520004
+ .long 0x05030005
+ .long 0x02524541
+ .long 0x4c000404
+ .long 0x04050000
+ .long 0x0000c706
+ .long 0x6d6f6431
+ .long 0x00070503
+ .long __N_mod1
+ .long 0x79000100
+ .long 0x01000000
+ .long 0xd0070503
+ .long __N__mod1
+ .long 0x7a000100
+ .long 0x01000000
+ .long 0xc7087375
+ .byte 0x62
+ .byte 0x31
+ .byte 0x00
+ .long .LC.text32
+ .long .LC.text168
+ .long 0x01180101
+ .byte 0x6f
+ .byte 0x00
+ .byte 0x00
+.LC.debug_info273:
+ .long 0x00000123
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_abbrev97
+ .long 0x0401786c
+ .long 0x662d7661
+ .long 0x72696162
+ .long 0x6c652e66
+ .byte 0x00
+ .long .LC.debug_line98
+ .long .LC.text256
+ .long .LC.text324
+ .long 0x082f726f
+ .long 0x6f742f73
+ .long 0x65726769
+ .long 0x6f646a2f
+ .long 0x6764622d
+ .long 0x372e302e
+ .long 0x312d3432
+ .long 0x2e656c35
+ .long 0x2f676462
+ .long 0x2d372e30
+ .long 0x2e312f67
+ .long 0x64622f74
+ .long 0x65737473
+ .long 0x75697465
+ .long 0x2f676462
+ .long 0x2e666f72
+ .long 0x7472616e
+ .long 0x0049424d
+ .long 0x20584c20
+ .long 0x466f7274
+ .long 0x72616e20
+ .long 0x666f7220
+ .long 0x4c696e75
+ .long 0x782c2056
+ .long 0x31342e31
+ .long 0x20283537
+ .long 0x36352d4a
+ .long 0x30352c20
+ .long 0x35373235
+ .long 0x2d433735
+ .long 0x29205665
+ .long 0x7273696f
+ .long 0x6e203134
+ .long 0x2e30312e
+ .long 0x30303030
+ .long 0x2e303030
+ .long 0x30000249
+ .long 0x4e544547
+ .long 0x45520004
+ .long 0x05030005
+ .long 0x02524541
+ .long 0x4c000404
+ .long 0x04000000
+ .long 0xb9050000
+ .long 0x0000c706
+ .long 0x000000f4
+ .long 0x26264e26
+ .long 0x6d6f6431
+ .long 0x00080779
+ .long 0x00022300
+ .long 0x000000d4
+ .long 0x00060000
+ .long 0x010f2626
+ .long 0x4e26266d
+ .long 0x6f643100
+ .long 0x04077a00
+ .long 0x02230000
+ .long 0x0000c700
+ .long 0x085f6d61
+ .byte 0x69
+ .byte 0x6e
+ .byte 0x00
+ .long .LC.text256
+ .long .LC.text324
+ .long 0x0201016f
+ .long 0x000000b9
+ .byte 0x00
+
+ .section ".debug_abbrev"
+ .align 0
+.LC.debug_abbrev:
+ .long 0x01110103
+ .long 0x08100611
+ .long 0x01120113
+ .long 0x0b1b0825
+ .long 0x08000002
+ .long 0x24000308
+ .long 0x0b0b3e0b
+ .long 0x00000324
+ .long 0x000b0b3e
+ .long 0x0b000004
+ .long 0x15000000
+ .long 0x050f0033
+ .long 0x0b491300
+ .long 0x00061e01
+ .long 0x03080000
+ .long 0x07340002
+ .long 0x0a03083a
+ .long 0x0b3b0b3f
+ .long 0x0c491300
+ .long 0x00082e00
+ .long 0x03081101
+ .long 0x12013a0b
+ .long 0x3b0b3f0c
+ .long 0x400a0000
+ .byte 0x00
+.LC.debug_abbrev97:
+ .long 0x01110103
+ .long 0x08100611
+ .long 0x01120113
+ .long 0x0b1b0825
+ .long 0x08000002
+ .long 0x24000308
+ .long 0x0b0b3e0b
+ .long 0x00000324
+ .long 0x000b0b3e
+ .long 0x0b000004
+ .long 0x15004913
+ .long 0x0000050f
+ .long 0x00330b49
+ .long 0x13000006
+ .long 0x13010113
+ .long 0x03080b0b
+ .long 0x0000070d
+ .long 0x00030838
+ .long 0x0a491300
+ .long 0x00082e00
+ .long 0x03081101
+ .long 0x1201360b
+ .long 0x3f0c400a
+ .long 0x49130000
+ .byte 0x00
+
+ .section ".debug_line"
+ .align 0
+.LC.debug_line:
+ .long 0x0000005e
+ .long 0x00020000
+ .long 0x00220101
+ .long 0x9cdc0a00
+ .long 0x01010101
+ .long 0x00000001
+ .long 0x00786c66
+ .long 0x2d766172
+ .long 0x6961626c
+ .long 0x652e6600
+ .long 0x00000000
+ .long 0x04010005
+ .byte 0x02
+ .long .LC.text
+ .long 0x03130109
+ .long 0x000c0309
+ .long 0x01090014
+ .long 0x037b0109
+ .long 0x00180301
+ .long 0x01090038
+ .long 0x03010109
+ .long 0x000c0301
+ .long 0x01090014
+ .long 0x03010109
+ .long 0x00180001
+ .byte 0x01
+.LC.debug_line98:
+ .long 0x00000046
+ .long 0x00020000
+ .long 0x00220101
+ .long 0x9cdc0a00
+ .long 0x01010101
+ .long 0x00000001
+ .long 0x00786c66
+ .long 0x2d766172
+ .long 0x6961626c
+ .long 0x652e6600
+ .long 0x00000000
+ .long 0x04010005
+ .byte 0x02
+ .long .LC.text256
+ .long 0x031f0109
+ .long 0x00140300
+ .long 0x01090004
+ .long 0x03010109
+ .long 0x002c0001
+ .byte 0x01
+
+ .section ".debug_frame"
+ .align 0
+.LC.debug_frame:
+ .long 0x0000000c
+ .long 0xffffffff
+ .long 0x0100047c
+ .long 0x410c0100
+ .long 0x0000001c
+ .long .LC.debug_frame
+ .long .LC.text
+ .long 0x00000020
+ .long 0x410e2041
+ .long 0x9f01410d
+ .long 0x1f410a42
+ .long 0xdf420b00
+ .long 0x00000020
+ .long .LC.debug_frame
+ .long .LC.text32
+ .long 0x00000088
+ .long 0x410e2041
+ .long 0x9f01419e
+ .long 0x02410d1f
+ .long 0x590a42de
+ .long 0x41df420b
+.LC.debug_frame84:
+ .long 0x0000000c
+ .long 0xffffffff
+ .long 0x0100047c
+ .long 0x410c0100
+ .long 0x00000020
+ .long .LC.debug_frame84
+ .long .LC.text256
+ .long 0x00000044
+ .long 0x420e2041
+ .long 0x9f014111
+ .long 0x417f410d
+ .long 0x1f460a42
+ .long 0xdf440b00
+
+ .section ".debug_pubtypes"
+ .align 0
+.LC.debug_pubtypes:
+ .long 0x00000023
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_info
+ .long 0x00000111
+ .long 0x000000b9
+ .long 0x494e5445
+ .long 0x47455200
+ .long 0x000000c7
+ .long 0x5245414c
+ .long 0x00000000
+ .long 0x00000000
+ .byte 0x3e
+ .byte 0x00
+ .byte 0x02
+ .long .LC.debug_info273
+ .long 0x00000127
+ .long 0x000000b9
+ .long 0x494e5445
+ .long 0x47455200
+ .long 0x000000c7
+ .long 0x5245414c
+ .long 0x00000000
+ .long 0xda26264e
+ .long 0x266d6f64
+ .long 0x31000000
+ .long 0x00f42626
+ .long 0x4e26266d
+ .long 0x6f643100
+ .long 0x00000000
+
+ .comm __N__mod1,4,16
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.exp b/gdb/testsuite/gdb.fortran/xlf-variable.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/xlf-variable.exp
@@ -0,0 +1,37 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test can only be run on PPC64 machines.
+
+if { ![istarget powerpc64-*] || ![is_ilp32_target] } {
+ return -1
+}
+
+set testfile "xlf-variable"
+set srcfile ${testfile}.S
+
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
+ return -1
+}
+
+if { ![runto_main] } {
+ return -1
+}
+
+gdb_test "step" ".*y => z.*" "y => z"
+gdb_test "step" ".*y = 3\.0.*" "y = 3.0"
+gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)"
+gdb_test "print z" "= 3" "z = 3"
+gdb_test "ptype z" "= REAL" "z is REAL"
diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.f b/gdb/testsuite/gdb.fortran/xlf-variable.f
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/xlf-variable.f
@@ -0,0 +1,33 @@
+c Copyright 2012 Free Software Foundation, Inc.
+c
+c This program is free software; you can redistribute it and/or modify
+c it under the terms of the GNU General Public License as published by
+c the Free Software Foundation; either version 3 of the License, or
+c (at your option) any later version.
+c
+c This program is distributed in the hope that it will be useful,
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+c GNU General Public License for more details.
+c
+c You should have received a copy of the GNU General Public License
+c along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+c This file is the Fortran source file for xlf-variable.f.
+c It was used to generate the assembly output called xlf-variable.S,
+c which was generated using IBM's XLF compiler.
+
+ module mod1
+ real, pointer :: y
+ real, target :: z
+ contains
+ subroutine sub1
+ y => z
+ y = 3.0
+ nullify (y)
+ end subroutine
+ end module
+
+ use mod1
+ call sub1
+ end

View File

@ -1,92 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-test-pid0-core.patch
;; New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435).
;;=fedoratest
https://bugzilla.redhat.com/show_bug.cgi?id=611435
Fix:
Re: [RFA]corelow.c: Add tid to add_to_thread_list
http://sourceware.org/ml/gdb-patches/2010-08/msg00085.html
http://sourceware.org/ml/gdb-cvs/2010-08/msg00026.html
2e5bcfdef1ec3883d48c3f87a4be5c0dff25e17e
diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu
@@ -0,0 +1,20 @@
+begin 600 x86_64-pid0-core.core.bz2
+M0EIH.3%!629362,CA>P!$/'_____^*#EZ-A!SP36P&_:G0#=14``04A&8,'U
+M2*9`>$$)P`*RN"#*;#4R()IJ8C$TT&FC3$&@`T`#:C1H8C0T,@,FC,D"4T2!
+M"/2CU'B90]31ZAD#U`&AZF@/4:``!HT&F@!H<`#0-`-#0``#3$-&F@```#0R
+M``#")2FD]2>4]0TTT-!HTT--,0,"#$`R!I@AD`#1H,3&GZT.4TO$#H40/`0C
+M2$IRXS,<55!8T,&&,R.Z441"?J9I%G6GUA2!.[]Z"C5S[&19,%VS7E6[3"60
+M@`-*2G)QEQ(;?0Y<=MK]/U?Q)LB%+F37TJ9BI*46)H'*Z@V"`"$"P7]&<Q<?
+M>XZ:JE0E<*:#1M$P3G]>VCI)(A!O$64`5$4`E$$-.``7&(09`8HO`B6K!Q^&
+M562%N)2+0@*HB@%D@5$%!*0!L1&0D4D6\:-$A`)`+<6D82PP*H(J(H!?F;0$
+M%PXB7N!2D4!44`W7"ADEQM6<B]J<B(%1GF'5*0;_00KO55=43LPR0,Q?N72`
+M8"W*_;DV<AN#,XRU]Q-J2FDAFKAQ(9A+ZK$MCY#EI8:W-(15>O9TBO5,_]1)
+M($Q2))#),UE,QQK)E$,3D\W.>!4)QO8A_@^Z_SXS<OEHM*+"M8I1)-C(=DIJ
+MW+@WN)O)YO;3:I9YW-A$)N'2<A`F3),R3"3-'"S3E1;6VE*_95KD<!0050(G
+M,JV"N(Z:@0E#)50BSF)$T6_IN)#"Z8PLQ4UQ9]@Z'+;T]990-:Y:2`P26#!D
+MV+0L6"X@C9`GHAGSY7)%LWOY+E[2/>4;Q8=HV6[:&$@2$@$R29IBW)K%3"O`
+M9^Y0YJ&BXY1U2HTZ5)2H-V\_(.DZHWE+C#WS($(!I"3CUH2#(+(OWUV"*<<9
+MJ%A!J[%O.P&V%GI.`L7<1@0>,^1F\MY=V5UT,&NOG%7TTZ[03!@BHB@&)<A^
+4B.Z!/,0-IZ^W_Q=R13A0D",CA>P`
+`
+end
diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp
@@ -0,0 +1,46 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Some kernel core files have PID 0 - for the idle task.
+
+if ![istarget "x86_64-*-*"] {
+ verbose "Skipping x86_64-pid0-core test."
+ return
+}
+
+set testfile "x86_64-pid0-core"
+set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu
+set corefile [standard_output_file ${testfile}.core]
+
+if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} {
+ untested "failed uudecode or bzip2"
+ return -1
+}
+file stat ${corefile} corestat
+if {$corestat(size) != 8798208} {
+ untested "uudecode or bzip2 produce invalid result"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+# Former crash was:
+# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed.
+gdb_test "core-file ${corefile}" "Program terminated with signal (11|SIGSEGV), Segmentation fault\\.\r\n.*"

View File

@ -1,3 +1,62 @@
-------------------------------------------------------------------
Thu Apr 18 14:00:01 UTC 2024 - Tom de Vries <tdevries@suse.com>
- Patch added (swo#31524, bsc#1222188):
* make-pascal_language-print_type-handle-varstring-nul.patch
- Renable gcc-fortran for SLE-11.
- Use system compiler (gcc 4.3.4) for testing all languages on
SLE-11.
- Maintenance script qa.sh:
* Ignore all fails for SLE-11.
- Maintenance script import-fedora.sh:
* Use %patch -P N instead of deprecated %patchN.
* Drop patch skips:
* gdb-6.5-readline-long-line-crash-test.patch
* gdb-6.7-charsign-test.patch
* gdb-test-ivy-bridge.patch
* gdb-ppc-power7-test.patch
* gdb-6.3-bz140532-ppc-unwinding-test.patch
- Patches added (import from fedora rawhide @ a27201b):
* gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
* gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
* gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
* gdb-rhbz-2232086-generate-gdb-index-consistently.patch
* gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
* gdb-rhbz2232086-refactor-selftest-support.patch
- Patches updated (import from fedora rawhide @ a27201b):
* gdb-6.6-buildid-locate-rpm.patch
* gdb-6.6-buildid-locate.patch
* gdb-fedora-libncursesw.patch
* gdb-rhbz2233961-CVE-2022-4806.patch
* gdb-rhbz2233965-memory-leak.patch
- Patches updated:
* gdb-6.6-buildid-locate-rpm-suse.patch
- Patches deleted (import from fedora rawhide @ a27201b):
* gdb-rhbz1553104-s390x-arch12-test.patch
* gdb-lineno-makeup-test.patch
* gdb-6.3-bz202689-exec-from-pthread-test.patch
* gdb-6.5-bz109921-DW_AT_decl_file-test.patch
* gdb-6.5-ia64-libunwind-leak-test.patch
* gdb-6.5-last-address-space-byte-test.patch
* gdb-6.5-missed-trap-on-step-test.patch
* gdb-6.5-sharedlibrary-path.patch
* gdb-6.7-testsuite-stable-results.patch
* gdb-6.8-bz442765-threaded-exec-test.patch
* gdb-ccache-workaround.patch
* gdb-opcodes-clflushopt-test.patch
* gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
* gdb-rhbz1350436-type-printers-error.patch
* gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
* gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
* gdb-test-pid0-core.patch
- Patches deleted:
* fixup-gdb-rhbz1553104-s390x-arch12-test.patch
* fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
* fixup-gdb-lineno-makeup-test.patch
* fixup-gdb-6.6-buildid-locate-rpm.patch
- Remove commented out mention of dropped patch
gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch.
-------------------------------------------------------------------
Thu Apr 18 08:21:00 UTC 2024 - Tom de Vries <tdevries@suse.com>

164
gdb.spec
View File

@ -172,59 +172,48 @@ NoSource: 20
#Fedora Packages begin
Patch2: gdb-6.3-gstack-20050411.patch
Patch3: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Patch4: gdb-6.5-sharedlibrary-path.patch
Patch6: gdb-6.5-last-address-space-byte-test.patch
Patch8: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch9: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Patch11: gdb-6.3-bz202689-exec-from-pthread-test.patch
Patch12: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch13: gdb-6.6-testsuite-timeouts.patch
Patch14: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch15: gdb-6.3-attach-see-vdso-test.patch
Patch16: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch17: gdb-6.6-buildid-locate.patch
Patch18: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch19: gdb-6.6-buildid-locate-rpm.patch
Patch22: gdb-6.7-testsuite-stable-results.patch
Patch23: gdb-6.5-ia64-libunwind-leak-test.patch
Patch24: gdb-6.5-missed-trap-on-step-test.patch
Patch25: gdb-6.5-gcore-buffer-limit-test.patch
Patch26: gdb-6.3-mapping-zero-inode-test.patch
Patch27: gdb-6.8-bz442765-threaded-exec-test.patch
Patch28: gdb-6.5-section-num-fixup-test.patch
Patch30: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch31: gdb-core-open-vdso-warning.patch
Patch32: gdb-ccache-workaround.patch
Patch33: gdb-lineno-makeup-test.patch
Patch35: gdb-archer-next-over-throw-cxx-exec.patch
Patch36: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch37: gdb-test-bt-cfi-without-die.patch
Patch38: gdb-bz634108-solib_address.patch
Patch39: gdb-test-pid0-core.patch
Patch40: gdb-test-dw2-aranges.patch
Patch42: gdb-glibc-strstr-workaround.patch
Patch43: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
Patch44: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch45: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch46: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch49: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch50: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
Patch51: gdb-rhbz1350436-type-printers-error.patch
Patch52: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch53: gdb-fedora-libncursesw.patch
Patch54: gdb-opcodes-clflushopt-test.patch
Patch55: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch57: gdb-linux_perf-bundle.patch
Patch59: gdb-rhbz1553104-s390x-arch12-test.patch
Patch60: gdb-binutils29988-read_indexed_address.patch
Patch61: gdb-rhbz2192105-ftbs-dangling-pointer
Patch62: gdb-rhbz2160211-excessive-core-file-warnings.patch
Patch63: gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch
Patch64: gdb-bz2237515-debuginfod-double-free.patch
Patch65: gdb-bz2237392-dwarf-obstack-allocation.patch
Patch66: gdb-rhbz2233961-CVE-2022-4806.patch
Patch67: gdb-rhbz2233965-memory-leak.patch
Patch68: gdb-rhbz1773651-gdb-index-internal-error.patch
Patch5: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch6: gdb-6.6-bz229517-gcore-without-terminal.patch
Patch7: gdb-6.6-testsuite-timeouts.patch
Patch8: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch9: gdb-6.3-attach-see-vdso-test.patch
Patch10: gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch11: gdb-6.6-buildid-locate.patch
Patch12: gdb-6.6-buildid-locate-solib-missing-ids.patch
Patch13: gdb-6.6-buildid-locate-rpm.patch
Patch15: gdb-6.5-gcore-buffer-limit-test.patch
Patch16: gdb-6.3-mapping-zero-inode-test.patch
Patch17: gdb-6.5-section-num-fixup-test.patch
Patch19: gdb-simultaneous-step-resume-breakpoint-test.patch
Patch20: gdb-core-open-vdso-warning.patch
Patch21: gdb-archer-next-over-throw-cxx-exec.patch
Patch22: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
Patch23: gdb-test-bt-cfi-without-die.patch
Patch24: gdb-bz634108-solib_address.patch
Patch25: gdb-test-dw2-aranges.patch
Patch26: gdb-glibc-strstr-workaround.patch
Patch27: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch28: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
Patch29: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Patch32: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch33: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch34: gdb-fedora-libncursesw.patch
Patch35: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Patch37: gdb-linux_perf-bundle.patch
Patch39: gdb-binutils29988-read_indexed_address.patch
Patch40: gdb-rhbz2192105-ftbs-dangling-pointer
Patch41: gdb-rhbz2160211-excessive-core-file-warnings.patch
Patch42: gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
Patch43: gdb-bz2237515-debuginfod-double-free.patch
Patch44: gdb-bz2237392-dwarf-obstack-allocation.patch
Patch45: gdb-rhbz2233961-CVE-2022-4806.patch
Patch46: gdb-rhbz2233965-memory-leak.patch
Patch47: gdb-rhbz1773651-gdb-index-internal-error.patch
Patch48: gdb-rhbz2232086-refactor-selftest-support.patch
Patch49: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
Patch50: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
Patch51: gdb-rhbz-2232086-generate-gdb-index-consistently.patch
Patch52: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
#Fedora Packages end
# Fedora patches fixup
@ -232,18 +221,14 @@ Patch68: gdb-rhbz1773651-gdb-index-internal-error.patch
# them when upgrading.
Patch1000: fixup-gdb-linux_perf-bundle.patch
Patch1002: fixup-gdb-rhbz1553104-s390x-arch12-test.patch
Patch1003: fixup-gdb-glibc-strstr-workaround.patch
Patch1004: fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch
Patch1005: fixup-gdb-test-bt-cfi-without-die.patch
Patch1006: fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch
Patch1007: fixup-gdb-test-dw2-aranges.patch
Patch1008: fixup-gdb-bz634108-solib_address.patch
Patch1009: fixup-gdb-6.3-gstack-20050411.patch
Patch1010: fixup-gdb-6.3-attach-see-vdso-test.patch
Patch1011: fixup-gdb-lineno-makeup-test.patch
Patch1012: fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch
Patch1013: fixup-gdb-6.6-buildid-locate-rpm.patch
# openSUSE specific
@ -256,9 +241,6 @@ Patch1101: gdb-6.6-buildid-locate-rpm-suse.patch
# Silences ada pie compilation FAILs. Todo: Fix ada pie compilation.
Patch1200: gdb-testsuite-ada-pie.patch
# Strictly speaking, not a testsuite patch, but purpose is to enable gdb.gdb
# testcases.
##Patch1201: gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch
# The test-case expects init or systemd as process, but we run into a case
# where it's bash instead. This doesn't look harmful, so allow it.
# It would be nice to upstream this, but in order to do that I'd like to have
@ -289,7 +271,7 @@ Patch1505: gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-ca
#
# Backports from master, available in next release.
# Backports from master, available in next release (GDB 14).
Patch2000: remove-some-unnecessary-includes-from-exp.y.patch
Patch2001: gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch
@ -343,7 +325,7 @@ Patch2048: gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch
# Part of upstream commit deb1ba4e38b ("[gdb/tui] Fix TUI resizing for TERM=ansi").
Patch2049: gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch
# Backports from master, not yet available in next release.
# Backports from master, not yet available in next release (GDB 15).
Patch2070: gdb-symtab-work-around-pr-gas-29517.patch
Patch2071: gdb-symtab-add-producer_is_gas.patch
@ -352,6 +334,7 @@ Patch2073: gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch
Patch2074: gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch
Patch2075: gdb-testsuite-add-missing-no-prompt-anchor-in-gdb.ba.patch
Patch2076: gdb-testsuite-remove-spurious-in-save_vars.patch
Patch2077: make-pascal_language-print_type-handle-varstring-nul.patch
# Backport from gdb-patches
@ -522,14 +505,7 @@ BuildRequires: dejagnu
BuildRequires: sharutils
# gcc-objc++ is not covered by the GDB testsuite.
%if 0%{?suse_version} >= 1200
# Skip for SLE-11 due to:
# unresolvable: conflict for providers of libquadmath0
# needed by libgfortran3
# (provider libquadmath0-gcc5 is in conflict with libquadmath0)
BuildRequires: gcc-fortran
%endif
BuildRequires: gcc-objc
%ifarch %ada_arch
BuildRequires: gcc-ada
@ -548,6 +524,9 @@ BuildRequires: gcc-ada-32bit
%if 0%{suse_version} > 1110
BuildRequires: gcc-c++-32bit
%else
# Use system g++ for testing for SLE-11.
BuildRequires: gcc-c++
%endif
%if 0%{suse_version} >= 1210 && 0%{suse_version} != 1315
@ -694,19 +673,21 @@ find -name "*.info*"|xargs rm -f
#Fedora patching start
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
%patch -P 9 -p1
%patch -P 10 -p1
%patch -P 11 -p1
%patch -P 12 -p1
%patch -P 13 -p1
%patch -P 14 -p1
%patch -P 15 -p1
%patch -P 16 -p1
%patch -P 17 -p1
%patch -P 18 -p1
%patch -P 19 -p1
%patch -P 20 -p1
%patch -P 21 -p1
%patch -P 22 -p1
%patch -P 23 -p1
%patch -P 24 -p1
@ -714,60 +695,42 @@ find -name "*.info*"|xargs rm -f
%patch -P 26 -p1
%patch -P 27 -p1
%patch -P 28 -p1
%patch -P 30 -p1
%patch -P 31 -p1
%patch -P 29 -p1
%patch -P 32 -p1
%patch -P 33 -p1
%patch -P 34 -p1
%patch -P 35 -p1
%patch -P 36 -p1
%patch -P 37 -p1
%patch -P 38 -p1
%patch -P 39 -p1
%patch -P 40 -p1
%patch -P 41 -p1
%patch -P 42 -p1
%patch -P 43 -p1
%patch -P 44 -p1
%patch -P 45 -p1
%patch -P 46 -p1
%patch -P 47 -p1
%patch -P 48 -p1
%patch -P 49 -p1
%patch -P 50 -p1
%patch -P 51 -p1
%patch -P 52 -p1
%patch -P 53 -p1
%patch -P 54 -p1
%patch -P 55 -p1
%patch -P 57 -p1
%patch -P 59 -p1
%patch -P 60 -p1
%patch -P 61 -p1
%patch -P 62 -p1
%patch -P 63 -p1
%patch -P 64 -p1
%patch -P 65 -p1
%patch -P 66 -p1
%patch -P 67 -p1
%patch -P 68 -p1
#Fedora patching end
%patch -P 1000 -p1
%patch -P 1002 -p1
%patch -P 1003 -p1
%patch -P 1004 -p1
%patch -P 1005 -p1
%patch -P 1006 -p1
%patch -P 1007 -p1
%patch -P 1008 -p1
%patch -P 1009 -p1
%patch -P 1010 -p1
%patch -P 1011 -p1
%patch -P 1012 -p1
%patch -P 1013 -p1
%patch -P 1100 -p1
%patch -P 1101 -p1
%patch -P 1200 -p1
#%patch -P 1201 -p1
%patch -P 1202 -p1
%patch -P 1203 -p1
%patch -P 1204 -p1
@ -836,6 +799,7 @@ find -name "*.info*"|xargs rm -f
%patch -P 2074 -p1
%patch -P 2075 -p1
%patch -P 2076 -p1
%patch -P 2077 -p1
%patch -P 2100 -p1
%patch -P 2101 -p1
@ -1128,18 +1092,8 @@ echo ====================TESTSUITE DISABLED=========================
%else
echo ====================TESTING=========================
cd gdb
%if 0%{suse_version} > 1110
CC=gcc
CXX=g++
%else
CC=gcc-4.8
CXX=g++-4.8
mkdir progs
for i in gcc g++ gcj gfortran gnat gnatbind gnatmake; do
test -f /usr/bin/${i}-4.8 && ln -sf /usr/bin/${i}-4.8 progs/$i
done
PATH="`pwd`"/progs:${PATH}
%endif
export CC
export CXX
$CC -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2

View File

@ -13,20 +13,11 @@ skip_patches=(
# Broken.
# Over-specific test-case in a shell script.
gdb-6.5-BEA-testsuite.patch
# Hangs for horizontal-scroll-mode on, times out after 10 minutes.
gdb-6.5-readline-long-line-crash-test.patch
# Fragile test-case, requires glibc to fail in a certain way.
gdb-rhbz1156192-recursive-dlopen-test.patch
# Obsolete (dropped by fedora).
gdb-6.7-charsign-test.patch
gdb-test-ivy-bridge.patch
gdb-ppc-power7-test.patch
gdb-6.3-bz140532-ppc-unwinding-test.patch
# Obsolete.
gdb-6.7-charsign-test.patch
gdb-6.7-ppc-clobbered-registers-O2-test.patch
)
@ -109,7 +100,7 @@ import_patches ()
>> $f1
echo \
"%patch$n -p1" \
"%patch -P $n -p1" \
>> $f2
n=$((n + 1))

View File

@ -0,0 +1,43 @@
From f27cc602d85c46b46f5b02d6f584a1d872e098e3 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tom@tromey.com>
Date: Wed, 27 Mar 2024 10:34:46 -0600
Subject: [PATCH] Make pascal_language::print_type handle varstring==nullptr
PR gdb/31524 points out a crash when pascal_language::print_type is
called with varstring==nullptr. This crash is a regression arising
from the printf/pager rewrite -- that indirectly removed a NULL check
from gdb's "puts".
This patch instead fixes the problem by adding a check to print_type.
Passing nullptr here seems to be expected in other places (e.g., there
is a call to type_print like this in expprint.c), and other
implementations of this method (or related helpers) explicitly check
for NULL.
I didn't write a test case for this because it seemed like overkill
for a Pascal bug that only occurs with -i=mi. However, if you want
one, let me know and I will do it.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31524
Approved-By: John Baldwin <jhb@FreeBSD.org>
---
gdb/p-typeprint.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index e8542d6845a..68a94a65f64 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -55,7 +55,8 @@ pascal_language::print_type (struct type *type, const char *varstring,
type_print_varspec_prefix (type, stream, show, 0, flags);
}
/* first the name */
- gdb_puts (varstring, stream);
+ if (varstring != nullptr)
+ gdb_puts (varstring, stream);
if ((varstring != NULL && *varstring != '\0')
&& !(code == TYPE_CODE_FUNC
--
2.35.3

47
qa.sh
View File

@ -395,49 +395,10 @@ kfail_sle12=(
kfail_sle11=(
"${kfail_sle12[@]}"
# For SLE-11, libipt is not enabled, so on intel we can run into
# https://sourceware.org/bugzilla/show_bug.cgi?id=30073 affecting
# many test-cases.
"FAIL: gdb.btrace/"
"FAIL: gdb.python/py-record-btrace"
# https://sourceware.org/bugzilla/show_bug.cgi?id=26956
"FAIL: gdb.base/command-line-input.exp: print 1"
# Due to using old python, 2.6.
# For instance, "ValueError: zero length field name in format".
"FAIL: gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp: print test"
"FAIL: gdb.python/py-breakpoint.exp: test_bkpt_address: python gdb.Breakpoint\(" *{}".format\(str\(main_addr\)\)\)"
"FAIL: gdb.python/py-framefilter.exp: info frame filter after disable frame filter"
"FAIL: gdb.python/py-framefilter.exp: info frame filter after reenabling frame filter"
"FAIL: gdb.python/py-framefilter.exp: info frame filter after setting priority"
"FAIL: gdb.python/py-framefilter.exp: info frame filter before disable frame filter"
"FAIL: gdb.python/py-framefilter.exp: info frame filter before setting priority"
"FAIL: gdb.python/py-mi.exp: check tsrvw expression value \(unexpected output\)"
"FAIL: gdb.python/py-mi.exp: check tsrvw varobj value \(unexpected output\)"
"FAIL: gdb.python/py-mi.exp: create tsrvw varobj \(unexpected output\)"
"FAIL: gdb.python/py-prettyprint.exp: c\+\+: print tsrvw"
"FAIL: gdb.python/py-prettyprint.exp: c: print tsrvw"
"FAIL: gdb.python/py-value.exp: attempt to construct large value with small buffer"
"FAIL: gdb.python/py-value.exp: construct array value from buffer"
"FAIL: gdb.python/py-value.exp: construct value from buffer"
"FAIL: gdb.python/py-value.exp: print array value"
"FAIL: gdb.python/py-value.exp: print first array element"
"FAIL: gdb.python/py-value.exp: print out of bounds array element"
"FAIL: gdb.python/py-value.exp: print second array element"
"FAIL: gdb.python/py-value.exp: print third array element"
# To be investigated.
"FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r"
"FAIL: gdb.python/py-framefilter-thread.exp: bt no-filters"
# Gdb runs out of virtual memory, we can expect an internal error.
"FAIL: gdb.base/gcore-excessive-memory.exp: attach \(GDB internal error\)"
# https://sourceware.org/bugzilla/show_bug.cgi?id=30154
"FAIL: gdb.multi/multi-target-no-resumed.exp: inf_A=.: inf_B=.: send_gdb control C \(timeout\)"
# FAILs for SLE-11 are not very interesting. This is with on old compiler:
# 4.3.4, and tests are likely to be broken. We're really only interested in
# segmentation faults and internal errors.
"FAIL: "
)