Sync from SUSE:SLFO:Main gdb revision 3f92f2fdda83ad5ab43bdecff7dbb9dd

This commit is contained in:
2025-05-30 17:04:49 +02:00
parent 6efde559c9
commit 3c43a04cdc
91 changed files with 1778 additions and 17700 deletions

View File

@@ -1,7 +1,7 @@
From 29b185c531fcd933da62142debcb088321be7c4c Mon Sep 17 00:00:00 2001
From 60f9e60b8d92e20277026ee4ad5fdc71b2bbe09d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 15 Jan 2025 17:02:00 +0100
Subject: [PATCH 24/46] Add gdbarch_dwarf2_reg_piece_offset hook
Subject: [PATCH] [gdb] Add gdbarch_dwarf2_reg_piece_offset hook
In rw_pieced_value, when reading/writing part of a register, DW_OP_piece and
DW_OP_bit_piece are handled the same, but the standard tells us:
@@ -23,14 +23,14 @@ Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/dwarf2/expr.c | 31 +++++++++++++++++++++++++------
gdb/findvar.c | 18 ++++++++++++++++++
gdb/gdbarch-gen.c | 22 ++++++++++++++++++++++
gdb/gdbarch-gen.h | 8 ++++++++
gdb/gdbarch.c | 22 ++++++++++++++++++++++
gdb/gdbarch_components.py | 16 ++++++++++++++++
gdb/value.h | 2 ++
6 files changed, 91 insertions(+), 6 deletions(-)
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 03107f90575..ece713ee7cd 100644
index 2a1b85147d3..ee1522b7437 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -211,14 +211,33 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
@@ -74,7 +74,7 @@ index 03107f90575..ece713ee7cd 100644
this_size = bits_to_bytes (bits_to_skip, this_size_bits);
buffer.resize (this_size);
diff --git a/gdb/findvar.c b/gdb/findvar.c
index df4ab1a28b9..3b20974474a 100644
index f7760aa61ca..1a9d2bedfc2 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -541,6 +541,24 @@ default_value_from_register (gdbarch *gdbarch, type *type, int regnum,
@@ -102,29 +102,10 @@ index df4ab1a28b9..3b20974474a 100644
/* VALUE must be an lval_register value. If regnum is the value's
associated register number, and len the length of the value's type,
read one or more registers in VALUE's frame, starting with register REGNUM,
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index b982fd7cd09..2e20a9dbccd 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -430,6 +430,14 @@ typedef struct value * (gdbarch_value_from_register_ftype) (struct gdbarch *gdba
extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, const frame_info_ptr &this_frame);
extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
+/* For a DW_OP_piece located in a register, but not occupying the
+ entire register, return the placement of the piece within that
+ register as defined by the ABI. */
+
+typedef ULONGEST (gdbarch_dwarf2_reg_piece_offset_ftype) (struct gdbarch *gdbarch, int regnum, ULONGEST size);
+extern ULONGEST gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, int regnum, ULONGEST size);
+extern void set_gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_piece_offset_ftype *dwarf2_reg_piece_offset);
+
typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 58e9ebbdc59..ed5b5859277 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index efc784c2311..8137ece78bc 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -109,6 +109,7 @@ struct gdbarch
gdbarch_register_to_value_ftype *register_to_value = nullptr;
gdbarch_value_to_register_ftype *value_to_register = nullptr;
@@ -133,15 +114,15 @@ index 58e9ebbdc59..ed5b5859277 100644
gdbarch_pointer_to_address_ftype *pointer_to_address = unsigned_pointer_to_address;
gdbarch_address_to_pointer_ftype *address_to_pointer = unsigned_address_to_pointer;
gdbarch_integer_to_address_ftype *integer_to_address = nullptr;
@@ -371,6 +372,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of value_from_register, invalid_p == 0 */
/* Skip verify of pointer_to_address, invalid_p == 0 */
/* Skip verify of address_to_pointer, invalid_p == 0 */
@@ -372,6 +373,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of register_to_value, invalid_p == 0. */
/* Skip verify of value_to_register, invalid_p == 0. */
/* Skip verify of value_from_register, invalid_p == 0. */
+ /* Skip verify of dwarf2_reg_piece_offset, invalid_p == 0. */
/* Skip verify of pointer_to_address, invalid_p == 0. */
/* Skip verify of address_to_pointer, invalid_p == 0. */
/* Skip verify of integer_to_address, has predicate. */
/* Skip verify of return_value, invalid_p == 0 */
if ((gdbarch->return_value_as_value == default_gdbarch_return_value) == (gdbarch->return_value == nullptr))
@@ -783,6 +785,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
@@ -789,6 +791,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
gdb_printf (file,
"gdbarch_dump: value_from_register = <%s>\n",
host_address_to_string (gdbarch->value_from_register));
@@ -151,7 +132,7 @@ index 58e9ebbdc59..ed5b5859277 100644
gdb_printf (file,
"gdbarch_dump: pointer_to_address = <%s>\n",
host_address_to_string (gdbarch->pointer_to_address));
@@ -2573,6 +2578,23 @@ set_gdbarch_value_from_register (struct gdbarch *gdbarch,
@@ -2588,6 +2593,23 @@ set_gdbarch_value_from_register (struct gdbarch *gdbarch,
gdbarch->value_from_register = value_from_register;
}
@@ -175,8 +156,27 @@ index 58e9ebbdc59..ed5b5859277 100644
CORE_ADDR
gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
{
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 9627f6d6a9f..abffcf99fac 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -430,6 +430,14 @@ typedef struct value * (gdbarch_value_from_register_ftype) (struct gdbarch *gdba
extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, const frame_info_ptr &this_frame);
extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
+/* For a DW_OP_piece located in a register, but not occupying the
+ entire register, return the placement of the piece within that
+ register as defined by the ABI. */
+
+typedef ULONGEST (gdbarch_dwarf2_reg_piece_offset_ftype) (struct gdbarch *gdbarch, int regnum, ULONGEST size);
+extern ULONGEST gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, int regnum, ULONGEST size);
+extern void set_gdbarch_dwarf2_reg_piece_offset (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_piece_offset_ftype *dwarf2_reg_piece_offset);
+
typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 4006380076d..4a228b5d27c 100644
index f9c18365add..2d528de2c56 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -829,6 +829,22 @@ allocate and return a struct value with all value attributes
@@ -203,7 +203,7 @@ index 4006380076d..4a228b5d27c 100644
type="CORE_ADDR",
name="pointer_to_address",
diff --git a/gdb/value.h b/gdb/value.h
index 9d7e88d9433..47df66e0961 100644
index 2c94e09cbf3..8e5fd5403cc 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1128,6 +1128,8 @@ extern value *default_value_from_register (gdbarch *gdbarch, type *type,
@@ -215,6 +215,8 @@ index 9d7e88d9433..47df66e0961 100644
extern struct value *value_from_register (struct type *type, int regnum,
const frame_info_ptr &frame);
base-commit: 82b53ea8aa8bb7fa481e742d5050e0adef8b2d58
--
2.43.0

View File

@@ -1,97 +0,0 @@
From 6775ce3f5e936a50d883abfb60cafa80f8b76cf6 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 10 Dec 2024 11:53:31 +0100
Subject: [PATCH 19/46] Fix gdb.dap/step-out.exp on s390x
With test-case gdb.dap/step-out.exp on s390x-linux, I get:
...
>>> {"seq": 7, "type": "request", "command": "scopes", "arguments": {"frameId": 0}}
Content-Length: 569^M
^M
{"request_seq": 7, "type": "response", "command": "scopes", "body": {"scopes": [{"variablesReference": 1, "name": "Locals", "presentationHint": "locals", "expensive": false, "namedVariables": 1, "line": 35, "source": {"name": "step-out.c", "path": "/home/vries/gdb/src/gdb/testsuite/gdb.dap/step-out.c"}}, {"variablesReference": 2, "name": "Registers", "presentationHint": "registers", "expensive": false, "namedVariables": 114, "line": 35, "source": {"name": "step-out.c", "path": "/home/vries/gdb/src/gdb/testsuite/gdb.dap/step-out.c"}}]}, "success": true, "seq": 21}PASS: gdb.dap/step-out.exp: get scopes success
FAIL: gdb.dap/step-out.exp: three scopes
...
The problem is that the test-case expects three scopes:
...
lassign $scopes scope reg_scope return_scope
...
but the return_scope is missing because this doesn't work:
...
$ gdb -q -batch outputs/gdb.dap/step-out/step-out \
-ex "b function_breakpoint_here" \
-ex run \
-ex finish
...
Value returned has type: struct result. Cannot determine contents
...
This is likely caused by a problem in gdb, but there's nothing wrong the DAP
support.
Fix this by:
- allowing two scopes, and
- declaring the tests of return_scope unsupported.
Tested on s390x-linux.
Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/testsuite/gdb.dap/step-out.exp | 42 ++++++++++++++++--------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/gdb/testsuite/gdb.dap/step-out.exp b/gdb/testsuite/gdb.dap/step-out.exp
index 757f4ebdaca..491eaf71197 100644
--- a/gdb/testsuite/gdb.dap/step-out.exp
+++ b/gdb/testsuite/gdb.dap/step-out.exp
@@ -59,24 +59,28 @@ set scopes [dap_check_request_and_response "get scopes" scopes \
[format {o frameId [i %d]} $frame_id]]
set scopes [dict get [lindex $scopes 0] body scopes]
-gdb_assert {[llength $scopes] == 2} "two scopes"
-
-lassign $scopes scope reg_scope
-gdb_assert {[dict get $scope name] == "Locals"} "scope is locals"
-gdb_assert {[dict get $scope presentationHint] == "locals"} \
- "locals presentation hint"
-gdb_assert {[dict get $scope namedVariables] == 2} "two vars in scope"
-
-set num [dict get $scope variablesReference]
-set refs [lindex [dap_check_request_and_response "fetch arguments" \
- "variables" \
- [format {o variablesReference [i %d]} $num]] \
- 0]
-set varlist [lindex [dict get $refs body variables] 0]
-
-gdb_assert {[dict get $varlist variablesReference] > 0} \
- "variable has children"
-gdb_assert {[dict get $varlist name] == "(return)"} \
- "variable is return value"
+gdb_assert {[llength $scopes] == 2 || [llength $scopes] == 3} "two or three scopes"
+lassign $scopes scope reg_scope return_scope
+
+set test "scope is locals"
+if { $return_scope == "" } {
+ unsupported $test
+} else {
+ gdb_assert {[dict get $scope presentationHint] == "locals"} \
+ "locals presentation hint"
+ gdb_assert {[dict get $scope namedVariables] == 2} "two vars in scope"
+
+ set num [dict get $scope variablesReference]
+ set refs [lindex [dap_check_request_and_response "fetch arguments" \
+ "variables" \
+ [format {o variablesReference [i %d]} $num]] \
+ 0]
+ set varlist [lindex [dict get $refs body variables] 0]
+
+ gdb_assert {[dict get $varlist variablesReference] > 0} \
+ "variable has children"
+ gdb_assert {[dict get $varlist name] == "(return)"} \
+ "variable is return value"
+}
dap_shutdown
--
2.43.0

View File

@@ -1,56 +0,0 @@
From 2ccefe53891d9c1393853f5179f8e8046c95a6ce Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 19 Jun 2024 10:04:22 +0200
Subject: [PATCH 17/46] Fix gdb.dwarf2/shortpiece.exp on s390x
On s390x-linux, I run into:
...
(gdb) p (short []) s1^M
$3 = {0, 1, 0, <optimized out>}^M
(gdb) FAIL: gdb.dwarf2/shortpiece.exp: p (short []) s1
...
while this is expected:
...
(gdb) p (short []) s1^M
$3 = {1, 0, 0, <optimized out>}^M
(gdb) PASS: gdb.dwarf2/shortpiece.exp: p (short []) s1
...
The type of s1 is:
...
(gdb) ptype s1
type = struct S {
myint a;
myushort b;
}
...
so the difference is due the fact that viewing an int as two shorts gives
different results depending on the endianness.
Fix this by allowing both results.
Tested on x86_64-linux and s390x-linux.
Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/testsuite/gdb.dwarf2/shortpiece.exp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dwarf2/shortpiece.exp b/gdb/testsuite/gdb.dwarf2/shortpiece.exp
index f7ff805de7c..4fcdfcae57a 100644
--- a/gdb/testsuite/gdb.dwarf2/shortpiece.exp
+++ b/gdb/testsuite/gdb.dwarf2/shortpiece.exp
@@ -138,7 +138,9 @@ gdb_test "p s2" \
# This test verifies that GDB can print a pieced value casted to a
# different type.
gdb_test "p (int \[\]) s1" " = \\{1, <optimized out>\\}"
-gdb_test "p (short \[\]) s1" " = \\{1, 0, 0, <optimized out>\\}"
+set re_little [string_to_regexp "{1, 0, 0, <optimized out>}"]
+set re_big [string_to_regexp "{0, 1, 0, <optimized out>}"]
+gdb_test {p (short []) s1} " = ($re_little|$re_big)"
# Test for correct output if the size of the original object is not a
# multiple of the array's element size.
--
2.43.0

View File

@@ -1,25 +0,0 @@
From 388654c78086e5240fec47260e47d1deff4af43d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 6 Feb 2025 13:27:57 +0100
Subject: [PATCH 43/46] fixup-gdb-6.5-gcore-buffer-limit-test.patch
---
gdb/testsuite/gdb.base/gcore-excessive-memory.exp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
index 31cf88ce78a..1ef595923ad 100644
--- a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
@@ -14,6 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+require can_spawn_for_attach
+
if {[use_gdb_stub]} {
untested "skipping test because of use_gdb_stub"
return -1
--
2.43.0

View File

@@ -1,23 +1,26 @@
From a7d9abecbc24e3d68746ea5b905eba11913980e1 Mon Sep 17 00:00:00 2001
From 58f16ab37bf553b15bcd2a7582f7d662a3816407 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 25 Mar 2025 17:15:01 +0100
Subject: [PATCH 2/2] fixup-gdb-add-rpm-suggestion-script.patch
Subject: [PATCH 11/56] fixup-gdb-add-rpm-suggestion-script.patch
---
gdb/python/lib/gdb/command/rpm-suggestions.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
gdb/python/lib/gdb/command/rpm-suggestions.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/command/rpm-suggestions.py
index bb049bc66e7..066ce98d947 100644
index bcae2ba2fd7..6c550bed448 100644
--- a/gdb/python/lib/gdb/command/rpm-suggestions.py
+++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
@@ -510,8 +510,7 @@ class rpm_suggestion_build_id_mode(gdb.Parameter):
@@ -503,8 +503,11 @@ class rpm_suggestion_build_id_mode(gdb.Parameter):
# The 'info rpm-suggestions' command.
class rpm_suggestion_info(gdb.Command):
- """Relist any RPM installation suggestions that have been made
- since the executable was last changed."""
+ """Relist any RPM installation suggestions that have been made since the executable was last changed."""
+ """Relist RPM installation suggestions.
+
+ Relist any RPM installation suggestions that have been made
since the executable was last changed."""
+
def __init__(self):
super().__init__("info rpm-suggestions", gdb.COMMAND_NONE, gdb.COMPLETE_NONE)

BIN
gdb-15.2.tar.bz2 (Stored with Git LFS)

Binary file not shown.

BIN
gdb-16.3.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,268 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Cagney <cagney@gnu.org>
Date: Fri, 27 Oct 2017 21:07:50 +0200
Subject: gdb-6.3-gstack-20050411.patch
;; Add a wrapper script to GDB that implements pstack using the
;; --readnever option.
;;=push
2004-11-23 Andrew Cagney <cagney@redhat.com>
* Makefile.in (uninstall-gstack, install-gstack): New rules, add
to install and uninstall.
* gstack.sh, gstack.1: New files.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2071,7 +2071,7 @@ info install-info clean-info dvi install-dvi pdf install-pdf html install-html:
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
-install-only: $(CONFIG_INSTALL)
+install-only: install-gstack $(CONFIG_INSTALL)
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
@@ -2121,7 +2121,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
-uninstall: force $(CONFIG_UNINSTALL)
+GSTACK=gstack
+.PHONY: install-gstack
+install-gstack:
+ transformed_name=`t='$(program_transform_name)'; \
+ echo $(GSTACK) | sed -e "$$t"` ; \
+ if test "x$$transformed_name" = x; then \
+ transformed_name=$(GSTACK) ; \
+ else \
+ true ; \
+ fi ; \
+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
+ $(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \
+ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
+ : $(SHELL) $(srcdir)/../mkinstalldirs \
+ $(DESTDIR)$(man1dir) ; \
+ : $(INSTALL_DATA) $(srcdir)/gstack.1 \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
+
+uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
@@ -2152,6 +2170,28 @@ uninstall: force $(CONFIG_UNINSTALL)
rm -f $(DESTDIR)$(bindir)/$$transformed_name
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+.PHONY: uninstall-gstack
+uninstall-gstack:
+ transformed_name=`t='$(program_transform_name)'; \
+ echo $(GSTACK) | sed -e $$t` ; \
+ if test "x$$transformed_name" = x; then \
+ transformed_name=$(GSTACK) ; \
+ else \
+ true ; \
+ fi ; \
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
+
+# The C++ name parser can be built standalone for testing.
+test-cp-name-parser.o: cp-name-parser.c
+ $(COMPILE) -DTEST_CPNAMES cp-name-parser.c
+ $(POSTCOMPILE)
+
+test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY)
+ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) \
+ -o test-cp-name-parser$(EXEEXT) test-cp-name-parser.o \
+ $(LIBIBERTY)
+
# We do this by grepping through sources. If that turns out to be too slow,
# maybe we could just require every .o file to have an initialization routine
# of a given name (top.o -> _initialize_top, etc.).
diff --git a/gdb/gstack.sh b/gdb/gstack.sh
new file mode 100644
--- /dev/null
+++ b/gdb/gstack.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+if test $# -ne 1; then
+ echo "Usage: `basename $0 .sh` <process-id>" 1>&2
+ exit 1
+fi
+
+if test ! -r /proc/$1; then
+ echo "Process $1 not found." 1>&2
+ exit 1
+fi
+
+# GDB doesn't allow "thread apply all bt" when the process isn't
+# threaded; need to peek at the process to determine if that or the
+# simpler "bt" should be used.
+
+backtrace="bt"
+if test -d /proc/$1/task ; then
+ # Newer kernel; has a task/ directory.
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
+ backtrace="thread apply all bt"
+ fi
+elif test -f /proc/$1/maps ; then
+ # Older kernel; go by it loading libpthread.
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ backtrace="thread apply all bt"
+ fi
+fi
+
+GDB=${GDB:-gdb}
+
+# Run GDB, strip out unwanted noise.
+# --readnever is no longer used since .gdb_index is now in use.
+$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 |
+set width 0
+set height 0
+set pagination no
+$backtrace
+EOF
+/bin/sed -n \
+ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.c
@@ -0,0 +1,43 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007, 2008, 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/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+void
+func (void)
+{
+ const char msg[] = "looping\n";
+
+ /* Use the most simple notification not to get caught by attach on exiting
+ the function. */
+ write (1, msg, strlen (msg));
+
+ for (;;);
+}
+
+int
+main (void)
+{
+ alarm (60);
+ nice (100);
+
+ func ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gstack.exp
@@ -0,0 +1,84 @@
+# Copyright (C) 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/>.
+
+set testfile gstack
+set executable ${testfile}
+set binfile [standard_output_file $executable]
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
+ return -1
+}
+
+set test "spawn inferior"
+set command "${binfile}"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+ return
+}
+
+# The spawn id of the test inferior.
+set test_spawn_id $res
+
+set use_gdb_stub 1
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "looping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ return
+ }
+}
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
+
+set test "spawn gstack"
+set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $GDB_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+}
+
+set gdb_spawn_id $res
+
+gdb_test_multiple "" $test {
+ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
+ pass $test
+ }
+}
+
+gdb_test_multiple "" "gstack exits" {
+ eof {
+ set result [wait -i $gdb_spawn_id]
+ verbose $result
+
+ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error"
+ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0"
+
+ remote_close host
+ clear_gdb_spawn_id
+ }
+}
+
+# Kill the test inferior.
+kill_wait_spawned_process $test_spawn_id

View File

@@ -1,107 +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-bz218379-ppc-solib-trampoline-test.patch
;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
;;=fedoratest
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.c
@@ -0,0 +1,28 @@
+/* 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 <stdio.h>
+
+int main (void)
+{
+ puts ("hello world");
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp
@@ -0,0 +1,59 @@
+# 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 {[use_gdb_stub]} {
+ untested "skipping test because of use_gdb_stub"
+ return -1
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile step-over-trampoline
+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}
+
+# For C programs, "start" should stop in main().
+
+gdb_test "start" \
+ "main \\(\\) at .*$srcfile.*" \
+ "start"
+
+# main () at hello2.c:5
+# 5 puts("hello world\n");
+# (gdb) next
+# 0x100007e0 in call___do_global_ctors_aux ()
+
+gdb_test_multiple "next" "invalid `next' output" {
+ -re "\nhello world.*return 0;.*" {
+ pass "stepped over"
+ }
+ -re " in call___do_global_ctors_aux \\(\\).*" {
+ fail "stepped into trampoline"
+ }
+}

View File

@@ -1,154 +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-gcore-buffer-limit-test.patch
;; Test gcore memory and time requirements for large inferiors.
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.c b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.c
@@ -0,0 +1,37 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2008 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>
+#include <stdlib.h>
+
+#define MEGS 64
+
+int main()
+{
+ void *mem;
+
+ mem = malloc (MEGS * 1024ULL * 1024ULL);
+
+ for (;;)
+ sleep (1);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gcore-excessive-memory.exp b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
@@ -0,0 +1,99 @@
+# Copyright 2008 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 gcore-excessive-memory
+set srcfile ${testfile}.c
+set shfile [standard_output_file ${testfile}-gdb.sh]
+set corefile [standard_output_file ${testfile}.core]
+set binfile [standard_output_file ${testfile}]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+set f [open "|getconf PAGESIZE" "r"]
+gets $f pagesize
+close $f
+
+set pid_of_bin [eval exec $binfile &]
+sleep 2
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
+
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
+gdb_test "up 99" "in main .*" "verify we can get to main"
+
+proc memory_v_pages_get {} {
+ global pid_of_gdb pagesize
+ set fd [open "/proc/$pid_of_gdb/statm"]
+ gets $fd line
+ close $fd
+ # number of pages of virtual memory
+ scan $line "%d" drs
+ return $drs
+}
+
+set pages_found [memory_v_pages_get]
+
+# It must be definitely less than `MEGS' of `gcore-excessive-memory.c'.
+set mb_gcore_reserve 4
+verbose -log "pages_found = $pages_found, mb_gcore_reserve = $mb_gcore_reserve"
+set kb_found [expr $pages_found * $pagesize / 1024]
+set kb_permit [expr $kb_found + 1 * 1024 + $mb_gcore_reserve * 1024]
+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
+
+# Create the ulimit wrapper.
+set f [open $shfile "w"]
+puts $f "#! /bin/sh"
+puts $f "ulimit -v $kb_permit"
+puts $f "exec $GDB \"\$@\""
+close $f
+remote_exec host "chmod +x $shfile"
+
+gdb_exit
+set GDBold $GDB
+set GDB "$shfile"
+gdb_start
+set GDB $GDBold
+
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
+
+gdb_test "attach $pid_of_bin" "Attaching to .*" "attach"
+gdb_test "up 99" "in main .*" "verify we can get to main"
+
+verbose -log "kb_found before gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+gdb_test "gcore $corefile" "Saved corefile \[^\n\r\]*" "Save the core file"
+
+verbose -log "kb_found after gcore = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+# Cleanup.
+exec kill -9 $pid_of_bin

View File

@@ -1,237 +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.6-buildid-locate-tests.patch
;; Tests and test updates related to the rpm suggestion feature.
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
@@ -0,0 +1,21 @@
+/* Copyright 2010 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/>. */
+
+void
+lib (void)
+{
+}
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
@@ -0,0 +1,25 @@
+/* Copyright 2010 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/>. */
+
+extern void lib (void);
+
+int
+main (void)
+{
+ lib ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
@@ -0,0 +1,104 @@
+# 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/>.
+
+require allow_shlib_tests
+
+set testfile "gcore-buildid-exec-but-not-solib"
+set srcmainfile ${testfile}-main.c
+set srclibfile ${testfile}-lib.c
+set libfile [standard_output_file ${testfile}-lib.so]
+set objfile [standard_output_file ${testfile}-main.o]
+set executable ${testfile}-main
+set binfile [standard_output_file ${executable}]
+set gcorefile [standard_output_file ${executable}.gcore]
+set outdir [file dirname $binfile]
+
+if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
+ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
+ unsupported "-Wl,--build-id compilation failed"
+ return -1
+}
+set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
+if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
+ unsupported "-Wl,--build-id compilation failed"
+ return -1
+}
+
+clean_restart $executable
+gdb_load_shlib $libfile
+
+# Does this gdb support gcore?
+set test "help gcore"
+gdb_test_multiple $test $test {
+ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
+ # gcore command not supported -- nothing to test here.
+ unsupported "gdb does not support gcore on this target"
+ return -1;
+ }
+ -re "Save a core file .*\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+if { ![runto lib] } then {
+ return -1
+}
+
+set escapedfilename [string_to_regexp ${gcorefile}]
+
+set test "save a corefile"
+gdb_test_multiple "gcore ${gcorefile}" $test {
+ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "Can't create a corefile\r\n$gdb_prompt $" {
+ unsupported $test
+ return -1
+ }
+}
+
+# Now restart gdb and load the corefile.
+
+clean_restart $executable
+gdb_load_shlib $libfile
+
+set buildid [build_id_debug_filename_get $libfile]
+
+regsub {\.debug$} $buildid {} buildid
+
+set debugdir [standard_output_file ${testfile}-debugdir]
+file delete -force -- $debugdir
+
+file mkdir $debugdir/[file dirname $libfile]
+file copy $libfile $debugdir/${libfile}
+
+file mkdir $debugdir/[file dirname $buildid]
+file copy $libfile $debugdir/${buildid}
+
+remote_exec build "ln -s /lib ${debugdir}/"
+remote_exec build "ln -s /lib64 ${debugdir}/"
+# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
+
+gdb_test_no_output "set solib-absolute-prefix $debugdir" \
+ "set solib-absolute-prefix"
+
+gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
+
+gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
+
+gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
+
+gdb_test "bt"
+gdb_test "info shared"
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2014 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/>.
+
+# Create a core file, then hide the executable. Restart GDB and load
+# the core file. Check GDB gives a message suggesting a 'dnf' command
+# to try and install the executable based on its build-id.
+
+standard_testfile "normal.c"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ return -1
+}
+
+# Get the build-id of the file.
+set build_id_debug_file [build_id_debug_filename_get $binfile]
+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
+
+# Run to main.
+if { ![runto_main] } {
+ return -1
+}
+
+# We first need to generate a corefile.
+set corefilename "[standard_output_file gcore.test]"
+if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } {
+ untested "could not generate a corefile"
+ return -1
+}
+
+# Move the binfile to a temporary name.
+remote_exec build "mv $binfile ${binfile}.old"
+
+# Reinitialize GDB and see if we get a dnf suggestion.
+clean_restart
+
+gdb_test "set build-id-verbose 1" "" \
+ "set build-id-verbose"
+
+# GDB only makes build-id based RPM suggestions if /usr/lib is in
+# the debug-file-directory list, the reason being that system RPMs
+# will always install under this location. If GDB is not looking
+# here then there's no point making suggestions.
+gdb_test "set debug-file-directory /usr/lib/" "" \
+ "set debug-file-directory"
+
+gdb_test "core-file [standard_output_file gcore.test]" \
+ "Missing file\\(s\\), try: dnf --enablerepo='\\*debug\\*' install [string_to_regexp /usr/lib/$build_id_without_debug] [string_to_regexp /usr/lib/debug/$build_id_debug_file]" \
+ "test first yum/dnf warning"

View File

@@ -1,278 +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.6-bz237572-ppc-atomic-sequence-test.patch
;; Support for stepping over PPC atomic instruction sequences (BZ 237572).
;;=fedoratest
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/atomic-seq-threaded.c,
gdb.threads/atomic-seq-threaded.exp: New files.
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
@@ -0,0 +1,171 @@
+/* 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., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* Test stepping over RISC atomic sequences.
+ This variant testcases the code for stepping another thread while skipping
+ over the atomic sequence in the former thread
+ (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
+ Code comes from gcc/testsuite/gcc.dg/sync-2.c */
+
+/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
+
+/* Test functionality of the intrinsics for 'short' and 'char'. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+#define LOOPS 2
+
+static int unused;
+
+static char AI[18];
+static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
+static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
+
+static void
+do_qi (void)
+{
+ if (__sync_fetch_and_add(AI+4, 1) != 0)
+ abort ();
+ if (__sync_fetch_and_add(AI+5, 4) != 0)
+ abort ();
+ if (__sync_fetch_and_add(AI+6, 22) != 0)
+ abort ();
+ if (__sync_fetch_and_sub(AI+7, 12) != 0)
+ abort ();
+ if (__sync_fetch_and_and(AI+8, 7) != (char)-1)
+ abort ();
+ if (__sync_fetch_and_or(AI+9, 8) != 0)
+ abort ();
+ if (__sync_fetch_and_xor(AI+10, 9) != 0)
+ abort ();
+ if (__sync_fetch_and_nand(AI+11, 7) != 0)
+ abort ();
+
+ if (__sync_add_and_fetch(AI+12, 1) != 1)
+ abort ();
+ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12)
+ abort ();
+ if (__sync_and_and_fetch(AI+14, 7) != 7)
+ abort ();
+ if (__sync_or_and_fetch(AI+15, 8) != 8)
+ abort ();
+ if (__sync_xor_and_fetch(AI+16, 9) != 9)
+ abort ();
+ if (__sync_nand_and_fetch(AI+17, 7) != 7)
+ abort ();
+}
+
+static short AL[18];
+static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
+static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
+
+static void
+do_hi (void)
+{
+ if (__sync_fetch_and_add(AL+4, 1) != 0)
+ abort ();
+ if (__sync_fetch_and_add(AL+5, 4) != 0)
+ abort ();
+ if (__sync_fetch_and_add(AL+6, 22) != 0)
+ abort ();
+ if (__sync_fetch_and_sub(AL+7, 12) != 0)
+ abort ();
+ if (__sync_fetch_and_and(AL+8, 7) != -1)
+ abort ();
+ if (__sync_fetch_and_or(AL+9, 8) != 0)
+ abort ();
+ if (__sync_fetch_and_xor(AL+10, 9) != 0)
+ abort ();
+ if (__sync_fetch_and_nand(AL+11, 7) != 0)
+ abort ();
+
+ if (__sync_add_and_fetch(AL+12, 1) != 1)
+ abort ();
+ if (__sync_sub_and_fetch(AL+13, 12) != -12)
+ abort ();
+ if (__sync_and_and_fetch(AL+14, 7) != 7)
+ abort ();
+ if (__sync_or_and_fetch(AL+15, 8) != 8)
+ abort ();
+ if (__sync_xor_and_fetch(AL+16, 9) != 9)
+ abort ();
+ if (__sync_nand_and_fetch(AL+17, 7) != 7)
+ abort ();
+}
+
+static void *
+start1 (void *arg)
+{
+ unsigned loop;
+ sleep(1);
+
+ for (loop = 0; loop < LOOPS; loop++)
+ {
+ memcpy(AI, init_qi, sizeof(init_qi));
+
+ do_qi ();
+
+ if (memcmp (AI, test_qi, sizeof(test_qi)))
+ abort ();
+ }
+
+ return arg; /* _delete1_ */
+}
+
+static void *
+start2 (void *arg)
+{
+ unsigned loop;
+
+ for (loop = 0; loop < LOOPS; loop++)
+ {
+ memcpy(AL, init_hi, sizeof(init_hi));
+
+ do_hi ();
+
+ if (memcmp (AL, test_hi, sizeof(test_hi)))
+ abort ();
+ }
+
+ return arg; /* _delete2_ */
+}
+
+int
+main (int argc, char **argv)
+{
+ pthread_t thread;
+ int i;
+
+ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */
+ assert (i == 0); /* _create_after_ */
+
+ sleep (1);
+
+ start2 (NULL);
+
+ i = pthread_join (thread, NULL); /* _delete_ */
+ assert (i == 0);
+
+ return 0; /* _exit_ */
+}
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
@@ -0,0 +1,84 @@
+# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs.
+# This variant testcases the code for stepping another thread while skipping
+# over the atomic sequence in the former thread
+# (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
+# 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 atomic-seq-threaded
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+
+foreach opts {{} {compiler=gcc4} {FAIL}} {
+ if {$opts eq "FAIL"} {
+ return -1
+ }
+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } {
+ break
+ }
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_load ${binfile}
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+}
+
+# pthread_create () will not pass even on x86_64 with software watchpoint.
+# Pass after pthread_create () without any watchpoint active.
+set line [gdb_get_line_number "_create_after_"]
+gdb_test "tbreak $line" \
+ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \
+ "set breakpoint after pthread_create ()"
+gdb_test "c" \
+ ".*/\\* _create_after_ \\*/.*" \
+ "run till after pthread_create ()"
+
+# Without a watchpoint being software no single-stepping would be used.
+set test "Start (software) watchpoint"
+gdb_test_multiple "watch unused" $test {
+ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
+ # We do not test the goal but still the whole testcase should pass.
+ unsupported $test
+ }
+}
+
+# More thorough testing of the scheduling logic.
+gdb_test "set scheduler-locking step" ""
+
+# Critical code path is stepped through at this point.
+set line [gdb_get_line_number "_exit_"]
+gdb_test "tbreak $line" \
+ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
+ "set breakpoint at _exit_"
+gdb_test "c" \
+ ".*/\\* _exit_ \\*/.*" \
+ "run till _exit_"
+
+# Just a nonproblematic program exit.
+gdb_test "c" \
+ ".*Program exited normally\\..*" \
+ "run till program exit"

View File

@@ -1,68 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Tue, 19 Nov 2024 13:56:56 +0000
Subject: gdb-add-deprecated-settings-py-script.patch
;; Not a backport. Add a new script which defines a setting which is
;; deprecated, but we don't want to remove it from Fedora GDB just yet.
gdb: add script which defines a deprecated settings
The build-id-core-load setting has not been useful since 2020, but its
not clear when it will be OK to remove this from GDB.
Rather than defining this setting in C++ code, lets just create it
using this Python script, this helps keep the Fedora stuff out of core
GDB.
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -86,6 +86,7 @@ PYTHON_FILE_LIST = \
gdb/unwinder.py \
gdb/xmethod.py \
gdb/command/__init__.py \
+ gdb/command/deprecated-settings.py \
gdb/command/explore.py \
gdb/command/frame_filters.py \
gdb/command/missing_files.py \
diff --git a/gdb/python/lib/gdb/command/deprecated-settings.py b/gdb/python/lib/gdb/command/deprecated-settings.py
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/command/deprecated-settings.py
@@ -0,0 +1,35 @@
+import gdb
+
+# This setting was added to Fedora GDB back in 2007. It controlled
+# whether GDB would use the build-id extracted from a core file to
+# auto-load the executable if the user had not already loaded an
+# executable.
+#
+# In 2020 this setting was effectively deprecated as the only use of
+# the setting's value was removed. After this GDB would always
+# auto-load an executable based on the build-id if no executable was
+# already loaded.
+#
+# For now we maintain this setting for backward compatibility reasons.
+
+class build_id_core_load(gdb.Parameter):
+ """This setting is deprecated. Changing it will have no effect.
+ This is maintained only for backwards compatibility.
+
+ When opening a core-file, and no executable is loaded, GDB will
+ always try to auto-load a suitable executable using the build-id
+ extracted from the core file (if a suitable build-id can be
+ found)."""
+
+ def __init__(self):
+ self.set_doc = "This setting is deprecated and has no effect."
+ self.show_doc = "This setting is deprecated and has no effect."
+ self.value = True
+
+ super().__init__("build-id-core-load", gdb.COMMAND_DATA, gdb.PARAM_BOOLEAN)
+ def validate(self):
+ return True
+ def get_set_string(self):
+ raise gdb.GdbError("The 'build-id-core-load' setting is deprecated.")
+
+build_id_core_load()

View File

@@ -1,18 +1,166 @@
From 423c53757e2fe22815fef8a04abf21caff951937 Mon Sep 17 00:00:00 2001
From 15d2ec49a716e217a031786034596fd0f0face6c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 25 Mar 2025 14:12:51 +0100
Subject: [PATCH 1/4] [distro] Update gdb-add-rpm-suggestion-script.patch for
SUSE
Subject: [PATCH 018/110] Update gdb-add-rpm-suggestion-script.patch for SUSE
---
gdb/python/lib/gdb/command/rpm-suggestions.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
gdb/doc/gdb.texinfo | 126 +++++++++---------
gdb/python/lib/gdb/command/rpm-suggestions.py | 12 +-
2 files changed, 74 insertions(+), 64 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e9202b85f90..d7d8c772c35 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -50355,15 +50355,19 @@ a hint before the next prompt is displayed:
@smallexample
(@value{GDBP}) file /bin/ls
Reading symbols from /bin/ls...
-Reading symbols from .gnu_debugdata for /usr/bin/ls...
-(No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
-Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
+@c Reading symbols from .gnu_debugdata for /usr/bin/ls...
+@c (No debugging symbols found in .gnu_debugdata for /usr/bin/ls)
+@c Missing rpms, try: dnf --enablerepo='*debug*' install coreutils-debuginfo-9.3-7.fc39.x86_64
+(No debugging symbols found in /bin/ls)
+Missing separate debuginfos, use: zypper install coreutils-debuginfo-8.32-150400.9.6.1.x86_64
(@value{GDBP})
@end smallexample
-In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
-will provide the missing debug information for @file{/bin/ls}. It is
-up to you to install the suggested package, if possible, and after
+@c In this case, installing @file{coreutils-debuginfo-9.3-7.fc39.x86_64}
+@c will provide the missing debug information for @file{/bin/ls}.
+In this case, installing @file{coreutils-debuginfo-8.32-150400.9.6.1.x86_64}
+will provide the missing debug information for @file{/bin/ls}.
+It is up to you to install the suggested package, if possible, and after
that reload the executable in @value{GDBN} so that the newly installed
debug information can be found.
@@ -50379,62 +50383,62 @@ When @samp{on} @value{GDBN} will make RPM suggestions where possible.
When @samp{off} all RPM suggestion will be disabled.
@end table
-When opening a core file (@pxref{core-file command}), it may be the
-case that not only is the debug information missing, but the
-corresponding executable itself is missing. For example, if a core
-file is copied from one machine to another in order to debug.
+@c When opening a core file (@pxref{core-file command}), it may be the
+@c case that not only is the debug information missing, but the
+@c corresponding executable itself is missing. For example, if a core
+@c file is copied from one machine to another in order to debug.
+
+@c In this case @value{GDBN} is able to suggest a command which will
+@c install the missing executable based on the build-id of the
+@c executable. For example:
+
+@c @smallexample
+@c (@value{GDBP}) core-file /tmp/core.5489
+@c warning: Can't open file /usr/bin/sl during file-backed mapping note processing
+@c [New LWP 5489]
+@c Core was generated by `sl'.
+@c Program terminated with signal SIGQUIT, Quit.
+@c #0 0x00007f1b41ced1a7 in ?? ()
+@c Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d7@c 0cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
+@c (@value{GDBP})
+@c @end smallexample
+
+@c The core file was generated from the @file{/usr/bin/sl} binary, which
+@c is not present on the machine opening the core file. @value{GDBN} has
+@c suggested a command, based on the build-id of the binary, which was
+@c extracted from the core file, that would install both the missing
+@c binary, and the corresponding debug information.
+
+@c Unfortunately, @value{GDBN} doesn't know if the suggested command will
+@c actually find a matching RPM or not. Querying the RPM database to see
+@c which packages, if any, will provide a file with the given build-id,
+@c is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
+@c the above command will succeed.
+
+@c It is possible to have @value{GDBN} check to see if there is a package
+@c available before making the suggestion, but this is significantly
+@c slower. To enable this mode use the following command:
-In this case @value{GDBN} is able to suggest a command which will
-install the missing executable based on the build-id of the
-executable. For example:
-
-@smallexample
-(@value{GDBP}) core-file /tmp/core.5489
-warning: Can't open file /usr/bin/sl during file-backed mapping note processing
-[New LWP 5489]
-Core was generated by `sl'.
-Program terminated with signal SIGQUIT, Quit.
-#0 0x00007f1b41ced1a7 in ?? ()
-Missing file(s), try: dnf --enablerepo='*debug*' install /usr/lib/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3 /usr/lib/debug/.build-id/33/2f1a8e56693960e3beb2d70cd79ddfec451cc3.debug
-(@value{GDBP})
-@end smallexample
-
-The core file was generated from the @file{/usr/bin/sl} binary, which
-is not present on the machine opening the core file. @value{GDBN} has
-suggested a command, based on the build-id of the binary, which was
-extracted from the core file, that would install both the missing
-binary, and the corresponding debug information.
-
-Unfortunately, @value{GDBN} doesn't know if the suggested command will
-actually find a matching RPM or not. Querying the RPM database to see
-which packages, if any, will provide a file with the given build-id,
-is rather slow. As @file{/usr/bin/sl} is available in an RPM, then
-the above command will succeed.
-
-It is possible to have @value{GDBN} check to see if there is a package
-available before making the suggestion, but this is significantly
-slower. To enable this mode use the following command:
-
-@table @code
-@kindex set rpm-suggestion build-id-mode
-@kindex show rpm-suggestion build-id-mode
-@cindex rpm suggestions, build-id-mode
-@item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
-@itemx show rpm-suggestion build-id-mode
-When set to @samp{fast}, which is the default, @value{GDBN} will offer
-suggestions based on the build-id of any missing executables or shared
-libraries while opening a core file. This is fast, but @value{GDBN}
-has not checked if there is a package available that can supply the
-required file, so running the suggested command might not install any
-packages.
-
-When set to @samp{slow}, each time @value{GDBN} encounters an
-executable, or shared library, that is missing, @value{GDBN} will
-check to see if there is an RPM available that will supply the missing
-binary. If a suitable RPM is found then @value{GDBN} will offer a
-command which will install the missing RPM. If no suitable RPM is
-found then @value{GDBN} will make no suggestions.
-@end table
+@c @table @code
+@c @kindex set rpm-suggestion build-id-mode
+@c @kindex show rpm-suggestion build-id-mode
+@c @cindex rpm suggestions, build-id-mode
+@c @item set rpm-suggestion build-id-mode @r{[}fast@r{|}slow@r{]}
+@c @itemx show rpm-suggestion build-id-mode
+@c When set to @samp{fast}, which is the default, @value{GDBN} will offer
+@c suggestions based on the build-id of any missing executables or shared
+@c libraries while opening a core file. This is fast, but @value{GDBN}
+@c has not checked if there is a package available that can supply the
+@c required file, so running the suggested command might not install any
+@c packages.
+
+@c When set to @samp{slow}, each time @value{GDBN} encounters an
+@c executable, or shared library, that is missing, @value{GDBN} will
+@c check to see if there is an RPM available that will supply the missing
+@c binary. If a suitable RPM is found then @value{GDBN} will offer a
+@c command which will install the missing RPM. If no suitable RPM is
+@c found then @value{GDBN} will make no suggestions.
+@c @end table
It is possible to review all of the previous RPM suggestions that
@value{GDBN} has made using the following command:
diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/command/rpm-suggestions.py
index 156fce0672b..f1034070989 100644
index d72db9c8015..4e119bb759e 100644
--- a/gdb/python/lib/gdb/command/rpm-suggestions.py
+++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
@@ -358,7 +358,7 @@ else:
@@ -351,7 +351,7 @@ else:
# Take a non-empty list of RPM names and print a command line a
# user could run to install these RPMs.
def print_rpm_suggestions(rpm_name_list):
@@ -21,7 +169,7 @@ index 156fce0672b..f1034070989 100644
# Take a non-empty list of build-id strings and print a series of
# lines that a user could run to instll the RPMs that provide
@@ -423,7 +423,10 @@ else:
@@ -416,7 +416,10 @@ else:
# Register the missing debug and missing objfile handlers with GDB.
gdb.missing_debug.register_handler(None, RPM_MissingDebugHandler())
@@ -33,8 +181,18 @@ index 156fce0672b..f1034070989 100644
# Implement the core of 'info rpm-suggestions'. Reprint all rpm
# suggestions.
base-commit: 956ad1d51aa6e4117a98c4124bd7154a1aaeec55
@@ -518,7 +521,10 @@ class rpm_suggestion_info(gdb.Command):
rpm_suggestion_set_prefix()
rpm_suggestion_show_prefix()
param_rpm_suggestion_enabled = rpm_suggestion_enabled()
-param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
+
+# The rpm-suggestion build-id-mode is only relevant for
+# RPM_MissingObjfileHandler, which is disabled for SUSE/openSUSE.
+#param_rpm_suggestion_build_id_mode = rpm_suggestion_build_id_mode()
# Create the 'info rpm-suggestions' commands.
rpm_suggestion_info()
--
2.43.0

View File

@@ -14,7 +14,7 @@ suggests debuginfo RPMs to install.
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -91,6 +91,7 @@ PYTHON_FILE_LIST = \
@@ -92,6 +92,7 @@ PYTHON_FILE_LIST = \
gdb/command/missing_files.py \
gdb/command/pretty_printers.py \
gdb/command/prompt.py \
@@ -25,7 +25,7 @@ diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -186,6 +186,7 @@
@@ -186,6 +186,7 @@ software in general. We will miss him.
* Trace File Format:: @value{GDBN} trace file format
* Index Section Format:: .gdb_index section format
* Debuginfod:: Download debugging resources with @code{debuginfod}
@@ -33,7 +33,7 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
* Man Pages:: Manual pages
* Copying:: GNU General Public License says
how you can copy and share @value{GDBN}
@@ -50341,6 +50342,111 @@
@@ -50588,6 +50589,111 @@ Show the current verbosity setting.
@end table
@@ -149,7 +149,7 @@ diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/
new file mode 100644
--- /dev/null
+++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
@@ -0,0 +1,552 @@
@@ -0,0 +1,525 @@
+# Copyright 2023 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@@ -287,19 +287,12 @@ new file mode 100644
+
+ # Return True if rpm-suggestion is disabled for any reason.
+ def rpm_suggestion_is_disabled():
+ global param_build_id_verbose
+
+ # If /usr/lib/ is not being used to find debug information
+ # then there's no point offering any RPMs as GDB would not
+ # find the newly installed content.
+ if not using_suitable_debug_file_directory():
+ return True
+
+ # For backwards compatibility, if build-id-verbose is set to
+ # zero, then disable RPM suggestion.
+ if param_build_id_verbose.value == 0:
+ return True
+
+ # Is 'rpm-suggestion enabled' set to 'off'?
+ if not param_rpm_suggestion_enabled.value:
+ return True
@@ -682,26 +675,171 @@ new file mode 100644
+
+# Create the 'info rpm-suggestions' commands.
+rpm_suggestion_info()
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
@@ -0,0 +1,21 @@
+/* Copyright 2010 Free Software Foundation, Inc.
+
+# Create the 'build-id-verbose' parameter. This is implemented as an
+# integer for backward compatibility reasons. It would be nice to
+# convert this to a boolean, but it's not clear if that will break
+# existing users uses of this flag.
+ This file is part of GDB.
+
+class build_id_verbose(gdb.Parameter):
+ """
+ Level 0 disable printing the missing debug filesname,
+ Level 1 (default) enables printing the missing debug filenames,
+ """
+ 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.
+
+ set_doc = "Set debugging level of the build-id locator."
+ show_doc = "Show debugging level of the build-id locator."
+ 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.
+
+ def __init__(self):
+ super().__init__("build-id-verbose", gdb.COMMAND_NONE, gdb.PARAM_ZINTEGER)
+ self.value = 1
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+param_build_id_verbose = build_id_verbose()
+void
+lib (void)
+{
+}
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
@@ -0,0 +1,25 @@
+/* Copyright 2010 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/>. */
+
+extern void lib (void);
+
+int
+main (void)
+{
+ lib ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
@@ -0,0 +1,104 @@
+# 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/>.
+
+require allow_shlib_tests
+
+set testfile "gcore-buildid-exec-but-not-solib"
+set srcmainfile ${testfile}-main.c
+set srclibfile ${testfile}-lib.c
+set libfile [standard_output_file ${testfile}-lib.so]
+set objfile [standard_output_file ${testfile}-main.o]
+set executable ${testfile}-main
+set binfile [standard_output_file ${executable}]
+set gcorefile [standard_output_file ${executable}.gcore]
+set outdir [file dirname $binfile]
+
+if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
+ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
+ unsupported "-Wl,--build-id compilation failed"
+ return -1
+}
+set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
+if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
+ unsupported "-Wl,--build-id compilation failed"
+ return -1
+}
+
+clean_restart $executable
+gdb_load_shlib $libfile
+
+# Does this gdb support gcore?
+set test "help gcore"
+gdb_test_multiple $test $test {
+ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
+ # gcore command not supported -- nothing to test here.
+ unsupported "gdb does not support gcore on this target"
+ return -1;
+ }
+ -re "Save a core file .*\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+if { ![runto lib] } then {
+ return -1
+}
+
+set escapedfilename [string_to_regexp ${gcorefile}]
+
+set test "save a corefile"
+gdb_test_multiple "gcore ${gcorefile}" $test {
+ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "Can't create a corefile\r\n$gdb_prompt $" {
+ unsupported $test
+ return -1
+ }
+}
+
+# Now restart gdb and load the corefile.
+
+clean_restart $executable
+gdb_load_shlib $libfile
+
+set buildid [build_id_debug_filename_get $libfile]
+
+regsub {\.debug$} $buildid {} buildid
+
+set debugdir [standard_output_file ${testfile}-debugdir]
+file delete -force -- $debugdir
+
+file mkdir $debugdir/[file dirname $libfile]
+file copy $libfile $debugdir/${libfile}
+
+file mkdir $debugdir/[file dirname $buildid]
+file copy $libfile $debugdir/${buildid}
+
+remote_exec build "ln -s /lib ${debugdir}/"
+remote_exec build "ln -s /lib64 ${debugdir}/"
+# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
+
+gdb_test_no_output "set solib-absolute-prefix $debugdir" \
+ "set solib-absolute-prefix"
+
+gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
+
+gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
+
+gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
+
+gdb_test "bt"
+gdb_test "info shared"
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -711,10 +849,75 @@ diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base
- set common_history [list "set height 0" "set width 0"]
+ set common_history [list "set height 0" "set width 0" \
+ "set build-id-verbose 0"]
+ "set rpm-suggestion enabled off"]
set test_dir [standard_output_file history_test]
remote_exec host "mkdir -p $test_dir"
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2014 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/>.
+
+# Create a core file, then hide the executable. Restart GDB and load
+# the core file. Check GDB gives a message suggesting a 'dnf' command
+# to try and install the executable based on its build-id.
+
+standard_testfile "normal.c"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ return -1
+}
+
+# Get the build-id of the file.
+set build_id_debug_file [build_id_debug_filename_get $binfile]
+regsub -all ".debug$" $build_id_debug_file "" build_id_without_debug
+
+# Run to main.
+if { ![runto_main] } {
+ return -1
+}
+
+# We first need to generate a corefile.
+set corefilename "[standard_output_file gcore.test]"
+if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } {
+ untested "could not generate a corefile"
+ return -1
+}
+
+# Move the binfile to a temporary name.
+remote_exec build "mv $binfile ${binfile}.old"
+
+# Reinitialize GDB and see if we get a dnf suggestion.
+clean_restart
+
+gdb_test "set rpm-suggestion enabled on" "" \
+ "turn on rpm-suggestion feature"
+
+# GDB only makes build-id based RPM suggestions if /usr/lib is in
+# the debug-file-directory list, the reason being that system RPMs
+# will always install under this location. If GDB is not looking
+# here then there's no point making suggestions.
+gdb_test "set debug-file-directory /usr/lib/" "" \
+ "set debug-file-directory"
+
+gdb_test "core-file [standard_output_file gcore.test]" \
+ "Missing file\\(s\\), try: dnf --enablerepo='\\*debug\\*' install [string_to_regexp /usr/lib/$build_id_without_debug] [string_to_regexp /usr/lib/debug/$build_id_debug_file]" \
+ "test first yum/dnf warning"
diff --git a/gdb/testsuite/gdb.python/py-missing-debug.py b/gdb/testsuite/gdb.python/py-missing-debug.py
--- a/gdb/testsuite/gdb.python/py-missing-debug.py
+++ b/gdb/testsuite/gdb.python/py-missing-debug.py
@@ -754,23 +957,23 @@ diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.py b/gdb/testsuite/gdb.
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
@@ -238,7 +238,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
@@ -255,7 +255,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nx" \
"-q" \
{-iex "set height 0"} \
- {-iex "set width 0"}]]
+ {-iex "set width 0"} \
+ {-iex "set build-id-verbose 0"}]]
+ {-iex "set rpm-suggestion enabled off"}]]
# If DEBUGINFOD_URLS is set, gdb will try to download sources and
# debug info for f.i. system libraries. Prevent this.
@@ -2493,6 +2494,18 @@ proc default_gdb_start { } {
@@ -2610,6 +2611,18 @@ proc default_gdb_start { } {
}
}
+ # Turn off the missing debug info messages as the testsuite does
+ # not expect them.
+ send_gdb "set build-id-verbose 0\n"
+ send_gdb "set rpm-suggestion enabled off\n"
+ gdb_expect 10 {
+ -re "$gdb_prompt $" {
+ verbose "Disabled the missing debug info messages." 2
@@ -792,9 +995,9 @@ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
}
+ # Turn off the missing debug info messages as the testsuite does
+ # not expect them.
+ send_gdb "190-gdb-set build-id-verbose 0\n"
+ send_gdb "190-gdb-set rpm-suggestion enabled off\n"
+ gdb_expect 10 {
+ -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
+ -re ".*190-gdb-set rpm-suggestion enabled off\r\n190\\\^done\r\n$mi_gdb_prompt$" {
+ verbose "Disabled the missing debug info messages." 2
+ }
+ timeout {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
From 32a7b58de39da07e3449d90c31edb104e14480f1 Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Thu, 27 Feb 2025 11:31:02 +0000
Subject: [PATCH 2/5] gdb: block SIGTERM during fetch_inferior_event
I'm posting this as RFC. I started looking at this when I got a CI
failure email from Linaro about a regression on
gdb.base/gdb-sigerm.exp on ARM. Turns out is wasn't my fault, it's
just the precise failure point moves about, so it can look like a
regression.
After looking at it for a bit I realised this was PR gdb/31061, and
there have already been attempts to fix this over the last few years.
What I have here is different than any of the previous approaches
posted, but I'm still not entirely sure this is the right solution,
but I thought I'd share it. Might be nice to see if we can get this
fixed.
The patch might still need some cleanup, but it should be good enough
to discuss this approach.
Thanks,
Andrew
---
gdb/infrun.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 8a10119487c..cdce1c0b6c2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -78,6 +78,7 @@
#include "extension.h"
#include "disasm.h"
#include "interps.h"
+#include "gdbsupport/scoped_ignore_signal.h"
/* Prototypes for local functions */
@@ -4574,6 +4575,31 @@ infrun_quit_handler ()
}
}
+/* Block SIGTERM and then clear sync_quit_force_run. When we go out of
+ scope, restore the previous sync_quit_force_run value, and then unblock
+ signals.
+
+ This should maybe live in a support file somewhere, but it needs to see
+ sync_quit_force_run, so likely needs to live in the gdb/ directory. */
+
+struct scoped_ignore_sigterm
+{
+ scoped_ignore_sigterm ()
+ : m_old_val (sync_quit_force_run)
+ {
+ sync_quit_force_run = false;
+ }
+
+ ~scoped_ignore_sigterm ()
+ {
+ sync_quit_force_run = m_old_val;
+ }
+
+private:
+ scoped_ignore_signal<SIGTERM, false> m_ignore_signal;
+ bool m_old_val;
+};
+
/* Asynchronous version of wait_for_inferior. It is called by the
event loop whenever a change of state is detected on the file
descriptor corresponding to the target. It can be called more than
@@ -4609,6 +4635,16 @@ fetch_inferior_event ()
scoped_restore restore_quit_handler
= make_scoped_restore (&quit_handler, infrun_quit_handler);
+ /* Similar to how the above custom quit handler ignores the quit flag
+ (thus not interrupting GDB on receipt of Ctrl-C), this arranges to
+ block SIGTERM while we are handling the inferior event. Any SIGTERM
+ will be deferred until this function is done. Usually SIGTERM is
+ converted to an exception by the QUIT macro, but doing that while
+ processing an inferior event can leave the inferior in a weird state,
+ e.g. some breakpoints not removed. Deferring SIGTERM handling until
+ after this function means the event should have been fully handled. */
+ scoped_ignore_sigterm ignore_sigterm;
+
/* Make sure a SIGINT does not interrupt an extension language while
we're handling an event. That could interrupt a Python unwinder
or a Python observer or some such. A Ctrl-C should either be
--
2.43.0

View File

@@ -1,46 +0,0 @@
From c179fc89cf61d3d9c58db571d709969bfa566289 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 10 Sep 2024 10:08:29 +0200
Subject: [PATCH] [gdb/build] Fix unused var in corelow.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On x86_64-linux, with gcc 7.5.0 and CFLAGS/CXXFLAGS="-O0 -g -Wall" I ran into
a build breaker:
...
gdb/corelow.c: In member function void mapped_file_info::add(const char*, const char*, const char*, std::vector<mem_range>&&, const bfd_build_id*):
gdb/corelow.c:1822:27: error: unused variable it [-Werror=unused-variable]
const auto [it, inserted]
^
...
Fix this by dropping the variable it.
Tested on x86_64-linux.
Reviewed-By: Lancelot Six<lancelot.six@amd.com>
---
gdb/corelow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 1884075ec67..30b98c2865d 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -1872,8 +1872,8 @@ mapped_file_info::add (const char *soname,
parsed, we group the build-id information based on the file name. As
a consequence, we should see each EXPECTED_FILENAME value exactly
once. This means that each insertion should always succeed. */
- const auto [it, inserted]
- = m_filename_to_build_id_map.emplace (expected_filename, build_id);
+ const auto inserted
+ = m_filename_to_build_id_map.emplace (expected_filename, build_id).second;
gdb_assert (inserted);
/* Setup the reverse build-id to file name map. */
base-commit: a7d9abecbc24e3d68746ea5b905eba11913980e1
--
2.43.0

View File

@@ -1,575 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Wed, 14 Aug 2024 15:16:46 +0100
Subject: gdb-catchpoint-re-set.patch
;; Backport upstream commit a92e943014f to fix rhbz2304296.
gdb: implement ::re_set method for catchpoint class
It is possible to attach a condition to a catchpoint. This can't be
done when the catchpoint is created, but can be done with the
'condition' command, this is documented in the GDB manual:
You can also use the 'if' keyword with the 'watch' command. The
'catch' command does not recognize the 'if' keyword; 'condition' is the
only way to impose a further condition on a catchpoint.
A GDB crash was reported against Fedora GDB where a user had attached
a condition to a catchpoint and then restarted the inferior. When the
catchpoint was hit GDB would immediately segfault. I was able to
reproduce the failure on upstream GDB:
(gdb) file ./some/binary
(gdb) catch syscall write
(gdb) run
...
Catchpoint 1 (returned from syscall write), 0x00007ffff7b594a7 in write () from /lib64/libc.so.6
(gdb) condition 1 $_streq((char *) $rsi, "foobar") == 0
(gdb) run
...
Fatal signal: Segmentation fault
...
What happened here is that on the system in question we had debug
information available for both the main application and also for
libc.
When the condition was attached GDB was stopped inside libc and as the
debug information was available GDB found a reference to the 'char'
type (for the cast) inside libc's debug information.
When the inferior is restarted GDB discards all of the objfiles
associated with shared libraries, and this includes libc. As such the
'char' type, which is objfile owned, is discarded and the reference to
it from the catchpoint's condition expression becomes invalid.
Now, if it were a breakpoint instead of a catchpoint, what would
happen is that after the shared library objfiles had been discarded
we'd call the virtual breakpoint::re_set method on the breakpoint, and
this would update the breakpoint's condition expression. This is
because user breakpoints are actually instances of the code_breakpoint
class and the code_breakpoint::re_set method contains the code to
recompute the breakpoint's condition expression.
However, catchpoints are instances of the catchpoint class which
inherits from the base breakpoint class. The catchpoint class does
not override breakpoint::re_set, and breakpoint::re_set is empty!
The consequence of this is that catchpoint condition expressions are
never recomputed, and the dangling pointer to the now deleted, objfile
owned type 'char' is left around, and, when the catchpoint is hit, the
invalid pointer is used when GDB tries to evaluate the condition
expression.
In this commit I have implemented catchpoint::re_set. This is pretty
simple and just recomputes the condition expression as you'd expect.
If the condition doesn't evaluate then the catchpoint is marked as
disabled_by_cond.
I have also made breakpoint::re_set pure virtual. With the addition
of catchpoint::re_set every sub-class of breakpoint now implements the
::re_set method, and if new sub-classes are added in the future I
think that they _must_ implement ::re_set in order to avoid this
problem. As such falling back to an empty breakpoint::re_set doesn't
seem helpful.
For testing I have not relied on stopping in libc and having libc
debug information available, this doesn't seem like a good idea for
the GDB testsuite. Instead I create a (rather pointless) condition
check that uses a type defined only within a shared library. When the
inferior is restarted the catchpoint will temporarily be marked as
disabled_by_cond (due to the type not being available), but once the
shared library is loaded again the catchpoint will be re-enabled.
Without the fixes above then the same crashing behaviour can be
observed.
One point of note: the dangling pointer of course exposes undefined
behaviour, with no guarantee of a crash. Though a crash is what I
usually see I have see GDB throw random errors from the expression
evaluation code, and once, I saw no problem at all! If you recompile
GDB with the address sanitizer, or run under valgrind, then the bug
will be exposed every time.
After fixing this bug I checked bugzilla and found PR gdb/29960 which
is the same bug. I was able to reproduce the bug before this commit,
and after this commit GDB is no longer crashing.
Before:
(gdb) file /tmp/hello.x
Reading symbols from /tmp/hello.x...
(gdb) run
Starting program: /tmp/hello.x
Hello World
[Inferior 1 (process 1101855) exited normally]
(gdb) catch syscall 1
Catchpoint 1 (syscall 'write' [1])
(gdb) condition 1 write.fd == 1
(gdb) run
Starting program: /tmp/hello.x
Fatal signal: Segmentation fault
...
And after:
(gdb) file /tmp/hello.x
Reading symbols from /tmp/hello.x...
(gdb) run
Starting program: /tmp/hello.x
Hello World
Args: ( 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 )
[Inferior 1 (process 1102373) exited normally]
(gdb) catch syscall 1
Catchpoint 1 (syscall 'write' [1])
(gdb) condition 1 write.fd == 1
(gdb) r
Starting program: /tmp/hello.x
Error in testing condition for breakpoint 1:
Attempt to extract a component of a value that is not a structure.
Catchpoint 1 (call to syscall write), 0x00007ffff7eb94a7 in write ()
from /lib64/libc.so.6
(gdb) ptype write
type = <unknown return type> ()
(gdb)
Notice we get the error now when the condition fails to evaluate.
This seems reasonable given that 'write' will be a function, and
indeed the final 'ptype' shows that it's a function, not a struct.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29960
Reviewed-By: Tom de Vries <tdevries@suse.de>
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8146,6 +8146,60 @@ catchpoint::catchpoint (struct gdbarch *gdbarch, bool temp,
pspace = current_program_space;
}
+/* See breakpoint.h. */
+
+void
+catchpoint::re_set ()
+{
+ /* All catchpoints are associated with a specific program_space. */
+ gdb_assert (pspace != nullptr);
+
+ /* Catchpoints have a single dummy location. */
+ gdb_assert (locations ().size () == 1);
+ bp_location &bl = m_locations.front ();
+
+ if (cond_string == nullptr)
+ {
+ /* It shouldn't be possible to have a parsed condition expression
+ cached on this location if the catchpoint doesn't have a condition
+ string set. */
+ gdb_assert (bl.cond == nullptr);
+
+ /* Nothing to re-compute, and the catchpoint cannot change. */
+ return;
+ }
+
+ bool previous_disabled_by_cond = bl.disabled_by_cond;
+
+ /* Start by marking the location disabled and discarding the previously
+ computed condition expression. Now if we get an exception, even if
+ it's a quit exception, we'll leave the location disabled and there
+ will be no (possibly invalid) expression cached. */
+ bl.disabled_by_cond = true;
+ bl.cond = nullptr;
+
+ const char *s = cond_string.get ();
+ try
+ {
+ switch_to_program_space_and_thread (pspace);
+
+ bl.cond = parse_exp_1 (&s, bl.address, block_for_pc (bl.address),
+ nullptr);
+ bl.disabled_by_cond = false;
+ }
+ catch (const gdb_exception_error &e)
+ {
+ /* Any exception thrown must be from either the parse_exp_1 or
+ earlier in the try block. As such the following two asserts
+ should be true. */
+ gdb_assert (bl.disabled_by_cond);
+ gdb_assert (bl.cond == nullptr);
+ }
+
+ if (previous_disabled_by_cond != bl.disabled_by_cond)
+ notify_breakpoint_modified (this);
+}
+
/* Notify interpreters and observers that breakpoint B was created. */
static void
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -702,11 +702,10 @@ struct breakpoint : public intrusive_list_node<breakpoint>
/* Reevaluate a breakpoint. This is necessary after symbols change
(e.g., an executable or DSO was loaded, or the inferior just
- started). */
- virtual void re_set ()
- {
- /* Nothing to re-set. */
- }
+ started). This is pure virtual as, at a minimum, each sub-class must
+ recompute any cached condition expressions based off of the
+ cond_string member variable. */
+ virtual void re_set () = 0;
/* Insert the breakpoint or watchpoint or activate the catchpoint.
Return 0 for success, 1 if the breakpoint, watchpoint or
@@ -1120,6 +1119,10 @@ struct catchpoint : public breakpoint
catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string);
~catchpoint () override = 0;
+
+ /* If the catchpoint has a condition set then recompute the cached
+ expression within the single dummy location. */
+ void re_set () override;
};
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c b/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond-lib.c
@@ -0,0 +1,76 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024 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/>. */
+
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <assert.h>
+#include <stdlib.h>
+
+/* This type is used by GDB. */
+struct lib_type
+{
+ int a;
+ int b;
+ int c;
+};
+
+/* Ensure the type above is used. */
+volatile struct lib_type global_lib_object = { 1, 2, 3 };
+
+/* This pointer is checked by GDB. */
+volatile void *opaque_ptr = 0;
+
+void
+lib_func_test_syscall (void)
+{
+ puts ("Inside library\n");
+ fflush (stdout);
+}
+
+static void
+sig_handler (int signo)
+{
+ /* Nothing. */
+}
+
+void
+lib_func_test_signal (void)
+{
+ signal (SIGUSR1, sig_handler);
+
+ kill (getpid (), SIGUSR1);
+}
+
+void
+lib_func_test_fork (void)
+{
+ pid_t pid = fork ();
+ assert (pid != -1);
+
+ if (pid == 0)
+ {
+ /* Child: just exit. */
+ exit (0);
+ }
+
+ /* Parent. */
+ waitpid (pid, NULL, 0);
+}
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond.c b/gdb/testsuite/gdb.base/reset-catchpoint-cond.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond.c
@@ -0,0 +1,50 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024 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/>. */
+
+extern void lib_func_test_syscall (void);
+extern void lib_func_test_signal (void);
+extern void lib_func_test_fork (void);
+
+/* We use this to perform some filler work. */
+volatile int global_var = 0;
+
+/* Just somewhere for GDB to put a breakpoint. */
+void
+breakpt_before_exit (void)
+{
+ /* Nothing. */
+}
+
+int
+main (void)
+{
+#if defined TEST_SYSCALL
+ lib_func_test_syscall ();
+#elif defined TEST_SIGNAL
+ lib_func_test_signal ();
+#elif defined TEST_FORK
+ lib_func_test_fork ();
+#else
+# error compile with suitable -DTEST_xxx macro defined
+#endif
+
+ ++global_var;
+
+ breakpt_before_exit ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp b/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond.exp
@@ -0,0 +1,169 @@
+# Copyright 2024 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/>.
+
+# Test that the condition for a catchpoint is correctly reset after
+# shared libraries are unloaded, as happens when an inferior is
+# restarted.
+#
+# If this is not done then, when the catchpoint is hit on the second
+# run, we'll evaluate the parsed expression from the first run, which
+# might include references to types owned by the now deleted objfile
+# (for the shared library loaded in the first run).
+#
+# This scripts tests a number of different catchpoint types. Inside
+# GDB these are all sub-classes of the 'catchpoint' type, which is
+# where the fix for the above issue resides, so all catchpoint types
+# should work correctly.
+
+standard_testfile .c -lib.c
+
+set libfile $binfile-lib.so
+
+set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
+
+if {[build_executable "build shared library" $libfile $srcfile2 \
+ {debug shlib}] == -1} {
+ return
+}
+
+# Depending on whether or not libc debug info is installed, when we
+# hit a syscall catchpoint inside libc there might be a source line
+# included in the output.
+#
+# This regexp will match an optional line and can be added to the
+# expected catchpoint output to ignore the (possibly missing) source
+# line.
+set libc_src_line_re "(?:\r\n\[^\r\n\]+)?"
+
+# Check the Python bp_modified_list and then reset the list back to
+# empty. TESTNAME is just a string. BP_NUM is a list of breakpoint
+# numbers that are expected to appear (in the given order) in the
+# bp_modified_list.
+
+proc check_modified_bp_list { testname bp_num } {
+ if { [allow_python_tests] } {
+ set expected [join $bp_num ", "]
+
+ gdb_test "python print(bp_modified_list)" "\\\[$expected\\\]" \
+ $testname
+ gdb_test_no_output -nopass "python bp_modified_list=\[\]" \
+ "reset bp_modified_list after $testname"
+ }
+}
+
+# Build an executable and run tests on 'catch MODE'.
+
+proc run_test { mode } {
+ set exec_name ${::binfile}-${mode}
+
+ set macro TEST_[string toupper $mode]
+
+ if {[build_executable "build test executable" $exec_name $::srcfile \
+ [list debug shlib=$::libfile additional_flags=-D${macro}]] == -1} {
+ return
+ }
+
+ clean_restart $exec_name
+ gdb_load_shlib $::libfile
+
+ if {![runto_main]} {
+ return
+ }
+
+ if { $mode eq "syscall" } {
+ gdb_test "catch syscall write" \
+ "Catchpoint $::decimal \\(syscall 'write' \[^)\]+\\)"
+ set catch_re "call to syscall write"
+ } elseif { $mode eq "signal" } {
+ gdb_test "catch signal SIGUSR1" \
+ "Catchpoint $::decimal \\(signal SIGUSR1\\)"
+ set catch_re "signal SIGUSR1"
+ } elseif { $mode eq "fork" } {
+ gdb_test "catch fork" \
+ "Catchpoint $::decimal \\(fork\\)"
+ set catch_re "forked process $::decimal"
+ } else {
+ error "unknown mode $mode"
+ }
+ set cp_num [get_integer_valueof "\$bpnum" "*UNKNOWN*"]
+
+ gdb_breakpoint "breakpt_before_exit"
+
+ gdb_test "continue" \
+ "Catchpoint ${cp_num} \[^\r\n\]+$::libc_src_line_re"
+
+ if { [allow_python_tests] } {
+ gdb_test_no_output "source $::pyfile" "import python scripts"
+ check_modified_bp_list \
+ "check b/p modified observer has not yet triggered" {}
+ }
+
+ with_test_prefix "with false condition" {
+ gdb_test_no_output "condition $cp_num ((struct lib_type *) opaque_ptr) != 0" \
+ "set catchpoint condition"
+
+ check_modified_bp_list \
+ "catchpoint modified once by setting condition" \
+ [list $cp_num]
+
+ gdb_run_cmd
+ gdb_test "" [multi_line \
+ "Breakpoint $::decimal, main \\(\\) \[^\r\n\]+" \
+ "$::decimal\\s+\[^\r\n\]+"]
+
+ check_modified_bp_list "catchpoint modified twice at startup" \
+ [list $cp_num $cp_num "$::decimal"]
+
+ gdb_test "continue" \
+ [multi_line \
+ "Breakpoint $::decimal, breakpt_before_exit \\(\\) at \[^\r\n\]+" \
+ "$::decimal\\s+\[^\r\n\]+"] \
+ "continue to breakpt_before_exit"
+ }
+
+ # Check the bp_modified_list against '.*'. We don't care at this
+ # point what's in the list (nothing relevant has happened since we
+ # last checked), but this has the side effect of clearing the list.
+ check_modified_bp_list "clear bp modified list" { .* }
+
+ with_test_prefix "with true condition" {
+ gdb_test_no_output "condition $cp_num ((struct lib_type *) opaque_ptr) == 0" \
+ "set catchpoint condition"
+
+ check_modified_bp_list \
+ "catchpoint modified once by setting condition" \
+ [list $cp_num]
+
+ gdb_run_cmd
+ gdb_test "" [multi_line \
+ "Breakpoint $::decimal, main \\(\\) \[^\r\n\]+" \
+ "$::decimal\\s+\[^\r\n\]+"]
+
+ check_modified_bp_list "catchpoint modified twice at startup" \
+ [list $cp_num $cp_num "$::decimal"]
+
+ gdb_test "continue" \
+ "Catchpoint $cp_num \\($catch_re\\), \[^\r\n\]+$::libc_src_line_re" \
+ "continue until catchpoint hit"
+
+ check_modified_bp_list "catchpoint modified again when hit" \
+ [list $cp_num]
+ }
+}
+
+# Run the tests.
+foreach_with_prefix mode { syscall signal fork } {
+ run_test $mode
+}
diff --git a/gdb/testsuite/gdb.base/reset-catchpoint-cond.py b/gdb/testsuite/gdb.base/reset-catchpoint-cond.py
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/reset-catchpoint-cond.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2024 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/>.
+
+bp_modified_list = []
+
+def bp_modified(bp):
+ bp_modified_list.append (bp.number)
+
+gdb.events.breakpoint_modified.connect(bp_modified)

View File

@@ -1,9 +1,7 @@
From 0bb6f49bb9ad577667075550ca2ad4cb49931078 Mon Sep 17 00:00:00 2001
From 6634dd948f02d1f7bd5c0a952899620276b1c260 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 18 Apr 2024 14:27:04 +0200
Subject: [PATCH 2/2] gdb-cli-add-ignore-errors-command
[gdb/cli] Add ignore-errors command
Date: Mon, 7 Apr 2025 16:19:48 +0200
Subject: [PATCH] [gdb/cli] Add ignore-errors command
While trying to reproduce a failing test-case from the testsuite on the
command line using a gdb command script, I ran into the problem that a command
@@ -75,10 +73,10 @@ gdb/testsuite/ChangeLog:
create mode 100644 gdb/testsuite/gdb.base/ignore-errors.gdb
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index cfe7b71b0b7..0ae5530c558 100644
index 0140c717ca2..c244eebbdf7 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -40,6 +40,7 @@
@@ -39,6 +39,7 @@
#include "location.h"
#include "block.h"
#include "valprint.h"
@@ -86,7 +84,7 @@ index cfe7b71b0b7..0ae5530c558 100644
#include "ui-out.h"
#include "interps.h"
@@ -2544,6 +2545,34 @@ shell_internal_fn (struct gdbarch *gdbarch,
@@ -2572,6 +2573,34 @@ shell_internal_fn (struct gdbarch *gdbarch,
return value::allocate_optimized_out (int_type);
}
@@ -121,10 +119,10 @@ index cfe7b71b0b7..0ae5530c558 100644
void _initialize_cli_cmds ();
void
_initialize_cli_cmds ()
@@ -2942,4 +2971,10 @@ when GDB is started."), GDBINIT).release ();
@@ -2972,4 +3001,10 @@ when GDB is started."), GDBINIT).release ();
c = add_cmd ("source", class_support, source_command,
source_help_text, &cmdlist);
set_cmd_completer (c, filename_completer);
set_cmd_completer (c, deprecated_filename_completer);
+
+ c = add_cmd ("ignore-errors", class_support, ignore_errors_command,
+ _("Execute a single command, ignoring all errors.\n"
@@ -133,10 +131,10 @@ index cfe7b71b0b7..0ae5530c558 100644
+ set_cmd_completer (c, ignore_errors_command_completer);
}
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1abf91c4470..c277c16297c 100644
index 47c538520ab..b830d42da72 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -29250,7 +29250,8 @@ The lines in a command file are generally executed sequentially,
@@ -29472,7 +29472,8 @@ The lines in a command file are generally executed sequentially,
unless the order of execution is changed by one of the
@emph{flow-control commands} described below. The commands are not
printed as they are executed. An error in any command terminates
@@ -146,7 +144,7 @@ index 1abf91c4470..c277c16297c 100644
@value{GDBN} first searches for @var{filename} in the current directory.
If the file is not found there, and @var{filename} does not specify a
@@ -29345,6 +29346,11 @@ the controlling expression.
@@ -29567,6 +29568,11 @@ the controlling expression.
@item end
Terminate the block of commands that are the body of @code{if},
@code{else}, or @code{while} flow-control commands.
@@ -196,6 +194,8 @@ index 00000000000..5962ff49b11
@@ -0,0 +1,2 @@
+ignore-errors run
+echo here\n
--
2.35.3
base-commit: 1398f45a2641e0e9e0e331681655404ae1d4ed97
--
2.43.0

View File

@@ -1,232 +0,0 @@
From 1e295ef5fa3a5a89e9ee08d6e60d971ddb9e6e46 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 31 Jul 2024 13:11:48 +0200
Subject: [PATCH 13/46] [gdb/exp] Fix gdb.fortran/intrinsics.exp fail on arm
When running test-case gdb.fortran/intrinsics.exp on arm-linux, I get:
...
(gdb) p cmplx (4,4,16)^M
/home/linux/gdb/src/gdb/f-lang.c:1002: internal-error: eval_op_f_cmplx: \
Assertion `kind_arg->code () == TYPE_CODE_COMPLEX' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
----- Backtrace -----^M
FAIL: gdb.fortran/intrinsics.exp: p cmplx (4,4,16) (GDB internal error)
...
The problem is that 16-byte floats are unsupported:
...
$ gfortran test.f90
test.f90:2:17:
2 | REAL(kind=16) :: foo = 1
| 1
Error: Kind 16 not supported for type REAL at (1)
...
and consequently we end up with a builtin_real_s16 and builtin_complex_s16 with
code TYPE_CODE_ERROR.
Fix this by bailing out asap when encountering such a type.
Without this patch we're able to do the rather useless:
...
(gdb) ptype real*16
type = real*16
(gdb) ptype real_16
type = real*16
...
but with this patch we get:
...
(gdb) ptype real*16
unsupported kind 16 for type real*4
(gdb) ptype real_16
unsupported type real*16
...
Tested on arm-linux.
PR fortran/30537
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30537
---
gdb/f-exp.y | 39 +++++++++++++++++-------
gdb/testsuite/gdb.fortran/intrinsics.exp | 8 +++--
gdb/testsuite/gdb.fortran/type-kinds.exp | 22 ++++++++++---
gdb/testsuite/gdb.fortran/types.exp | 19 +++++++++++-
4 files changed, 70 insertions(+), 18 deletions(-)
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index bdf9c32a81b..259f274d341 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -754,7 +754,11 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
| REAL_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_real_s8; }
| REAL_S16_KEYWORD
- { $$ = parse_f_type (pstate)->builtin_real_s16; }
+ { $$ = parse_f_type (pstate)->builtin_real_s16;
+ if ($$->code () == TYPE_CODE_ERROR)
+ error (_("unsupported type %s"),
+ TYPE_SAFE_NAME ($$));
+ }
| COMPLEX_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex; }
| COMPLEX_S4_KEYWORD
@@ -762,7 +766,11 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
| COMPLEX_S8_KEYWORD
{ $$ = parse_f_type (pstate)->builtin_complex_s8; }
| COMPLEX_S16_KEYWORD
- { $$ = parse_f_type (pstate)->builtin_complex_s16; }
+ { $$ = parse_f_type (pstate)->builtin_complex_s16;
+ if ($$->code () == TYPE_CODE_ERROR)
+ error (_("unsupported type %s"),
+ TYPE_SAFE_NAME ($$));
+ }
| SINGLE PRECISION
{ $$ = parse_f_type (pstate)->builtin_real;}
| DOUBLE PRECISION
@@ -1156,12 +1164,9 @@ push_kind_type (LONGEST val, struct type *type)
type_stack->push (tp_kind);
}
-/* Called when a type has a '(kind=N)' modifier after it, for example
- 'character(kind=1)'. The BASETYPE is the type described by 'character'
- in our example, and KIND is the integer '1'. This function returns a
- new type that represents the basetype of a specific kind. */
+/* Helper function for convert_to_kind_type. */
static struct type *
-convert_to_kind_type (struct type *basetype, int kind)
+convert_to_kind_type_1 (struct type *basetype, int kind)
{
if (basetype == parse_f_type (pstate)->builtin_character)
{
@@ -1211,13 +1216,25 @@ convert_to_kind_type (struct type *basetype, int kind)
return parse_f_type (pstate)->builtin_integer_s8;
}
- error (_("unsupported kind %d for type %s"),
- kind, TYPE_SAFE_NAME (basetype));
-
- /* Should never get here. */
return nullptr;
}
+/* Called when a type has a '(kind=N)' modifier after it, for example
+ 'character(kind=1)'. The BASETYPE is the type described by 'character'
+ in our example, and KIND is the integer '1'. This function returns a
+ new type that represents the basetype of a specific kind. */
+static struct type *
+convert_to_kind_type (struct type *basetype, int kind)
+{
+ struct type *res = convert_to_kind_type_1 (basetype, kind);
+
+ if (res == nullptr || res->code () == TYPE_CODE_ERROR)
+ error (_("unsupported kind %d for type %s"),
+ kind, TYPE_SAFE_NAME (basetype));
+
+ return res;
+}
+
struct f_token
{
/* The string to match against. */
diff --git a/gdb/testsuite/gdb.fortran/intrinsics.exp b/gdb/testsuite/gdb.fortran/intrinsics.exp
index 60c79f956dc..060bb53db97 100644
--- a/gdb/testsuite/gdb.fortran/intrinsics.exp
+++ b/gdb/testsuite/gdb.fortran/intrinsics.exp
@@ -112,10 +112,14 @@ gdb_test "ptype cmplx (4,4)" "= complex\\*4"
gdb_test "p cmplx (-14,-4)" "= \\(-14,-4\\)"
gdb_test "p cmplx (4,4,4)" "\\(4,4\\)"
gdb_test "p cmplx (4,4,8)" "\\(4,4\\)"
-gdb_test "p cmplx (4,4,16)" "\\(4,4\\)"
+set re_unsupported_kind_16 \
+ [string_to_regexp "unsupported kind 16 for type complex*4"]
+gdb_test "p cmplx (4,4,16)" \
+ ([string_to_regexp " = (4,4)"]|$re_unsupported_kind_16)
gdb_test "ptype cmplx (4,4,4)" "= complex\\*4"
gdb_test "ptype cmplx (4,4,8)" "= complex\\*8"
-gdb_test "ptype cmplx (4,4,16)" "= complex\\*16"
+gdb_test "ptype cmplx (4,4,16)" \
+ ([string_to_regexp " = complex*16"]|$re_unsupported_kind_16)
gdb_test "p cmplx (4,4,1)" "unsupported kind 1 for type complex\\*4"
gdb_test "p cmplx (4,4,-1)" "unsupported kind -1 for type complex\\*4"
diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp
index ab5f19f97a4..a6f2aa4e870 100644
--- a/gdb/testsuite/gdb.fortran/type-kinds.exp
+++ b/gdb/testsuite/gdb.fortran/type-kinds.exp
@@ -43,12 +43,20 @@ proc test_basic_parsing_of_type_kinds {} {
test_cast_1_to_type_kind "complex" "" "\\(1,0\\)" "8"
test_cast_1_to_type_kind "complex" "4" "\\(1,0\\)" "8"
test_cast_1_to_type_kind "complex" "8" "\\(1,0\\)" "16"
- test_cast_1_to_type_kind "complex" "16" "\\(1,0\\)" "32"
+ set re_unsupported_kind \
+ [string_to_regexp "unsupported kind 16 for type complex*4"]
+ test_cast_1_to_type_kind "complex" "16" \
+ [string_to_regexp (1,0)]|$re_unsupported_kind \
+ 32|$re_unsupported_kind
test_cast_1_to_type_kind "real" "" "1" "4"
test_cast_1_to_type_kind "real" "4" "1" "4"
test_cast_1_to_type_kind "real" "8" "1" "8"
- test_cast_1_to_type_kind "real" "16" "1" "16"
+ set re_unsupported_kind \
+ [string_to_regexp "unsupported kind 16 for type real*4"]
+ test_cast_1_to_type_kind "real" "16" \
+ 1|$re_unsupported_kind \
+ 16|$re_unsupported_kind
test_cast_1_to_type_kind "logical" "" "\\.TRUE\\." "4"
test_cast_1_to_type_kind "logical" "1" "\\.TRUE\\." "1"
@@ -83,11 +91,17 @@ proc test_old_star_type_sizes {} {
gdb_test "p ((complex*4) 1)" " = \\(1,0\\)"
gdb_test "p ((complex*8) 1)" " = \\(1,0\\)"
- gdb_test "p ((complex*16) 1)" " = \\(1,0\\)"
+ set re_unsupported_kind \
+ [string_to_regexp "unsupported kind 16 for type complex*4"]
+ gdb_test "p ((complex*16) 1)" \
+ [string_to_regexp " = (1,0)"]|$re_unsupported_kind
gdb_test "p ((real*4) 1)" " = 1"
gdb_test "p ((real*8) 1)" " = 1"
- gdb_test "p ((real*16) 1)" " = 1"
+ set re_unsupported_kind \
+ [string_to_regexp "unsupported kind 16 for type real*4"]
+ gdb_test "p ((real*16) 1)" \
+ "( = 1|$re_unsupported_kind)"
gdb_test "p ((logical*1) 1)" " = \\.TRUE\\."
gdb_test "p ((logical*4) 1)" " = \\.TRUE\\."
diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp
index 83b109869e6..edbf5abee97 100644
--- a/gdb/testsuite/gdb.fortran/types.exp
+++ b/gdb/testsuite/gdb.fortran/types.exp
@@ -94,7 +94,24 @@ proc test_primitive_types_known {} {
# While TYPE_KIND is allowed as input, GDB will always return the
# Fortran notation TYPE*KIND
regsub -all "_" $type "\*" type_res
- gdb_test "ptype $type" [string_to_regexp "type = $type_res"]
+ set re [string_to_regexp "type = $type_res"]
+ switch $type {
+ real*16 - complex*16 {
+ regexp {^[^*_]*} $type base
+ set re_unsupported \
+ [string_to_regexp \
+ "unsupported kind 16 for type $base*4"]
+ set re ($re|$re_unsupported)
+ }
+ real_16 - complex_16 {
+ set re_unsupported \
+ [string_to_regexp \
+ "unsupported type $type_res"]
+ set re ($re|$re_unsupported)
+ }
+ }
+
+ gdb_test "ptype $type" $re
}
}
--
2.43.0

View File

@@ -1,48 +0,0 @@
.\"
.\" gstack manual page.
.\" Copyright (c) 1999 Ross Thompson
.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc.
.\"
.\" Original author: Ross Thompson <ross@whatsis.com>
.\"
.\" 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, 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; see the file COPYING. If not, write to
.\" the Free Software Foundation, 59 Temple Place - Suite 330,
.\" Boston, MA 02111-1307, USA.
.\"
.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual"
.SH NAME
gstack \- print a stack trace of a running process
.SH SYNOPSIS
.B gstack
pid
.SH DESCRIPTION
\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on
the command line, and prints out an execution stack trace. If ELF
symbols exist in the binary (usually the case unless you have run
strip(1)), then symbolic addresses are printed as well.
If the process is part of a thread group, then \f3gstack\f1 will print
out a stack trace for each of the threads in the group.
.SH SEE ALSO
nm(1), ptrace(2), gdb(1)
.SH AUTHORS
Ross Thompson <ross@whatsis.com>
Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>

View File

@@ -1,6 +1,6 @@
From fe0e6edbcb65ab5eca50c1a0ad8ddc9844f8ea98 Mon Sep 17 00:00:00 2001
From cd4f4a663f82e2f8bee58f3ef000964a2dd82769 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 27 Jan 2025 09:23:18 +0100
Date: Tue, 28 Jan 2025 20:56:17 +0100
Subject: [PATCH] [gdb/guile] Use SCM_DEBUG_TYPING_STRICTNESS 0
I build gdb with libguile v2.0.9, and ran into:
@@ -21,22 +21,24 @@ We were already using this for c++20 due to a Werror=volatile in SCM_UNPACK
when using libguile v2.0.10.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/guile/guile-internal.h | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
gdb/guile/guile-internal.h | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index be16fee0dd2..6665bfc7813 100644
index 8d83b8b808a..85e08ca905d 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -27,10 +27,30 @@
#include "hashtab.h"
#include "extension-priv.h"
#include "symtab.h"
-#include "libguile.h"
@@ -30,12 +30,25 @@
#include "objfiles.h"
#include "top.h"
-#if __cplusplus >= 202002L
-/* Work around Werror=volatile in SCM_UNPACK for
- SCM_DEBUG_TYPING_STRICTNESS == 1. Reported upstream:
- https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65333 . */
+/* For libguile v2.0.9 and SCM_DEBUG_TYPING_STRICTNESS == 1, SCM_UNPACK(x) is
+ defined as:
+
@@ -55,14 +57,13 @@ index be16fee0dd2..6665bfc7813 100644
+ The former form causes a Werror=sequence-point with gcc 7-14.
+
+ Work around these problem by using SCM_DEBUG_TYPING_STRICTNESS == 0. */
+#define SCM_DEBUG_TYPING_STRICTNESS 0
+#include "libguile.h"
+
#define SCM_DEBUG_TYPING_STRICTNESS 0
-#endif
#include "libguile.h"
struct block;
struct frame_info;
struct objfile;
base-commit: 94df6741bbabaa9a51960446b2af4c0bed01b54b
base-commit: e76eb034e25f53ef2c17eab700e95d07bbbdc7aa
--
2.43.0

View File

@@ -1,130 +0,0 @@
From 22d05b4879b8608e3768483735140a729952b565 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Sun, 18 Aug 2024 20:51:29 +0200
Subject: [PATCH 39/46] [gdb] Prune inferior after switching inferior
Usually with test-case gdb.python/py-progspace-events.exp I get:
...
(gdb) inferior 1^M
[Switching to inferior 1 [process 4116] (py-progspace-events)]^M
[Switching to thread 1.1 (Thread 0xf77d0ce0 (LWP 4116))]^M
28 { /* Nothing. */ }^M
(gdb) PASS: gdb.python/py-progspace-events.exp: inferior 1
step^M
FreeProgspaceEvent: <gdb.Progspace object at 0xabf4f850>^M
do_parent_stuff () at py-progspace-events.c:41^M
41 ++global_var;^M
(gdb) PASS: gdb.python/py-progspace-events.exp: step
...
But occasionally I run into the following FAIL:
...
(gdb) inferior 1^M
[Switching to inferior 1 [process 5199] (py-progspace-events)]^M
[Switching to thread 1.1 (Thread 0xf77d0ce0 (LWP 5199))]^M
28 { /* Nothing. */ }^M
(gdb) FreeProgspaceEvent: <gdb.Progspace object at 0xabaf03a0>^M
FAIL: gdb.python/py-progspace-events.exp: inferior 1 (timeout)
...
This is caused by a race between the handling of an event, and the
"inferior 1" command.
In the passing case, the event is handled first. During which prune_inferiors
is called, but it can't remove inferior 2, because it's still the current one.
In the failing case, the "inferior 1" command is handled first. Then during
handling of the event, prune_inferiors is called, and it can remove inferior 2
because it's no longer the current one.
This looks like a test-case issue to me, but ISTM that we can do better: by
calling prune_inferiors asap, at the end of the "inferior 1" command, we
stabilize the moment when the inferior is removed:
...
(gdb) inferior 1^M
[Switching to inferior 1 [process 5199] (py-progspace-events)]^M
[Switching to thread 1.1 (Thread 0xf77d0ce0 (LWP 5199))]^M
28 { /* Nothing. */ }^M
FreeProgspaceEvent: <gdb.Progspace object at 0xabaf03a0>^M
(gdb) PASS: gdb.python/py-progspace-events.exp: inferior 1
...
This also allows us to simplify the test-case by removing the step command,
which is no longer required to trigger the pruning of the inferior.
Tested on x86_64-linux.
Approved-by: Kevin Buettner <kevinb@redhat.com>
PR gdb/31440
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31440
---
gdb/inferior.c | 4 +++
.../gdb.python/py-progspace-events.exp | 31 +++----------------
2 files changed, 9 insertions(+), 26 deletions(-)
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 0522cb5c14d..2a19c5b19a1 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -790,6 +790,10 @@ inferior_command (const char *args, int from_tty)
notify_user_selected_context_changed
(USER_SELECTED_INFERIOR);
}
+
+ /* Switching current inferior may have made one of the inferiors
+ prunable, so prune it. */
+ prune_inferiors ();
}
}
diff --git a/gdb/testsuite/gdb.python/py-progspace-events.exp b/gdb/testsuite/gdb.python/py-progspace-events.exp
index 95e4ca8da0b..9dfc7573d40 100644
--- a/gdb/testsuite/gdb.python/py-progspace-events.exp
+++ b/gdb/testsuite/gdb.python/py-progspace-events.exp
@@ -79,37 +79,16 @@ gdb_test "continue" \
"\\\[Inferior $decimal \[^\r\n\]+ exited normally\\\]"] \
"continue until inferior 2 exits"
-gdb_test "inferior 1" "\\\[Switching to inferior 1 .*"
-
-# Step the inferior. During this process GDB will prune the now
+# Switch to inferior 1. During this process GDB will prune the now
# defunct inferior, which deletes its program space, which should
# trigger the FreeProgspaceEvent.
#
-# However, there is a slight problem. When the target is remote, and
-# GDB is accessing files using remote fileio, then GDB will attempt to
-# prune the inferior at a point in time when the remote target is
-# waiting for a stop reply. Pruning an inferior causes GDB to close
-# files associated with that inferior.
-#
-# In non-async mode we can't send fileio packets while waiting for a
-# stop reply, so the attempts to close files fails, and this shows up
-# as an error.
-#
-# As this error has nothing to do with the feature being tested here,
-# we just accept the error message, the important part is the
-# 'FreeProgspaceEvent' string, so long as that appears (just once)
-# then the test is a success.
-set warning_msg \
- [multi_line \
- "warning: cannot close \"\[^\r\n\]+\": Cannot execute this command while the target is running\\." \
- "Use the \"interrupt\" command to stop the target" \
- "and then try again\\."]
-gdb_test "step" \
+gdb_test "inferior 1" \
[multi_line \
- "^FreeProgspaceEvent.*: <gdb.Progspace object at $hex>(?:\r\n$warning_msg)*" \
- "do_parent_stuff \\(\\) at \[^\r\n\]+" \
- "$decimal\\s+\[^\r\n\]+"]
+ "\\\[Switching to inferior 1 .*" \
+ ".*" \
+ "FreeProgspaceEvent.*: <gdb.Progspace object at $hex>"]
# Let this inferior run to completion.
gdb_continue_to_end
--
2.43.0

View File

@@ -1,89 +0,0 @@
From 9b1fc55c1887675923d4ddeda4b38ab05e6bb44c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 13 Mar 2025 11:15:05 +0100
Subject: [PATCH 1/2] [gdb/record] Fix out-of-bounds write in
aarch64_record_asimd_load_store
After compiling gdb with -fstack-protector-all, and running test-case
gdb.reverse/getrandom.exp on aarch64-linux, we run into
"Stack smashing detected" in function aarch64_record_asimd_load_store.
This is reported in PR record/32784.
This happens due to an out-of-bounds write to local array record_buf_mem:
...
uint64_t record_buf_mem[24];
...
when recording insn:
...
B+>0xfffff7ff4d10 st1 {v0.16b-v3.16b}, [x0]
...
We can fix this by increasing the array size to 128, but rather than again
hardcoding a size, reimplement record_buf_mem as std::vector.
Tested on aarch64-linux.
Approved-By: Guinevere Larsen <guinevere@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32784
(cherry picked from commit 51729ea0905d1f688b7fd2ea769e69b29daa1b7c)
---
gdb/aarch64-tdep.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index e4bca6c6632..92daaa75b1c 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -5030,9 +5030,9 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
CORE_ADDR address;
uint64_t addr_offset = 0;
uint32_t record_buf[24];
- uint64_t record_buf_mem[24];
+ std::vector<uint64_t> record_buf_mem;
uint32_t reg_rn, reg_rt;
- uint32_t reg_index = 0, mem_index = 0;
+ uint32_t reg_index = 0;
uint8_t opcode_bits, size_bits;
reg_rt = bits (aarch64_insn_r->aarch64_insn, 0, 4);
@@ -5095,8 +5095,8 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
record_buf[reg_index++] = reg_rt + AARCH64_V0_REGNUM;
else
{
- record_buf_mem[mem_index++] = esize / 8;
- record_buf_mem[mem_index++] = address + addr_offset;
+ record_buf_mem.push_back (esize / 8);
+ record_buf_mem.push_back (address + addr_offset);
}
addr_offset = addr_offset + (esize / 8);
reg_rt = (reg_rt + 1) % 32;
@@ -5167,8 +5167,8 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
record_buf[reg_index++] = reg_tt + AARCH64_V0_REGNUM;
else
{
- record_buf_mem[mem_index++] = esize / 8;
- record_buf_mem[mem_index++] = address + addr_offset;
+ record_buf_mem.push_back (esize / 8);
+ record_buf_mem.push_back (address + addr_offset);
}
addr_offset = addr_offset + (esize / 8);
reg_tt = (reg_tt + 1) % 32;
@@ -5180,9 +5180,9 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
record_buf[reg_index++] = reg_rn;
aarch64_insn_r->reg_rec_count = reg_index;
- aarch64_insn_r->mem_rec_count = mem_index / 2;
+ aarch64_insn_r->mem_rec_count = record_buf_mem.size () / 2;
MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem.data ());
REG_ALLOC (aarch64_insn_r->aarch64_regs, aarch64_insn_r->reg_rec_count,
record_buf);
return AARCH64_RECORD_SUCCESS;
base-commit: 96a340e789f714156bbac7f78f340e06659b5e70
--
2.43.0

File diff suppressed because it is too large Load Diff

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-rhbz-818343-set-solib-absolute-prefix-testcase.patch
;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
;;=fedoratest
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
@@ -0,0 +1,26 @@
+/* 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/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+ printf ("Hello, World.\n");
+ abort ();
+}
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
@@ -0,0 +1,39 @@
+# 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/>.
+
+set testfile "set-solib-absolute-prefix"
+set srcfile ${testfile}.c
+
+# It is necessary to verify if the binary is 32-bit, so that the system
+# call `__kernel_vsyscall' originates from vDSO.
+
+if { ![is_ilp32_target] } {
+ return -1
+}
+
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
+ return -1
+}
+
+if { ![runto_main] } {
+ return -1
+}
+
+gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
+ "continue until abort"
+gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
+ ".*warning: Unable to find dynamic linker breakpoint function.*" \
+ "set solib-absolute-prefix"
+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"

View File

@@ -1,235 +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-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
;; Kratochvil, RH BZ 1084404).
;;=fedoratest
These testcases have been created by compiling glibc-2.17-78 on
RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
present at $builddir/misc/select.o.
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
@@ -0,0 +1,34 @@
+# 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 { ![istarget powerpc64-*linux-*] || ![is_lp64_target] } {
+ verbose "Skipping ppc64-prologue-skip.exp"
+ return
+}
+
+set testfile "ppc64-prologue-skip"
+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 "break ___newselect_nocancel" "Breakpoint $decimal at 0xc: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on ___newselect_nocancel"
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
@@ -0,0 +1,70 @@
+begin 644 ppc64-skip-prologue.o.uu
+M?T5,1@("`0`````````````!`!4````!````````````````````````````
+M``-(``````!```````!``!0`$8%-B-`L"@``0,(`-#@``(Y$```"3.,`('P(
+M`J;X`0`0^"'_D4@```%@````Z`$`@#@A`'!\"`.F3H``(/@A_X%]*`*F^2$`
+MD/CA`-#XP0#(^*$`P/B!`+CX80"P2````6````#X80!PZ.$`T.C!`,CHH0#`
+MZ($`N.AA`+`X``".1````GP``";X80!X^`$`B.AA`'!(```!8````.DA`)#H
+M`0"(Z&$`>'TH`Z9\#_$@."$`@$SC`"!+__]@```````,($``````````O``(
+M7U]S96QE8W0```````````````````````````!6``(````Y!`'[#@T``0$!
+M`0````$```$N+B]S>7-D97!S+W5N:7@``'-Y<V-A;&PM=&5M<&QA=&4N4P`!
+M``````D"```````````#T``!`BT3`@D``0$```"/``(`````"`$`````````
+M`````````````````"XN+W-Y<V1E<',O=6YI>"]S>7-C86QL+71E;7!L871E
+M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#<N<W)C+V=L:6)C+3(N
+M,3<M8S<U.&$V.#8O;6ES8P!'3E4@05,@,BXR,RXU,BXP+C$`@`$!$0`0!A$!
+M$@$#"!L()0@3!0`````````````````L``(`````"```````````````````
+M````````V``````````````````````````0``````%Z4@`$>$$!&PP!````
+M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$&
+M1@``````+G-Y;71A8@`N<W1R=&%B`"YS:'-T<G1A8@`N<F5L82YT97AT`"YD
+M871A`"YB<W,`+G)E;&$N;W!D`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U
+M9U]L:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD
+M96)U9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````"`````!``````````8```````````````````!``````````-@`
+M```````````````````$```````````````;````!```````````````````
+M```````````*>`````````!(````$@````$`````````"``````````8````
+M)@````$``````````P```````````````````1@`````````````````````
+M``````````$``````````````"P````(``````````,`````````````````
+M``$8```````````````````````````````!```````````````V`````0``
+M```````#```````````````````!&``````````0````````````````````
+M"```````````````,0````0`````````````````````````````"L``````
+M````,````!(````%``````````@`````````&````#L````!````````````
+M``````````````````$H```````````````````````````````!````````
+M``````!0`````0`````````````````````````````!*`````````!:````
+M`````````````````0``````````````2P````0`````````````````````
+M````````"O``````````&````!(````(``````````@`````````&````&$`
+M```!``````````````````````````````&"`````````),`````````````
+M```````!``````````````!<````!``````````````````````````````+
+M"`````````!@````$@````H`````````"``````````8````;0````$`````
+M`````````````````````````A4`````````%`````````````````````$`
+M`````````````(`````!``````````````````````````````(P````````
+M`#`````````````````````0``````````````![````!```````````````
+M```````````````+:``````````P````$@````T`````````"``````````8
+M````E`````$``````````@```````````````````F``````````2```````
+M``````````````@``````````````(\````$````````````````````````
+M``````N8`````````!@````2````#P`````````(`````````!@````1````
+M`P`````````````````````````````"J`````````">````````````````
+M`````0```````````````0````(`````````````````````````````"$@`
+M```````!L````!,````+``````````@`````````&`````D````#````````
+M``````````````````````GX`````````'H````````````````````!````
+M`````````````````````````````````````````````P```0``````````
+M`````````````````P```P```````````````````````````P``!```````
+M`````````````````````P``!0```````````````````````````P``"@``
+M`````````````````````````P``#````````````````````````````P``
+M"````````````````````````````P``#0``````````````````````````
+M`P``#P```````````````````````````P``!P``````````````````````
+M```!$@``!0```````````````````-@````*$@```0`````````,````````
+M`#`````@$``````````````````````````````P$```````````````````
+M``````````!*$`````````````````````````````!E(@``!0``````````
+M`````````-@```!S(@``!0```````````````````-@`7U]S96QE8W0`7U]?
+M;F5W<V5L96-T7VYO8V%N8V5L`%]?<WES8V%L;%]E<G)O<@!?7VQI8F-?96YA
+M8FQE7V%S>6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]?
+M;&EB8U]S96QE8W0`<V5L96-T```````````````````D````#0````H`````
+M``````````````!<````#@````H```````````````````"4````#P````H`
+M`````````````````````````0```"8````````````````````(````````
+M`#,```````````````````!&`````0```"8````````````````````&````
+M!@````$````````````````````,````!P````$````````````````````0
+M`````0```"8````````````````````8`````0```"8`````````V```````
+M```&````!0````$````````````````````0`````0```"8`````````````
+6```````<`````0```!H`````````````
+`
+end
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
@@ -0,0 +1,34 @@
+# 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 { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
+ verbose "Skipping s390x-prologue-skip.exp"
+ return
+}
+
+set testfile "s390x-prologue-skip"
+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 "break select" "Breakpoint $decimal at 0x48: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on select"
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
@@ -0,0 +1,64 @@
+begin 644 s390x-prologue-skip.o.uu
+M?T5,1@("`0`````````````!`!8````!````````````````````````````
+M``+```````!```````!``!(`#^LE\!``).O?\&@`)+D$`.^G^_]@X^#P```D
+MP.4`````N00``NLE\+``!`J.N00`TKD$`"#`Y0````"Y!``MZ]_Q"``$I_0`
+M"L`0`````+\/$`"G=/_7"HZG2?`!N2$`),"T``````?^````5@`"````.0$!
+M^PX-``$!`0$````!```!+BXO<WES9&5P<R]U;FEX``!S>7-C86QL+71E;7!L
+M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@!
+M```````````````````````````N+B]S>7-D97!S+W5N:7@O<WES8V%L;"UT
+M96UP;&%T92Y3`"]R;V]T+V=L:6)C+V=L:6)C+3(N,3<M-S@N96PW+G-R8R]G
+M;&EB8RTR+C$W+6,W-3AA-C@V+VUI<V,`1TY5($%3(#(N,C,N-3(N,"XQ`(`!
+M`1$`$`81`1(!`P@;""4($P4`````````````````+``"``````@`````````
+M`````````````````&@`````````````````````````%``````!>E(``7@.
+M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X
+M`````````"```````"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`+G)E;&$N
+M=&5X=``N9&%T80`N8G-S`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U9U]L
+M:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD96)U
+M9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````(`````$`````````!@```````````````````$``````````:```
+M``````````````````0``````````````!L````$````````````````````
+M``````````F``````````&`````0`````0`````````(`````````!@````F
+M`````0`````````#````````````````````J```````````````````````
+M````````!```````````````+`````@``````````P``````````````````
+M`*@```````````````````````````````0``````````````#$````!````
+M``````````````````````````"H```````````````````````````````!
+M``````````````!&`````0``````````````````````````````J```````
+M``!:`````````````````````0``````````````00````0`````````````
+M````````````````">``````````&````!`````&``````````@`````````
+M&````%<````!``````````````````````````````$"`````````),`````
+M```````````````!``````````````!2````!```````````````````````
+M```````)^`````````!@````$`````@`````````"``````````8````8P``
+M``$``````````````````````````````94`````````%```````````````
+M``````$``````````````'8````!``````````````````````````````&P
+M`````````#`````````````````````0``````````````!Q````!```````
+M```````````````````````*6``````````P````$`````L`````````"```
+M```````8````B@````$``````````@```````````````````>``````````
+M2`````````````````````@``````````````(4````$````````````````
+M``````````````J(`````````#`````0````#0`````````(`````````!@`
+M```1`````P`````````````````````````````"*`````````"4````````
+M`````````````0```````````````0````(`````````````````````````
+M````!T`````````!L````!$````*``````````@`````````&`````D````#
+M``````````````````````````````CP`````````(X`````````````````
+M```!`````````````````````````````````````````````````P```0``
+M`````````````````````````P```P```````````````````````````P``
+M!````````````````````````````P``"```````````````````````````
+M`P``"@```````````````````````````P``!@``````````````````````
+M`````P``"P```````````````````````````P``#0``````````````````
+M`````````P``!0`````````````````````````!$```````````````````
+M```````````;$``````````````````````````````V$@```0````````!(
+M`````````"`````_$`````````````````````````````!7$@```0``````
+M``!6`````````!````!I$`````````````````````````````!Y(@```0``
+M``````!(`````````"````"'(@```0````````!(`````````"``7U]L:6)C
+M7V5N86)L95]A<WEN8V-A;F-E;`!?7VQI8F-?9&ES86)L95]A<WEN8V-A;F-E
+M;`!?7W-E;&5C=`!?7VQI8F-?;75L=&EP;&5?=&AR96%D<P!?7W-E;&5C=%]N
+M;V-A;F-E;`!?7W-Y<V-A;&Q?97)R;W(`7U]L:6)C7W-E;&5C=`!S96QE8W0`
+M````````````'`````H````3``````````(`````````-@````L````3````
+M``````(`````````2@````T````3``````````(`````````8@````\````3
+M``````````(`````````1@````$````6````````````````````!@````4`
+M```$````````````````````#`````8````$````````````````````$```
+M``$````6````````````````````&`````$````6`````````&@`````````
+M!@````0````$````````````````````$`````$````6````````````````
+L````(`````$````%````````````````````/`````$````%`````````$@`
+`
+end

View File

@@ -0,0 +1,102 @@
From f60ba4bfaa3d9f499aa0b16d278b969a3074b0e1 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 21 Jan 2025 15:23:19 +0100
Subject: [PATCH] [gdb/symtab] Fix gdb.base/fission-macro.exp with unix/-m32
When running test-case gdb.base/fission-macro.exp on openSUSE Tumbleweed
(using gcc 14) with target board unix/-m32, I get:
...
(gdb) info macro FIRST^M
Defined at /data/vries/gdb/src/gdb/testsuite/gdb.base/fission-macro.c:0^M
-DFIRST=1^M
(gdb) FAIL: $exp: \
dwarf_version=5: dwarf_bits=32: strict_dwarf=0: info macro FIRST
...
instead of the expected:
...
(gdb) info macro FIRST^M
Defined at /data/vries/gdb/src/gdb/testsuite/gdb.base/fission-macro.c:18^M
(gdb) PASS: $exp: \
dwarf_version=5: dwarf_bits=32: strict_dwarf=0: info macro FIRST
...
A dwarf-5 .debug_str_offsets section starts with a header consisting of:
- an initial length (4 bytes for 32-bit and 12 bytes for 64-bit),
- a 2 byte version string, and
- 2 bytes padding
so in total 8 bytes for 32-bit and 16 bytes for 64-bit.
This offset is calculated here in dwarf_decode_macros:
...
str_offsets_base = cu->header.addr_size;
...
which is wrong for both dwarf-5 cases (and also happens to be wrong for
dwarf-4).
Fix this by computing str_offsets_base correctly for dwarf-5, for both the
32-bit and 64-bit case.
Likewise, fix this for dwarf-4, using str_offsets_base 0. We can only test
this with gcc-15, because gcc 14 and earlier don't have the fix for
PR debug/115066.
Tested on x86_64-linux.
Tested test-case using a current gcc trunk build, and gcc 14.
Approved-By: Tom Tromey <tom@tromey.com>
PR symtab/31897
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31897
---
gdb/dwarf2/read.c | 12 +++++++++++-
gdb/testsuite/gdb.base/fission-macro.exp | 8 ++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 49fb219f03d..f0873f189d3 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -21610,7 +21610,17 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
str_offsets_section = &cu->dwo_unit->dwo_file
->sections.str_offsets;
str_section = &cu->dwo_unit->dwo_file->sections.str;
- str_offsets_base = cu->header.addr_size;
+ if (cu->header.version <= 4)
+ str_offsets_base = 0;
+ else
+ {
+ bfd *abfd = str_offsets_section->get_bfd_owner ();
+ unsigned int bytes_read = 0;
+ read_initial_length (abfd, str_offsets_section->buffer, &bytes_read,
+ false);
+ const bool is_dwarf64 = bytes_read != 4;
+ str_offsets_base = is_dwarf64 ? 16 : 8;
+ }
}
else
{
diff --git a/gdb/testsuite/gdb.base/fission-macro.exp b/gdb/testsuite/gdb.base/fission-macro.exp
index 705e3dd0c4b..9e5d5c0a0d5 100644
--- a/gdb/testsuite/gdb.base/fission-macro.exp
+++ b/gdb/testsuite/gdb.base/fission-macro.exp
@@ -66,8 +66,12 @@ proc do_tests { dwarf_version dwarf_bits strict_dwarf } {
gdb_test "info macro FOURTH" "#define FOURTH 4"
}
-foreach_with_prefix dwarf_version {5} {
- foreach_with_prefix dwarf_bits {32} {
+foreach_with_prefix dwarf_version {4 5} {
+ if { $dwarf_version == 4 && [gcc_major_version] < 15 } {
+ # Gcc does not contain fix for PR debug/115066.
+ continue
+ }
+ foreach_with_prefix dwarf_bits {32 64} {
foreach_with_prefix strict_dwarf {0 1} {
do_tests $dwarf_version $dwarf_bits $strict_dwarf
}
base-commit: 6d61b107f71d644ab35e8d7fe1c156d4f00c33fc
--
2.43.0

View File

@@ -1,337 +0,0 @@
From e485fec626c14303a31bf7eab35c4288f9710c9d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 19 Jun 2024 17:32:55 +0200
Subject: [PATCH 07/46] [gdb/symtab] Fix target type of complex long double on
arm
When running test-case gdb.base/complex-parts.exp on arm-linux, I get:
...
(gdb) p $_cimag (z3)^M
$6 = 6.5^M
(gdb) PASS: gdb.base/complex-parts.exp: long double imaginary: p $_cimag (z3)
ptype $^M
type = double^M
(gdb) FAIL: gdb.base/complex-parts.exp: long double imaginary: ptype $
...
Given that z3 is a complex long double, the test-case expects the type of the
imaginary part of z3 to be long double, but it's double instead.
This is due to the fact that the dwarf info doesn't specify an explicit target
type:
...
<5b> DW_AT_name : z3
<60> DW_AT_type : <0xa4>
...
<1><a4>: Abbrev Number: 2 (DW_TAG_base_type)
<a5> DW_AT_byte_size : 16
<a6> DW_AT_encoding : 3 (complex float)
<a7> DW_AT_name : complex long double
...
and consequently we're guessing in dwarf2_init_complex_target_type based on
the size:
...
case 64:
tt = builtin_type (gdbarch)->builtin_double;
break;
case 96: /* The x86-32 ABI specifies 96-bit long double. */
case 128:
tt = builtin_type (gdbarch)->builtin_long_double;
break;
...
For arm-linux, complex long double is 16 bytes, so the target type is assumed
to be 8 bytes, which is handled by the "case 64", which gets us double
instead of long double.
Fix this by searching for "long" in the name_hint parameter, and using long
double instead.
Note that base types in dwarf are not allowed to contain references to other
types, and the complex types are base types, so the missing explicit target
type is standard-conformant.
A gcc PR was filed to add this as a dwarf extension (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115272 ).
Tested on arm-linux.
---
gdb/dwarf2/read.c | 10 +-
.../gdb.dwarf2/dw2-complex-parts.exp | 244 ++++++++++++++++++
2 files changed, 253 insertions(+), 1 deletion(-)
create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 7cd1d2b4c4e..18054d0070d 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -15123,7 +15123,15 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
tt = builtin_type (gdbarch)->builtin_float;
break;
case 64:
- tt = builtin_type (gdbarch)->builtin_double;
+ if (builtin_type (gdbarch)->builtin_long_double->length () == 8
+ && name_hint != nullptr
+ && strstr (name_hint, "long") != nullptr)
+ {
+ /* Use "long double" for "complex long double". */
+ tt = builtin_type (gdbarch)->builtin_long_double;
+ }
+ else
+ tt = builtin_type (gdbarch)->builtin_double;
break;
case 96: /* The x86-32 ABI specifies 96-bit long double. */
case 128:
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
new file mode 100644
index 00000000000..281e87d2fc8
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-complex-parts.exp
@@ -0,0 +1,244 @@
+# Copyright 2024 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/>.
+
+# Test complex types, and their parts. Dwarf assembly counterpart of
+# gdb.base/complex-parts.exp.
+#
+# In dwarf, base types are not allowed to have references to other types. And
+# because complex types are modeled as base types, gdb has to figure out what
+# the part type is.
+#
+# It would be easier for gdb if compilers would add a dwarf extension and
+# supply this information, but that may or may not happen
+# ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115272 ).
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile main.c -debug.S
+
+if [prepare_for_testing "failed to prepare" $testfile \
+ "${srcfile}" {}] {
+ return -1
+}
+
+set float_size [get_sizeof float 0]
+set double_size [get_sizeof double 0]
+set long_double_size [get_sizeof "long double" 0]
+
+set int_size [get_sizeof int 0]
+
+# Create the DWARF.
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ cu { version 2 } {
+ compile_unit {} {
+ # Main.
+
+ declare_labels int_type
+
+ int_type: DW_TAG_base_type {
+ {DW_AT_byte_size $::int_size DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_signed}
+ {DW_AT_name int}
+ }
+
+ DW_TAG_subprogram {
+ {MACRO_AT_func {main}}
+ {type :$int_type}
+ }
+
+ # GCC complex float.
+
+ declare_labels cf_type cd_type cld_type
+
+ cf_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_complex_float}
+ {DW_AT_name "complex float"}
+ }
+
+ cd_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_complex_float}
+ {DW_AT_name "complex double"}
+ }
+
+ cld_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_complex_float}
+ {DW_AT_name "complex long double"}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_float}
+ {DW_AT_type :$cf_type}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_double}
+ {DW_AT_type :$cd_type}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_long_double}
+ {DW_AT_type :$cld_type}
+ }
+
+ # GCC complex int.
+ # This is what gcc currently generates, see gcc PR debug/93988.
+
+ declare_labels ci_type
+
+ ci_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::int_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_lo_user}
+ {DW_AT_name "complex int"}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_int}
+ {DW_AT_type :$ci_type}
+ }
+
+ # Clang complex float.
+ # This is what clang currently generates, see this issue (
+ # https://github.com/llvm/llvm-project/issues/52996 ).
+
+ declare_labels clang_cf_type clang_cd_type clang_cld_type
+
+ clang_cf_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_complex_float}
+ {DW_AT_name "complex"}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_clang_float}
+ {DW_AT_type :$clang_cf_type}
+ }
+
+ clang_cd_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_complex_float}
+ {DW_AT_name "complex"}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_clang_double}
+ {DW_AT_type :$clang_cd_type}
+ }
+
+ clang_cld_type: DW_TAG_base_type {
+ {DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata}
+ {DW_AT_encoding @DW_ATE_complex_float}
+ {DW_AT_name "complex"}
+ }
+
+ DW_TAG_variable {
+ {name var_complex_clang_long_double}
+ {DW_AT_type :$clang_cld_type}
+ }
+ }
+ }
+}
+
+if [prepare_for_testing "failed to prepare" $testfile \
+ "${asm_file} ${srcfile}" {}] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+proc do_test { type {clang 0}} {
+ with_test_prefix $type {
+ with_test_prefix clang=$clang {
+
+ if { $clang } {
+ set type_id [regsub -all " " $type _]
+ set var "var_complex_clang_$type_id"
+
+ # Gdb could try to synthesize better names, see enhancement
+ # PR symtab/31858.
+ set ctype "complex"
+ set ctype_id "complex"
+ } else {
+ set ctype "complex $type"
+ set type_id [regsub -all " " $type _]
+ set ctype_id [regsub -all " " $ctype _]
+ set var "var_$ctype_id"
+ }
+
+ gdb_test "ptype '$type'" \
+ "type = $type"
+
+ gdb_test "ptype '$ctype'" \
+ "type = $ctype"
+
+ eval set type_size \$::${type_id}_size
+
+ gdb_test "p sizeof ('$type')" \
+ " = $type_size"
+
+ if { ! $clang } {
+ # With clang, the ctype name does not uniquely map to a type,
+ # so the size is unpredictable.
+ gdb_test "p sizeof ('$ctype')" \
+ " = [expr 2 * $type_size]"
+ }
+
+ set re_kfail \
+ [string_to_regexp \
+ "'var_complex_int' has unknown type; cast it to its declared type"]
+
+ foreach f { {$_cimag} {$_creal} } {
+ gdb_test_multiple "p $f ($var)" "" {
+ -re -wrap " = <optimized out>" {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_kfail {
+ kfail gdb/31857 $gdb_test_name
+ }
+ }
+
+ if { $clang } {
+ # Without a specific complex type name, it's
+ # unpredictable which type name the part will have.
+ gdb_test {ptype $} \
+ "type = (float|double|long double)" \
+ "ptype $f"
+ } else {
+ gdb_test {ptype $} \
+ "type = $type" \
+ "ptype $f"
+ }
+ }
+ }
+ }
+}
+
+do_test "float"
+do_test "double"
+do_test "long double"
+
+do_test "int"
+
+do_test "float" 1
+do_test "double" 1
+do_test "long double" 1
--
2.43.0

View File

@@ -1,224 +0,0 @@
From 84b9218d98eb2ac242fe3afc81598206279f7b13 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 22 Aug 2024 10:00:27 +0200
Subject: [PATCH] [gdb/symtab] Return correct reader for top-level CU in
cooked_indexer::ensure_cu_exists
With the test-case included in this patch, we run into:
...
$ gdb -q -batch $exec
Dwarf Error: Could not find abbrev number 3 in CU at offset 0xdb \
[in module $exec]
...
The debug info consists of two CUs:
...
Compilation Unit @ offset 0xb2:
Length: 0x25 (32-bit)
Version: 4
Abbrev Offset: 0x6c
Pointer Size: 8
<0><bd>: Abbrev Number: 1 (DW_TAG_compile_unit)
<be> DW_AT_language : 2 (non-ANSI C)
<1><bf>: Abbrev Number: 2 (DW_TAG_subprogram)
<c0> DW_AT_low_pc : 0x4004a7
<c8> DW_AT_high_pc : 0x4004b2
<d0> DW_AT_specification: <0xe8>
<1><d4>: Abbrev Number: 3 (DW_TAG_subprogram)
<d5> DW_AT_name : main
<1><da>: Abbrev Number: 0
Compilation Unit @ offset 0xdb:
Length: 0xf (32-bit)
Version: 4
Abbrev Offset: 0x86
Pointer Size: 8
<0><e6>: Abbrev Number: 1 (DW_TAG_compile_unit)
<e7> DW_AT_language : 2 (non-ANSI C)
<1><e8>: Abbrev Number: 2 (DW_TAG_subprogram)
<e9> DW_AT_specification: <0xd4>
<1><ed>: Abbrev Number: 0
...
where:
- DIE 0xbf in CU@0xb2 contains an inter-CU reference to
- DIE 0xe8 in CU@0xdb, which contains an inter-CU reference to
- DIE 0xd4 back in CU@0xb2.
The dwarf error is caused by this bit of code in
cooked_indexer::ensure_cu_exists:
...
if (per_cu == m_per_cu)
return reader;
...
The dwarf error happens as follows:
- a cutu_reader A is created for CU@0xb2
- using cutu_reader A, the cooked index reader starts indexing dies, with
m_per_cu set to CU@0xb2
- while indexing it scans the attributes of DIE 0xbf and encounters the
inter-CU reference to DIE 0xe8
- it calls cooked_indexer::ensure_cu_exists, which creates a cutu_reader B for
CU@0xdb and returns it
- using cutu_reader B, it continues scanning attributes of DIE 0xe8 and
encounters the inter-CU reference to DIE 0xd4
- it calls cooked_indexer::ensure_cu_exists, the problematic bit is triggered
and cutu_reader B is returned
- using cutu_reader B, it continues scanning attributes of DIE 0xd4
- this goes wrong because:
- the attributes of the DIE are encoded using the abbreviation table at
offset 0x6c, while
- the decoding is done using cutu_reader B which uses the abbreviation table
at offset 0x86.
Fix this by removing the problematic if clause.
Since cutu_reader A is not preserved in m_index_storage,
cooked_indexer::ensure_cu_exists cannot find it there and creates a duplicate
cutu_reader C for CU@0xb2. Fix this in process_psymtab_comp_unit by preserving
the cutu_reader A as well in m_index_storage.
Tested on x86_64-linux and aarch64-linux.
PR symtab/32081
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32081
Approved-By: Tom Tromey <tom@tromey.com>
Reported-By: Andreas Schwab <schwab@linux-m68k.org>
---
gdb/dwarf2/read.c | 35 ++++++-----
.../dw2-inter-cu-forth-and-back.exp | 60 +++++++++++++++++++
2 files changed, 80 insertions(+), 15 deletions(-)
create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 8f2d7a34aef..b72b5fe8c83 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -4880,28 +4880,35 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu,
dwarf2_per_objfile *per_objfile,
cooked_index_storage *storage)
{
- cutu_reader reader (this_cu, per_objfile, nullptr, nullptr, false,
- storage->get_abbrev_cache ());
+ cutu_reader *reader = storage->get_reader (this_cu);
+ if (reader == nullptr)
+ {
+ cutu_reader new_reader (this_cu, per_objfile, nullptr, nullptr, false,
+ storage->get_abbrev_cache ());
- if (reader.comp_unit_die == nullptr)
- return;
+ if (new_reader.comp_unit_die == nullptr || new_reader.dummy_p)
+ return;
- if (reader.dummy_p)
- {
- /* Nothing. */
+ std::unique_ptr<cutu_reader> copy
+ (new cutu_reader (std::move (new_reader)));
+ reader = storage->preserve (std::move (copy));
}
- else if (this_cu->is_debug_types)
- build_type_psymtabs_reader (&reader, storage);
- else if (reader.comp_unit_die->tag != DW_TAG_partial_unit)
+
+ if (reader->comp_unit_die == nullptr || reader->dummy_p)
+ return;
+
+ if (this_cu->is_debug_types)
+ build_type_psymtabs_reader (reader, storage);
+ else if (reader->comp_unit_die->tag != DW_TAG_partial_unit)
{
bool nope = false;
if (this_cu->scanned.compare_exchange_strong (nope, true))
{
- prepare_one_comp_unit (reader.cu, reader.comp_unit_die,
+ prepare_one_comp_unit (reader->cu, reader->comp_unit_die,
language_minimal);
gdb_assert (storage != nullptr);
- cooked_indexer indexer (storage, this_cu, reader.cu->lang ());
- indexer.make_index (&reader);
+ cooked_indexer indexer (storage, this_cu, reader->cu->lang ());
+ indexer.make_index (reader);
}
}
}
@@ -16280,8 +16287,6 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
if (!per_cu->scanned.compare_exchange_strong (nope, true))
return nullptr;
}
- if (per_cu == m_per_cu)
- return reader;
cutu_reader *result = m_index_storage->get_reader (per_cu);
if (result == nullptr)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp
new file mode 100644
index 00000000000..62674bdb700
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inter-cu-forth-and-back.exp
@@ -0,0 +1,60 @@
+# Copyright 2024 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/>.
+
+# Check that the cooked index reader can handle inter-CU references:
+# - DIE1@CU1 -> DIE2@CU2
+# - DIE2@CU2 -> DIE3@CU1.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile main.c .S
+
+# Create the DWARF.
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ declare_labels label1 label2
+
+ cu {} {
+ compile_unit {{language @DW_LANG_C}} {
+ subprogram {
+ {MACRO_AT_range { main }}
+ {DW_AT_specification %$label1}
+ }
+
+ label2: subprogram {
+ {DW_AT_name main}
+ }
+ }
+ }
+
+ cu {} {
+ compile_unit {{language @DW_LANG_C}} {
+ label1: subprogram {
+ {DW_AT_specification %$label2}
+ }
+ }
+ }
+}
+
+if [prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}] {
+ return -1
+}
+
+# Regression test for PR32081.
+gdb_assert { ![regexp -nocase "error:" $gdb_file_cmd_msg] } "No Error message"
base-commit: 102b31b0b7f62e6e4f685e725f325f2ab6283c2a
--
2.35.3

View File

@@ -1,192 +0,0 @@
From 32c2e500525b91b2771022252f79e1c5c29ddf48 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 13 Mar 2025 09:39:51 +0100
Subject: [PATCH 2/2] [gdb/tdep] Backport i386_canonicalize_syscall rewrite to
gdb-16-branch
Commit fbfb29b304e ("[gdb/tdep] Rewrite i386_canonicalize_syscall") fixes
PR32770, which reproduces on the gdb-16-branch, but the commit is not ideal
for backporting because it completely rewrites i386_canonicalize_syscall.
Instead, this is a version of the patch that adds a single line entry for each
syscall value for which i386_canonicalize_syscall gives a different result
with and without the patch.
Consequently, the two versions give identical results. I've checked this for
syscalls 0 to 466.
Tested on x86_64-linux with target board unix/-m32, on top of gdb-16-branch.
PR tdep/32770
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32770
---
gdb/i386-linux-tdep.c | 153 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 152 insertions(+), 1 deletion(-)
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index a78f03fac8d..b0ca8694ba5 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -376,7 +376,158 @@ i386_all_but_ip_registers_record (struct regcache *regcache)
static enum gdb_syscall
i386_canonicalize_syscall (int syscall)
{
- enum { i386_syscall_max = 499 };
+ enum { i386_syscall_max = 466 };
+
+ switch (syscall)
+ {
+ case 359 /* socket */: return gdb_sys_socket;
+ case 360 /* socketpair */: return gdb_sys_socketpair;
+ case 361 /* bind */: return gdb_sys_bind;
+ case 362 /* connect */: return gdb_sys_connect;
+ case 363 /* listen */: return gdb_sys_listen;
+ case 365 /* getsockopt */: return gdb_sys_getsockopt;
+ case 366 /* setsockopt */: return gdb_sys_setsockopt;
+ case 367 /* getsockname */: return gdb_sys_getsockname;
+ case 368 /* getpeername */: return gdb_sys_getpeername;
+ case 369 /* sendto */: return gdb_sys_sendto;
+ case 370 /* sendmsg */: return gdb_sys_sendmsg;
+ case 371 /* recvfrom */: return gdb_sys_recvfrom;
+ case 372 /* recvmsg */: return gdb_sys_recvmsg;
+ case 373 /* shutdown */: return gdb_sys_shutdown;
+ case 393 /* semget */: return gdb_sys_semget;
+ case 394 /* semctl */: return gdb_sys_semctl;
+ case 395 /* shmget */: return gdb_sys_shmget;
+ case 396 /* shmctl */: return gdb_sys_shmctl;
+ case 397 /* shmat */: return gdb_sys_shmat;
+ case 398 /* shmdt */: return gdb_sys_shmdt;
+ case 399 /* msgget */: return gdb_sys_msgget;
+ case 400 /* msgsnd */: return gdb_sys_msgsnd;
+ case 401 /* msgrcv */: return gdb_sys_msgrcv;
+ case 402 /* msgctl */: return gdb_sys_msgctl;
+ case 420 /* semtimedop_time64 */: return gdb_sys_semtimedop;
+
+ case 320 /* utimensat */: return gdb_sys_no_syscall;
+ case 321 /* signalfd */: return gdb_sys_no_syscall;
+ case 322 /* timerfd_create */: return gdb_sys_no_syscall;
+ case 323 /* eventfd */: return gdb_sys_no_syscall;
+ case 325 /* timerfd_settime */: return gdb_sys_no_syscall;
+ case 326 /* timerfd_gettime */: return gdb_sys_no_syscall;
+ case 327 /* signalfd4 */: return gdb_sys_no_syscall;
+ case 333 /* preadv */: return gdb_sys_no_syscall;
+ case 334 /* pwritev */: return gdb_sys_no_syscall;
+ case 335 /* rt_tgsigqueueinfo */: return gdb_sys_no_syscall;
+ case 336 /* perf_event_open */: return gdb_sys_no_syscall;
+ case 337 /* recvmmsg */: return gdb_sys_no_syscall;
+ case 338 /* fanotify_init */: return gdb_sys_no_syscall;
+ case 339 /* fanotify_mark */: return gdb_sys_no_syscall;
+ case 340 /* prlimit64 */: return gdb_sys_no_syscall;
+ case 341 /* name_to_handle_at */: return gdb_sys_no_syscall;
+ case 342 /* open_by_handle_at */: return gdb_sys_no_syscall;
+ case 343 /* clock_adjtime */: return gdb_sys_no_syscall;
+ case 344 /* syncfs */: return gdb_sys_no_syscall;
+ case 345 /* sendmmsg */: return gdb_sys_no_syscall;
+ case 346 /* setns */: return gdb_sys_no_syscall;
+ case 347 /* process_vm_readv */: return gdb_sys_no_syscall;
+ case 348 /* process_vm_writev */: return gdb_sys_no_syscall;
+ case 349 /* kcmp */: return gdb_sys_no_syscall;
+ case 350 /* finit_module */: return gdb_sys_no_syscall;
+ case 351 /* sched_setattr */: return gdb_sys_no_syscall;
+ case 352 /* sched_getattr */: return gdb_sys_no_syscall;
+ case 353 /* renameat2 */: return gdb_sys_no_syscall;
+ case 354 /* seccomp */: return gdb_sys_no_syscall;
+ case 356 /* memfd_create */: return gdb_sys_no_syscall;
+ case 357 /* bpf */: return gdb_sys_no_syscall;
+ case 358 /* execveat */: return gdb_sys_no_syscall;
+ case 364 /* accept4 */: return gdb_sys_no_syscall;
+ case 374 /* userfaultfd */: return gdb_sys_no_syscall;
+ case 375 /* membarrier */: return gdb_sys_no_syscall;
+ case 376 /* mlock2 */: return gdb_sys_no_syscall;
+ case 377 /* copy_file_range */: return gdb_sys_no_syscall;
+ case 378 /* preadv2 */: return gdb_sys_no_syscall;
+ case 379 /* pwritev2 */: return gdb_sys_no_syscall;
+ case 380 /* pkey_mprotect */: return gdb_sys_no_syscall;
+ case 381 /* pkey_alloc */: return gdb_sys_no_syscall;
+ case 382 /* pkey_free */: return gdb_sys_no_syscall;
+ case 384 /* arch_prctl */: return gdb_sys_no_syscall;
+ case 385 /* io_pgetevents */: return gdb_sys_no_syscall;
+ case 386 /* rseq */: return gdb_sys_no_syscall;
+ case 404 /* clock_settime64 */: return gdb_sys_no_syscall;
+ case 405 /* clock_adjtime64 */: return gdb_sys_no_syscall;
+ case 406 /* clock_getres_time64 */: return gdb_sys_no_syscall;
+ case 407 /* clock_nanosleep_time64 */: return gdb_sys_no_syscall;
+ case 408 /* timer_gettime64 */: return gdb_sys_no_syscall;
+ case 409 /* timer_settime64 */: return gdb_sys_no_syscall;
+ case 410 /* timerfd_gettime64 */: return gdb_sys_no_syscall;
+ case 411 /* timerfd_settime64 */: return gdb_sys_no_syscall;
+ case 412 /* utimensat_time64 */: return gdb_sys_no_syscall;
+ case 413 /* pselect6_time64 */: return gdb_sys_no_syscall;
+ case 414 /* ppoll_time64 */: return gdb_sys_no_syscall;
+ case 416 /* io_pgetevents_time64 */: return gdb_sys_no_syscall;
+ case 417 /* recvmmsg_time64 */: return gdb_sys_no_syscall;
+ case 418 /* mq_timedsend_time64 */: return gdb_sys_no_syscall;
+ case 419 /* mq_timedreceive_time64 */: return gdb_sys_no_syscall;
+ case 421 /* rt_sigtimedwait_time64 */: return gdb_sys_no_syscall;
+ case 422 /* futex_time64 */: return gdb_sys_no_syscall;
+ case 423 /* sched_rr_get_interval_time64 */: return gdb_sys_no_syscall;
+ case 424 /* pidfd_send_signal */: return gdb_sys_no_syscall;
+ case 425 /* io_uring_setup */: return gdb_sys_no_syscall;
+ case 426 /* io_uring_enter */: return gdb_sys_no_syscall;
+ case 427 /* io_uring_register */: return gdb_sys_no_syscall;
+ case 428 /* open_tree */: return gdb_sys_no_syscall;
+ case 429 /* move_mount */: return gdb_sys_no_syscall;
+ case 430 /* fsopen */: return gdb_sys_no_syscall;
+ case 431 /* fsconfig */: return gdb_sys_no_syscall;
+ case 432 /* fsmount */: return gdb_sys_no_syscall;
+ case 433 /* fspick */: return gdb_sys_no_syscall;
+ case 434 /* pidfd_open */: return gdb_sys_no_syscall;
+ case 435 /* clone3 */: return gdb_sys_no_syscall;
+ case 436 /* close_range */: return gdb_sys_no_syscall;
+ case 437 /* openat2 */: return gdb_sys_no_syscall;
+ case 438 /* pidfd_getfd */: return gdb_sys_no_syscall;
+ case 439 /* faccessat2 */: return gdb_sys_no_syscall;
+ case 440 /* process_madvise */: return gdb_sys_no_syscall;
+ case 441 /* epoll_pwait2 */: return gdb_sys_no_syscall;
+ case 442 /* mount_setattr */: return gdb_sys_no_syscall;
+ case 443 /* quotactl_fd */: return gdb_sys_no_syscall;
+ case 444 /* landlock_create_ruleset */: return gdb_sys_no_syscall;
+ case 445 /* landlock_add_rule */: return gdb_sys_no_syscall;
+ case 446 /* landlock_restrict_self */: return gdb_sys_no_syscall;
+ case 447 /* memfd_secret */: return gdb_sys_no_syscall;
+ case 448 /* process_mrelease */: return gdb_sys_no_syscall;
+ case 449 /* futex_waitv */: return gdb_sys_no_syscall;
+ case 450 /* set_mempolicy_home_node */: return gdb_sys_no_syscall;
+ case 451 /* cachestat */: return gdb_sys_no_syscall;
+ case 452 /* fchmodat2 */: return gdb_sys_no_syscall;
+ case 453 /* map_shadow_stack */: return gdb_sys_no_syscall;
+ case 454 /* futex_wake */: return gdb_sys_no_syscall;
+ case 455 /* futex_wait */: return gdb_sys_no_syscall;
+ case 456 /* futex_requeue */: return gdb_sys_no_syscall;
+ case 457 /* statmount */: return gdb_sys_no_syscall;
+ case 458 /* listmount */: return gdb_sys_no_syscall;
+ case 459 /* lsm_get_self_attr */: return gdb_sys_no_syscall;
+ case 460 /* lsm_set_self_attr */: return gdb_sys_no_syscall;
+ case 461 /* lsm_list_modules */: return gdb_sys_no_syscall;
+ case 462 /* mseal */: return gdb_sys_no_syscall;
+ case 463 /* setxattrat */: return gdb_sys_no_syscall;
+ case 464 /* getxattrat */: return gdb_sys_no_syscall;
+ case 465 /* listxattrat */: return gdb_sys_no_syscall;
+ case 466 /* removexattrat */: return gdb_sys_no_syscall;
+
+ case 222 /* unused */: return gdb_sys_no_syscall;
+ case 223 /* unused */: return gdb_sys_no_syscall;
+ case 251 /* unused */: return gdb_sys_no_syscall;
+ case 285 /* unused */: return gdb_sys_no_syscall;
+ case 387 /* unused */: return gdb_sys_no_syscall;
+ case 388 /* unused */: return gdb_sys_no_syscall;
+ case 389 /* unused */: return gdb_sys_no_syscall;
+ case 390 /* unused */: return gdb_sys_no_syscall;
+ case 391 /* unused */: return gdb_sys_no_syscall;
+ case 392 /* unused */: return gdb_sys_no_syscall;
+ case 415 /* unused */: return gdb_sys_no_syscall;
+
+ default:
+ break;
+ }
if (syscall <= i386_syscall_max)
return (enum gdb_syscall) syscall;
--
2.43.0

View File

@@ -1,264 +0,0 @@
From 64dc13a4571b4092726291f3ee30bf5c2166fa13 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Sat, 27 Jul 2024 10:05:20 +0200
Subject: [PATCH 09/46] [gdb/tdep] Fix arm thumb2 hw breakpoint
On an aarch64-linux system with 32-bit userland running in a chroot, and using
target board unix/mthumb I get:
...
(gdb) hbreak hbreak.c:27^M
Hardware assisted breakpoint 2 at 0x4004e2: file hbreak.c, line 27.^M
(gdb) PASS: gdb.base/hbreak.exp: hbreak
continue^M
Continuing.^M
Unexpected error setting breakpoint: Invalid argument.^M
(gdb) XFAIL: gdb.base/hbreak.exp: continue to break-at-exit after hbreak
...
due to this call in arm_linux_nat_target::low_prepare_to_resume:
...
if (ptrace (PTRACE_SETHBPREGS, pid,
(PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0)
perror_with_name (_("Unexpected error setting breakpoint"));
...
This problem does not happen if instead we use a 4-byte aligned address.
This may or may not be a kernel bug.
Work around this by first using an inoffensive address bpts[i].address & ~0x7.
Likewise in arm_target::low_prepare_to_resume, which fixes the same fail on
target board native-gdbserver/mthumb.
While we're at it:
- use arm_hwbp_control_is_initialized in
arm_linux_nat_target::low_prepare_to_resume,
- handle the !arm_hwbp_control_is_initialized case explicitly,
- add missing '_()' in arm_target::low_prepare_to_resume,
- make error messages identical between arm_target::low_prepare_to_resume and
arm_linux_nat_target::low_prepare_to_resume,
- factor out sethbpregs_hwbp_address and sethbpregs_hwbp_control to
make the implementation more readable.
Remove the tentative xfail added in d0af16d5a10 ("[gdb/testsuite] Add xfail in
gdb.base/hbreak.exp") by simply reverting the commit.
Tested on arm-linux.
Approved-By: Luis Machado <luis.machado@arm.com>
Tested-By: Luis Machado <luis.machado@arm.com>
---
gdb/arm-linux-nat.c | 98 ++++++++++++++++++++++++++++++++++----
gdbserver/linux-arm-low.cc | 65 ++++++++++++++++++++-----
2 files changed, 141 insertions(+), 22 deletions(-)
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index ac53bed72d7..7b4faacd601 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -876,6 +876,14 @@ arm_hwbp_control_is_enabled (arm_hwbp_control_t control)
return control & 0x1;
}
+/* Is the breakpoint control value CONTROL initialized? */
+
+static int
+arm_hwbp_control_is_initialized (arm_hwbp_control_t control)
+{
+ return control != 0;
+}
+
/* Change a breakpoint control word so that it is in the disabled state. */
static arm_hwbp_control_t
arm_hwbp_control_disable (arm_hwbp_control_t control)
@@ -1234,6 +1242,34 @@ arm_linux_nat_target::low_delete_thread (struct arch_lwp_info *arch_lwp)
xfree (arch_lwp);
}
+/* For PID, set the address register of hardware breakpoint pair I to
+ ADDRESS. */
+
+static void
+sethbpregs_hwbp_address (int pid, int i, unsigned int address)
+{
+ PTRACE_TYPE_ARG3 address_reg = (PTRACE_TYPE_ARG3) ((i << 1) + 1);
+
+ errno = 0;
+
+ if (ptrace (PTRACE_SETHBPREGS, pid, address_reg, &address) < 0)
+ perror_with_name (_("Unexpected error updating breakpoint address"));
+}
+
+/* For PID, set the control register of hardware breakpoint pair I to
+ CONTROL. */
+
+static void
+sethbpregs_hwbp_control (int pid, int i, arm_hwbp_control_t control)
+{
+ PTRACE_TYPE_ARG3 control_reg = (PTRACE_TYPE_ARG3) ((i << 1) + 2);
+
+ errno = 0;
+
+ if (ptrace (PTRACE_SETHBPREGS, pid, control_reg, &control) < 0)
+ perror_with_name (_("Unexpected error setting breakpoint control"));
+}
+
/* Called when resuming a thread.
The hardware debug registers are updated when there is any change. */
@@ -1257,16 +1293,58 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
for (i = 0; i < arm_linux_get_hw_breakpoint_count (); i++)
if (arm_lwp_info->bpts_changed[i])
{
- errno = 0;
- if (arm_hwbp_control_is_enabled (bpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0)
- perror_with_name (_("Unexpected error setting breakpoint"));
-
- if (bpts[i].control != 0)
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 2), &bpts[i].control) < 0)
- perror_with_name (_("Unexpected error setting breakpoint"));
+ unsigned int address = bpts[i].address;
+ arm_hwbp_control_t control = bpts[i].control;
+
+ if (!arm_hwbp_control_is_initialized (control))
+ {
+ /* Nothing to do. */
+ }
+ else if (!arm_hwbp_control_is_enabled (control))
+ {
+ /* Disable hardware breakpoint, just write the control
+ register. */
+ sethbpregs_hwbp_control (pid, i, control);
+ }
+ else
+ {
+ /* We used to do here simply:
+ 1. address_reg = address
+ 2. control_reg = control
+ but the write to address_reg can fail for thumb2 instructions if
+ the address is not 4-byte aligned.
+
+ It's not clear whether this is a kernel bug or not, partly
+ because PTRACE_SETHBPREGS is undocumented.
+
+ The context is that we're using two ptrace calls to set the two
+ halves of a register pair. For each ptrace call, the kernel must
+ check the arguments, and return -1 and set errno appropriately if
+ something is wrong. One of the aspects that needs validation is
+ whether, in terms of hw_breakpoint_arch_parse, the breakpoint
+ address matches the breakpoint length. This aspect can only be
+ checked by looking in both registers, which only makes sense
+ once a pair is written in full.
+
+ The problem is that the kernel checks this aspect after each
+ ptrace call, and consequently for the first call it may be
+ checking this aspect using a default or previous value for the
+ part of the pair not written by the call. A possible fix for
+ this would be to only check this aspect when writing the
+ control reg.
+
+ Work around this by first using an inoffensive address, which is
+ guaranteed to hit the offset == 0 case in
+ hw_breakpoint_arch_parse. */
+ unsigned int aligned_address = address & ~0x7U;
+ if (aligned_address != address)
+ {
+ sethbpregs_hwbp_address (pid, i, aligned_address);
+ sethbpregs_hwbp_control (pid, i, control);
+ }
+ sethbpregs_hwbp_address (pid, i, address);
+ sethbpregs_hwbp_control (pid, i, control);
+ }
arm_lwp_info->bpts_changed[i] = 0;
}
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index eec4649b235..ee89949a2a2 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -819,6 +819,34 @@ arm_target::low_new_fork (process_info *parent, process_info *child)
child_lwp_info->wpts_changed[i] = 1;
}
+/* For PID, set the address register of hardware breakpoint pair I to
+ ADDRESS. */
+
+static void
+sethbpregs_hwbp_address (int pid, int i, unsigned int address)
+{
+ PTRACE_TYPE_ARG3 address_reg = (PTRACE_TYPE_ARG3) ((i << 1) + 1);
+
+ errno = 0;
+
+ if (ptrace (PTRACE_SETHBPREGS, pid, address_reg, &address) < 0)
+ perror_with_name (_("Unexpected error updating breakpoint address"));
+}
+
+/* For PID, set the control register of hardware breakpoint pair I to
+ CONTROL. */
+
+static void
+sethbpregs_hwbp_control (int pid, int i, arm_hwbp_control_t control)
+{
+ PTRACE_TYPE_ARG3 control_reg = (PTRACE_TYPE_ARG3) ((i << 1) + 2);
+
+ errno = 0;
+
+ if (ptrace (PTRACE_SETHBPREGS, pid, control_reg, &control) < 0)
+ perror_with_name (_("Unexpected error setting breakpoint control"));
+}
+
/* Called when resuming a thread.
If the debug regs have changed, update the thread's copies. */
void
@@ -834,19 +862,32 @@ arm_target::low_prepare_to_resume (lwp_info *lwp)
for (i = 0; i < arm_linux_get_hw_breakpoint_count (); i++)
if (lwp_info->bpts_changed[i])
{
- errno = 0;
+ unsigned int address = proc_info->bpts[i].address;
+ arm_hwbp_control_t control = proc_info->bpts[i].control;
- if (arm_hwbp_control_is_enabled (proc_info->bpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 1),
- &proc_info->bpts[i].address) < 0)
- perror_with_name ("Unexpected error setting breakpoint address");
-
- if (arm_hwbp_control_is_initialized (proc_info->bpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 2),
- &proc_info->bpts[i].control) < 0)
- perror_with_name ("Unexpected error setting breakpoint");
+ if (!arm_hwbp_control_is_initialized (control))
+ {
+ /* Nothing to do. */
+ }
+ else if (!arm_hwbp_control_is_enabled (control))
+ {
+ /* Disable hardware breakpoint, just write the control
+ register. */
+ sethbpregs_hwbp_control (pid, i, control);
+ }
+ else
+ {
+ /* See arm_linux_nat_target::low_prepare_to_resume for detailed
+ comment. */
+ unsigned int aligned_address = address & ~0x7U;
+ if (aligned_address != address)
+ {
+ sethbpregs_hwbp_address (pid, i, aligned_address);
+ sethbpregs_hwbp_control (pid, i, control);
+ }
+ sethbpregs_hwbp_address (pid, i, address);
+ sethbpregs_hwbp_control (pid, i, control);
+ }
lwp_info->bpts_changed[i] = 0;
}
--
2.43.0

View File

@@ -1,69 +0,0 @@
From 0494211cb5f418654ca3a4ac1b9f10518426732f Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 13 Nov 2024 19:44:21 +0100
Subject: [PATCH 15/46] [gdb/tdep] Fix recording of T1 push
When running test-case gdb.reverse/recursion.exp on arm-linux with target
board unix/-mthumb, I run into:
...
(gdb) PASS: gdb.reverse/recursion.exp: Skipping recursion from inside
reverse-next^M
bar (x=4195569) at /home/linux/gdb/src/gdb/testsuite/gdb.reverse/recursion.c:34^M
34 int r = foo (x);^M
(gdb) FAIL: gdb.reverse/recursion.exp: print frame when stepping out
...
The problem is the recording of the T1 push instruction [1,2], specifically:
...
000004d8 <foo>:
4d8: b580 push {r7, lr}
...
The current code fails to add a memory record for the memory written with the
value of the lr register.
Fix this by adding the missing memory record.
Tested on arm-linux.
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Luis Machado <luis.machado@arm.com>
[1] https://developer.arm.com/documentation/ddi0406/c/Application-Level-Architecture/Instruction-Details/Encoding-of-lists-of-ARM-core-registers
[2] https://developer.arm.com/documentation/ddi0597/2024-09/T32-Instructions-by-Encoding/16-bit?lang=en#pushpop16
---
gdb/arm-tdep.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f36ce631a08..d898a426609 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -13561,9 +13561,12 @@ thumb_record_misc (arm_insn_decode_record *thumb_insn_r)
record_buf[0] = bits (thumb_insn_r->arm_insn, 0, 2);
thumb_insn_r->reg_rec_count = 1;
break;
- case 4: /* fall through */
case 5:
- /* PUSH. */
+ /* PUSH with lr. */
+ register_count++;
+ [[fallthrough]];
+ case 4:
+ /* PUSH without lr. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
regcache_raw_read_unsigned (reg_cache, ARM_SP_REGNUM, &u_regval);
while (register_bits)
@@ -13572,8 +13575,7 @@ thumb_record_misc (arm_insn_decode_record *thumb_insn_r)
register_count++;
register_bits = register_bits >> 1;
}
- start_address = u_regval - \
- (4 * (bit (thumb_insn_r->arm_insn, 8) + register_count));
+ start_address = u_regval - (4 * register_count);
thumb_insn_r->mem_rec_count = register_count;
while (register_count)
{
--
2.43.0

View File

@@ -1,46 +0,0 @@
From 559ec501f594101dd786ce7dad1c89069934c965 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 13 Nov 2024 19:37:04 +0100
Subject: [PATCH 14/46] [gdb/tdep] Handle sycall statx for arm-linux
When running test-case gdb.reverse/fstatat-reverse.exp on arm-linux, I run
into:
...
(gdb) continue^M
Continuing.^M
Process record and replay target doesn't support syscall number 397^M
Process record does not support instruction 0xdf00 at address 0xf7ebf774.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0xf7ebf774 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6^M
(gdb) FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2
...
Syscall number 397 stands for statx on arm-linux.
Fix this by handling 397 in arm_canonicalize_syscall.
Tested on arm-linux.
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Luis Machado <luis.machado@arm.com>
---
gdb/arm-linux-tdep.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 43869e4fcfe..bb3d808bd5a 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1644,6 +1644,7 @@ arm_canonicalize_syscall (int syscall)
case 379: return gdb_sys_finit_module;
*/
case 384: return gdb_sys_getrandom;
+ case 397: return gdb_sys_statx;
case 983041: /* ARM_breakpoint */ return gdb_sys_no_syscall;
case 983042: /* ARM_cacheflush */ return gdb_sys_no_syscall;
case 983043: /* ARM_usr26 */ return gdb_sys_no_syscall;
--
2.43.0

View File

@@ -1,80 +0,0 @@
From 522e3a4837eaef79fc255b29c5ed75fc6f817ce1 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 13 Nov 2024 22:41:35 +0100
Subject: [PATCH 16/46] [gdb/tdep] Handle syscall clock_gettime64 for arm-linux
When running test-case gdb.reverse/time-reverse.exp on arm-linux, I run into:
...
(gdb) continue^M
Continuing.^M
Process record and replay target doesn't support syscall number 403^M
Process record does not support instruction 0xdf00 at address 0xf7ebf774.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0xf7ebf774 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6^M
(gdb) FAIL: $exp: mode=c: continue to breakpoint: marker2
...
Syscall number 403 stands for clock_gettime64 on arm-linux.
Fix this by handling 403 in arm_canonicalize_syscall, and handling
gdb_sys_clock_gettime64 elsewhere.
Since i386_canonicalize_syscall is the identity function, enum value
gdb_sys_clock_gettime64 gets a value to match i386, which also happens to be
403.
Tested on arm-linux.
Approved-By: Guinevere Larsen <guinevere@redhat.com> (record-full)
---
gdb/arm-linux-tdep.c | 1 +
gdb/linux-record.c | 6 ++++++
gdb/linux-record.h | 1 +
3 files changed, 8 insertions(+)
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index bb3d808bd5a..4dc8f00d8c2 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1645,6 +1645,7 @@ arm_canonicalize_syscall (int syscall)
*/
case 384: return gdb_sys_getrandom;
case 397: return gdb_sys_statx;
+ case 403: return gdb_sys_clock_gettime64;
case 983041: /* ARM_breakpoint */ return gdb_sys_no_syscall;
case 983042: /* ARM_cacheflush */ return gdb_sys_no_syscall;
case 983043: /* ARM_usr26 */ return gdb_sys_no_syscall;
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 549ea1bd713..33efa026a53 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -1820,6 +1820,12 @@ Do you want to stop the program?"),
return -1;
break;
+ case gdb_sys_clock_gettime64:
+ /* Size of struct __timespec64 is 16. */
+ if (record_mem_at_reg (regcache, tdep->arg2, 16))
+ return -1;
+ break;
+
case gdb_sys_clock_getres:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
return -1;
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
index 962cedc3d34..54696124bf2 100644
--- a/gdb/linux-record.h
+++ b/gdb/linux-record.h
@@ -512,6 +512,7 @@ enum gdb_syscall {
gdb_sys_inotify_init1 = 332,
gdb_sys_getrandom = 355,
gdb_sys_statx = 383,
+ gdb_sys_clock_gettime64 = 403,
gdb_sys_socket = 500,
gdb_sys_connect = 501,
gdb_sys_accept = 502,
--
2.43.0

View File

@@ -1,168 +0,0 @@
From 9afcf99e16a4adecc7d1a18c30bed65a29c96e52 Mon Sep 17 00:00:00 2001
From: Andreas Arnez <arnez@linux.ibm.com>
Date: Tue, 19 Nov 2024 18:24:06 +0100
Subject: [PATCH] [gdb/tdep] s390: Add arch15 record/replay support
Enable recording of the new "arch15" instructions on z/Architecture
targets.
---
gdb/s390-tdep.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 75 insertions(+), 3 deletions(-)
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index dcac407caef..e25bcfaf974 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -4245,6 +4245,10 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0xb917: /* LLGTR - load logical thirty one bits */
case 0xb91c: /* MSGFR - multiply single 64<32 */
case 0xb946: /* BCTGR - branch on count */
+ case 0xb968: /* CLZG - count leading zeros */
+ case 0xb969: /* CTZG - count trailing zeros */
+ case 0xb96c: /* BEXTG - bit extract */
+ case 0xb96d: /* BDEPG - bit deposit */
case 0xb984: /* LLGCR - load logical character */
case 0xb985: /* LLGHR - load logical halfword */
case 0xb9e2: /* LOCGR - load on condition */
@@ -5125,7 +5129,14 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- /* 0xc86-0xc8f undefined */
+ case 0xc86: /* CAL - compare and load 32 */
+ case 0xc87: /* CALG - compare and load 64 */
+ case 0xc8f: /* CALGF - compare and load 64<32 */
+ if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
+ return -1;
+ break;
default:
goto UNKNOWN_OP;
@@ -5336,6 +5347,16 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0xe33b: /* LZRF - load and zero rightmost byte */
case 0xe351: /* MSY - multiply single */
case 0xe358: /* LY - load */
+ case 0xe360: /* LXAB - load indexed address (shift 0) */
+ case 0xe361: /* LLXAB - load logical indexed address (shift 0) */
+ case 0xe362: /* LXAH - load indexed address (shift 1) */
+ case 0xe363: /* LLXAH - load logical indexed address (shift 1) */
+ case 0xe364: /* LXAF - load indexed address (shift 2) */
+ case 0xe365: /* LLXAF - load logical indexed address (shift 2) */
+ case 0xe366: /* LXAG - load indexed address (shift 3) */
+ case 0xe367: /* LLXAG - load logical indexed address (shift 3) */
+ case 0xe368: /* LXAQ - load indexed address (shift 4) */
+ case 0xe369: /* LLXAQ - load logical indexed address (shift 4) */
case 0xe371: /* LAY - load address */
case 0xe373: /* ICY - insert character */
case 0xe376: /* LB - load byte */
@@ -5448,7 +5469,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
/* 0xe35d undefined */
- /* 0xe360-0xe36f undefined */
+ /* 0xe36a-0xe36f undefined */
case 0xe372: /* STCY - store character */
case 0xe3c3: /* STCH - store character high */
@@ -5569,6 +5590,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0xe750: /* VPOPCT - vector population count */
case 0xe752: /* VCTZ - vector count trailing zeros */
case 0xe753: /* VCLZ - vector count leading zeros */
+ case 0xe754: /* VGEM - vector generate element masks */
case 0xe756: /* VLR - vector load */
case 0xe75f: /* VSEG -vector sign extend to doubleword */
case 0xe760: /* VMRL - vector merge low */
@@ -5602,6 +5624,8 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0xe785: /* VBPERM - vector bit permute */
case 0xe786: /* VSLD - vector shift left double by bit */
case 0xe787: /* VSRD - vector shift right double by bit */
+ case 0xe788: /* VEVAL - vector evaluate */
+ case 0xe789: /* VBLEND - vector blend */
case 0xe78b: /* VSTRS - vector string search */
case 0xe78c: /* VPERM - vector permute */
case 0xe78d: /* VSEL - vector select */
@@ -5624,6 +5648,10 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0xe7ad: /* VMALO - vector multiply and add logical odd */
case 0xe7ae: /* VMAE - vector multiply and add even */
case 0xe7af: /* VMAO - vector multiply and add odd */
+ case 0xe7b0: /* VDL - vector divide logical */
+ case 0xe7b1: /* VRL - vector remainder logical */
+ case 0xe7b2: /* VD - vector divide */
+ case 0xe7b3: /* VR - vector remainder */
case 0xe7b4: /* VGFM - vector Galois field multiply sum */
case 0xe7b8: /* VMSL - vector multiply sum logical */
case 0xe7b9: /* VACCC - vector add with carry compute carry */
@@ -5799,6 +5827,8 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* 0xe747-0xe749 undefined */
+ case 0xe64a: /* VCVDQ - vector convert to decimal 128 bits */
+ case 0xe64e: /* VCVBQ - vector convert to binary 128 bits */
case 0xe651: /* VCLZDP - vector count leading zero digits */
case 0xe654: /* VUPKZH - vector unpack zoned high */
case 0xe658: /* VCVD - vector convert to decimal 32 bit */
@@ -5839,6 +5869,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
case 0xe65f: /* VTP - vector test decimal */
+ case 0xe67f: /* VTZ - vector test zoned */
/* flags + FPC */
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -5932,7 +5963,48 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- /* 0xeb15-0xeb1b undefined */
+ case 0xeb16: /* PFCR - perform functions with concurrent results */
+ if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
+ return -1;
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM, &tmp);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1],
+ ibyte[4]);
+ {
+ uint8_t fc = tmp & 0xff;
+ if (fc == 0) /* PFCR-QAF */
+ {
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ }
+ else if (fc >= 1 && fc <= 4)
+ {
+ /* Compare and swap and double/triple store. */
+ int bytesize = fc & 1 ? 4 : 8;
+ int startbit = fc >= 3 ? 16 : 32;
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
+ return -1;
+ regcache_raw_read_unsigned (regcache,
+ S390_R0_REGNUM + inib[3], &tmp);
+ for (i = startbit; i < 64; i += 16)
+ {
+ oaddr = s390_record_calc_disp (gdbarch, regcache, 0,
+ (tmp >> i) & 0xffff, 0);
+ if (record_full_arch_list_add_mem (oaddr, bytesize))
+ return -1;
+ }
+ }
+ else
+ {
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown PFCR FC %02x at %s.\n",
+ fc, paddress (gdbarch, addr));
+ return -1;
+ }
+ }
+ break;
+
+ /* 0xeb17-0xeb1b undefined */
/* 0xeb1e-0xeb1f undefined */
/* 0xeb22 undefined */
base-commit: 029bb9a91184eae765dda5220ccfb29d7d02f395
--
2.43.0

View File

@@ -1,7 +1,8 @@
From 6de9111c512de99fd8cb3ea89f9890b1d72f6ef0 Mon Sep 17 00:00:00 2001
From da210b312eab6444f6d20d62dc6c3c47413b93b2 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 21 Apr 2023 09:12:35 +0200
Subject: [PATCH] Compile ada hello world for skip_ada_tests
Date: Mon, 7 Apr 2025 13:53:56 +0200
Subject: [PATCH 15/48] [gdb/testsuite] Compile ada hello world for
skip_ada_tests
For openSUSE Leap 15.0 with gcc-PIE installed (which makes gcc create PIE
executables by default) we get:
@@ -41,10 +42,10 @@ gdb/testsuite/ChangeLog:
2 files changed, 39 insertions(+)
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 4bf1368f29f..7d8fbf01fbd 100644
index 05151d3d8f1..4d04d597474 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -90,12 +90,43 @@ proc gdb_compile_ada_1 {source dest type options} {
@@ -109,12 +109,43 @@ proc gdb_compile_ada_1 {source dest type options} {
# compile was successful.
proc gdb_compile_ada {source dest type options} {
@@ -89,18 +90,18 @@ index 4bf1368f29f..7d8fbf01fbd 100644
# used a different naming convention from many of the other gdb tests,
# and this difference was preserved during the conversion to
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 990d0c8a70f..6c1f59ef4a6 100644
index 5d909e937db..fda55e06277 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -145,6 +145,7 @@ load_lib cache.exp
@@ -157,6 +157,7 @@ load_lib cache.exp
load_lib gdb-utils.exp
load_lib memory.exp
load_lib check-test-names.exp
+load_lib ada.exp
# The path to the GDB binary to test.
global GDB
@@ -2538,6 +2539,13 @@ proc allow_ada_tests {} {
# The path to the GCORE script to test.
global GCORE
@@ -2715,6 +2716,13 @@ proc allow_ada_tests {} {
# Currently gdb_ada_compile doesn't support remote host.
return 0
}
@@ -114,8 +115,6 @@ index 990d0c8a70f..6c1f59ef4a6 100644
return 1
}
base-commit: af4a87e2b3c2ac5acae1e6f4405fc59e1218de74
--
2.35.3
2.43.0

View File

@@ -67,7 +67,7 @@ index 00000000000..c2b9a1134bd
+
+clean_restart ${binfile}
+
+gdb_test_no_output "set build-id-verbose 1"
+gdb_test_no_output "set rpm-suggestion enabled on"
+
+set test "zypper hint printed"
+if { ![gdb_breakpoint main qualified] } {

View File

@@ -1,59 +0,0 @@
From 729d6b050f41d1d058c0f22f2c767995f5441b7a Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Sun, 27 Oct 2024 08:55:16 +0000
Subject: [PATCH] gdb/testsuite: avoid intermittent failures on a debuginfod
test
I saw a failure in gdb.debuginfod/build-id-no-debug-warning.exp which
I could only produce one time.
Normally the test output looks like this:
file /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.build-id/0c/30f589cc4f2c0fb22c8914d042ddf39c9a3885.debug
Reading symbols from /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.build-id/0c/30f589cc4f2c0fb22c8914d042ddf39c9a3885.debug...
Downloading separate debug info for /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.build-id/0c/30f589cc4f2c0fb22c8914d042ddf39c9a3885.debug...
Reading symbols from /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.client_cache/0c30f589cc4f2c0fb22c8914d042ddf39c9a3885/debuginfo...
(gdb) PASS: gdb.debuginfod/build-id-no-debug-warning.exp: local_debuginfod: debuginfod running, info downloaded, no war
But one time I saw this:
file /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.build-id/0c/30f589cc4f2c0fb22c8914d042ddf39c9a3885.debug
Reading symbols from /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.build-id/0c/30f589cc4f2c0fb22c8914d042ddf39c9a3885.debug...
Downloading 6.77 K separate debug info for /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.build-id/0c/30f589cc4f2c0fb22c8914d042ddf39c9a3885.debug...
Reading symbols from /tmp/build/gdb/testsuite/outputs/gdb.debuginfod/build-id-no-debug-warning/.client_cache/0c30f589cc4f2c0fb22c8914d042ddf39c9a3885/debuginfo...
(gdb) FAIL: gdb.debuginfod/build-id-no-debug-warning.exp: local_debuginfod: debuginfod running, info downloaded, no warnings
The difference is the "Downloading separate debug info for ..." line
has gained an extra '6.77 K' component. When I got the FAIL the
machine was under heavy load, so I suspect everything was running
pretty slow. I think the size is only added when the debuginfod
download is taking its time.
Anyway, the test in question is not expecting to see a size, which is
why it failed.
Every other debuginfod test does allow for an optional size being
printed, so lets update this test to also accept an optional size,
this should prevent failures like this in the future.
---
gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
index 8ee3bb0e78c..fcadfddd293 100644
--- a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
+++ b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp
@@ -148,7 +148,7 @@ proc_with_prefix local_debuginfod { } {
gdb_test "file ${build_id_debug_file}" \
[multi_line \
"Reading symbols from ${build_id_debug_file}\\.\\.\\." \
- "Downloading separate debug info for ${build_id_debug_file}\\.\\.\\." \
+ "Downloading\[^\r\n\]*separate debug info for ${build_id_debug_file}\\.\\.\\." \
"Reading symbols from ${cache}/\[^\r\n\]+\\.\\.\\.(?:\r\nExpanding full symbols from \[^\r\n\]+)*"] \
"debuginfod running, info downloaded, no warnings"
}
base-commit: 6cfb7bf81be3ab6f131dbc6a27eefca516cf7517
--
2.43.0

View File

@@ -1,274 +0,0 @@
From 42f3a32877ab455607662c7a12c7a793f3744e4e Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 10 Jun 2024 10:43:10 +0200
Subject: [PATCH 08/46] [gdb/testsuite] Don't use set auto-solib-add off
In test-case gdb.mi/mi-var-child-f.exp, we have:
...
mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
mi_runto prog_array
mi_gdb_test "nosharedlibrary" ".*\\^done"
...
This was added to avoid a name clash between the array variable as defined in
gdb.mi/array.f90 and debug info in shared libraries, and used in other places
in the testsuite.
The same workaround is also used to ignore symbols from shared libraries when
excercising for instance a command that prints all symbols.
However, this approach can cause problems for targets like arm that require
symbol info for some libraries like ld.so and libc to fully function.
While absense of debug info for shared libraries should be handled gracefully
(which does need fixing, see PR31817), failure to do so should not result
in failures in unrelated test-cases.
Fix this by removing "set auto-solib-add off".
This ensures that we don't run into PR31817, while the presence of
nosharedlibrary still ensures that in the rest of the test-case we're not
bothered by shared library symbols.
Likewise in other test-cases.
Approved-by: Kevin Buettner <kevinb@redhat.com>
Tested on arm-linux.
---
gdb/testsuite/gdb.base/gold-gdb-index.exp | 4 ++--
gdb/testsuite/gdb.base/info-types.exp.tcl | 3 ++-
gdb/testsuite/gdb.base/print-symbol-loading.exp | 4 +++-
gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 6 ++----
gdb/testsuite/gdb.fortran/allocated.exp | 3 ---
gdb/testsuite/gdb.fortran/array-slices-bad.exp | 3 ---
gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp | 3 ---
gdb/testsuite/gdb.fortran/array-slices.exp | 3 ---
gdb/testsuite/gdb.fortran/info-modules.exp | 3 ---
gdb/testsuite/gdb.fortran/lbound-ubound.exp | 3 ---
gdb/testsuite/gdb.fortran/module.exp | 3 ---
gdb/testsuite/gdb.fortran/subarray.exp | 3 ---
gdb/testsuite/gdb.mi/mi-fortran-modules.exp | 3 ---
gdb/testsuite/gdb.mi/mi-var-child-f.exp | 3 ---
14 files changed, 9 insertions(+), 38 deletions(-)
diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.exp b/gdb/testsuite/gdb.base/gold-gdb-index.exp
index c9c6598c3fa..0309dd353ad 100644
--- a/gdb/testsuite/gdb.base/gold-gdb-index.exp
+++ b/gdb/testsuite/gdb.base/gold-gdb-index.exp
@@ -32,12 +32,12 @@ if { [have_index $binfile] != "gdb_index" } {
return -1
}
-gdb_test_no_output "set auto-solib-add off"
-
if {![runto_main]} {
return 0
}
+gdb_test_no_output "nosharedlibrary"
+
gdb_test_no_output "set breakpoint pending off"
gdb_test "break N1::misspelled" "Function \"N1::misspelled\" not defined\."
diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl
index 69d53b9f8de..0a33afedf86 100644
--- a/gdb/testsuite/gdb.base/info-types.exp.tcl
+++ b/gdb/testsuite/gdb.base/info-types.exp.tcl
@@ -32,12 +32,13 @@ proc run_test { lang } {
"${testfile}" $srcfile "debug $lang"]} {
return -1
}
- gdb_test_no_output "set auto-solib-add off"
if ![runto_main] then {
return 0
}
+ gdb_test_no_output "nosharedlibrary"
+
set file_re "File .*[string_to_regexp $srcfile]:"
if { $lang == "c++" } {
diff --git a/gdb/testsuite/gdb.base/print-symbol-loading.exp b/gdb/testsuite/gdb.base/print-symbol-loading.exp
index b61dba33377..b3520f1e032 100644
--- a/gdb/testsuite/gdb.base/print-symbol-loading.exp
+++ b/gdb/testsuite/gdb.base/print-symbol-loading.exp
@@ -95,10 +95,12 @@ proc test_load_shlib { print_symbol_loading } {
global gdb_prompt
with_test_prefix "shlib ${print_symbol_loading}" {
clean_restart ${binfile}
- gdb_test_no_output "set auto-solib-add off"
if ![runto_main] {
return -1
}
+
+ gdb_test_no_output "nosharedlibrary"
+
gdb_test_no_output "set print symbol-loading $print_symbol_loading"
set test_name "load shared-lib"
set libc_re \
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index 59840b8d0e2..e2e4f240c88 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -29,14 +29,12 @@ proc_with_prefix test_relocated { exec_path lib_path complaint_re readnow_p } {
clean_restart $exec_path
gdb_load_shlib $lib_path
- # Don't load the symbols for $lib_path during runto_main.
- # Instead, we do this afterwards using "sharedlibrary $lib_path".
- gdb_test_no_output "set auto-solib-add off"
-
if { ![runto_main] } {
return
}
+ gdb_test_no_output "nosharedlibrary"
+
# Test for presence of complaint.
with_complaints 1 {
set have_complaint 0
diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp
index d8aee441d7f..1d87bf76244 100644
--- a/gdb/testsuite/gdb.fortran/allocated.exp
+++ b/gdb/testsuite/gdb.fortran/allocated.exp
@@ -25,9 +25,6 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
if ![fortran_runto_main] {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
index 8f23b38599f..ac4a77d2e39 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
@@ -30,9 +30,6 @@ if {![runto [gdb_get_line_number "First Breakpoint"]]} {
return -1
}
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
# Avoid libc symbols, in particular the 'array' type.
gdb_test_no_output "nosharedlibrary"
diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
index 5bdc7d59f16..5a0f0406afe 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
@@ -25,9 +25,6 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
if ![fortran_runto_main] {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index f2928676bf3..919a2c6e7eb 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -58,9 +58,6 @@ proc run_test { repack } {
clean_restart ${binfile}
- # Avoid shared lib symbols.
- gdb_test_no_output "set auto-solib-add off"
-
if ![fortran_runto_main] {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/info-modules.exp b/gdb/testsuite/gdb.fortran/info-modules.exp
index e6c515ff70f..c8ae7362223 100644
--- a/gdb/testsuite/gdb.fortran/info-modules.exp
+++ b/gdb/testsuite/gdb.fortran/info-modules.exp
@@ -28,9 +28,6 @@ if { [prepare_for_testing "failed to prepare" $testfile \
return -1
}
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
if { ![fortran_runto_main] } {
perror "Could not run to main."
return
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
index 01597ca23ff..781d3614f4c 100644
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
@@ -25,9 +25,6 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
return -1
}
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
if ![fortran_runto_main] {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp
index eea83ad71f1..df7ee3b9605 100644
--- a/gdb/testsuite/gdb.fortran/module.exp
+++ b/gdb/testsuite/gdb.fortran/module.exp
@@ -31,9 +31,6 @@ gdb_test "p modmany::var_i" " = 14" "stopped language detection"
gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant"
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
if {![fortran_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index 1ec80e78fe4..70a7a2345ba 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -27,9 +27,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-# Avoid shared lib symbols.
-gdb_test_no_output "set auto-solib-add off"
-
if {![fortran_runto_main]} {
return
}
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 13996b9547f..5441d8f15e5 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -30,9 +30,6 @@ if {[build_executable "failed to prepare" ${testfile} \
mi_clean_restart $binfile
-# Avoid shared lib symbols.
-mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
-
mi_runto_main
# Avoid libc symbols.
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
index 258cbe7cb40..441c3a09366 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -32,9 +32,6 @@ if {[mi_clean_restart $binfile]} {
return
}
-# Avoid shared lib symbols.
-mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
-
mi_runto prog_array
# Avoid libc symbols, in particular the 'array' type.
--
2.43.0

View File

@@ -1,40 +0,0 @@
From 002b882370fb3d69b7c89fc99e85fc1b767567b9 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 29 Aug 2024 11:39:02 +0200
Subject: [PATCH 2/2] [gdb/testsuite] Fix another regexp in
gdb.threads/stepi-over-clone.exp
On openSUSE Tumbleweed, I run into:
...
(gdb) PASS: gdb.threads/stepi-over-clone.exp: catch process syscalls
continue^M
Continuing.^M
^M
Catchpoint 2 (call to syscall clone3), __clone3 () at clone3.S:62^M
(gdb) FAIL: gdb.threads/stepi-over-clone.exp: continue
...
Fix this by updating another (see commit 8fbf220321d) regexp to also recognize
__clone3.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.threads/stepi-over-clone.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.threads/stepi-over-clone.exp b/gdb/testsuite/gdb.threads/stepi-over-clone.exp
index da8bbf6a215..b93cfe69c7f 100644
--- a/gdb/testsuite/gdb.threads/stepi-over-clone.exp
+++ b/gdb/testsuite/gdb.threads/stepi-over-clone.exp
@@ -50,7 +50,7 @@ gdb_test_multiple "catch syscall group:process" "catch process syscalls" {
set re_loc1 "$hex in (__)?clone\[23\]? \\(\\)"
set re_loc2 "$decimal\[ \t\]+in \[^\r\n\]+"
-set re_loc3 "clone\[23\]? \\(\\) at \[^:\]+:$decimal"
+set re_loc3 "(__)?clone\[23\]? \\(\\) at \[^:\]+:$decimal"
gdb_test "continue" \
"Catchpoint $decimal \\(call to syscall clone\[23\]?\\), ($re_loc1|$re_loc3).*"
--
2.43.0

View File

@@ -0,0 +1,78 @@
From a4f602690bdc46428b7e9003612b524dec3ab014 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 14 Apr 2025 13:05:35 +0200
Subject: [PATCH 3/5] [gdb/testsuite] Fix another timeout in
gdb.base/bg-execution-repeat.exp
With test-case gdb.base/bg-execution-repeat.exp, occasionally I run into a
timeout:
...
(gdb) c 1&
Will stop next time breakpoint 1 is reached. Continuing.
(gdb) PASS: $exp: c 1&: c 1&
Breakpoint 2, foo () at bg-execution-repeat.c:23
23 return 0; /* set break here */
PASS: $exp: c 1&: breakpoint hit 1
Will stop next time breakpoint 2 is reached. Continuing.
(gdb) PASS: $exp: c 1&: repeat bg command
print 1
$1 = 1
(gdb) PASS: $exp: c 1&: input still accepted
interrupt
(gdb) PASS: $exp: c 1&: interrupt
Program received signal SIGINT, Interrupt.
foo () at bg-execution-repeat.c:24
24 }
PASS: $exp: c 1&: interrupt received
set var do_wait=0
(gdb) PASS: $exp: c 1&: set var do_wait=0
continue&
Continuing.
(gdb) PASS: $exp: c 1&: continue&
FAIL: $exp: c 1&: breakpoint hit 2 (timeout)
...
I can reproduce it reliably by adding a "sleep (1)" before the "do_wait = 1"
in the .c file.
The timeout happens as follows:
- with the inferior stopped at main, gdb continues (command c 1&)
- the inferior hits the breakpoint at foo
- gdb continues (using the repeat command functionality)
- the inferior is interrupted
- inferior variable do_wait gets set to 0. The assumption here is that the
inferior has progressed enough that do_wait is set to 1 at that point, but
that happens not to be the case. Consequently, this has no effect.
- gdb continues
- the inferior sets do_wait to 1
- the inferior enters the wait function, and wait for do_wait to become 0,
which never happens.
Fix this by moving the "do_wait = 1" to before the first call to foo.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.base/bg-execution-repeat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.c b/gdb/testsuite/gdb.base/bg-execution-repeat.c
index d5b48ee4f94..3e9132b3ee5 100644
--- a/gdb/testsuite/gdb.base/bg-execution-repeat.c
+++ b/gdb/testsuite/gdb.base/bg-execution-repeat.c
@@ -37,9 +37,9 @@ main (void)
{
alarm (60);
+ do_wait = 1;
foo ();
- do_wait = 1;
wait ();
/* do_wait set to 0 externally. */
--
2.43.0

View File

@@ -0,0 +1,57 @@
From 89af915786888dbdfdc2026be1d71eb587c2968e Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 9 Apr 2025 15:46:13 +0200
Subject: [PATCH] [gdb/testsuite] Fix another timeout in
gdb.base/bg-execution-repeat.exp
With a gdb 16.2 based package, I ran into:
...
(gdb) PASS: gdb.base/bg-execution-repeat.exp: c 1&: input still accepted
interrupt
(gdb) PASS: gdb.base/bg-execution-repeat.exp: c 1&: interrupt
set var do_wait=0
(gdb) PASS: gdb.base/bg-execution-repeat.exp: c 1&: set var do_wait=0
continue&
Cannot execute this command while the selected thread is running.
(gdb)
Program received signal SIGINT, Interrupt.
PASS: gdb.base/bg-execution-repeat.exp: c 1&: continue&
0x00007ffff7cf1503 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6
FAIL: gdb.base/bg-execution-repeat.exp: c 1&: breakpoint hit 2 (timeout)
...
Fix this by waiting for "Program received signal SIGINT, Interrupt" after
issuing the interrupt command.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.base/bg-execution-repeat.exp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.exp b/gdb/testsuite/gdb.base/bg-execution-repeat.exp
index 61f26f30f46..7ee84c9e57b 100644
--- a/gdb/testsuite/gdb.base/bg-execution-repeat.exp
+++ b/gdb/testsuite/gdb.base/bg-execution-repeat.exp
@@ -67,6 +67,17 @@ proc test {continue_cmd} {
# enable the "set var" command with an interrupt / continue& pair.
gdb_test -no-prompt-anchor "interrupt"
+ set test "interrupt received"
+ set re [string_to_regexp "Program received signal SIGINT, Interrupt."]
+ gdb_expect {
+ -re $re {
+ pass $test
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+ }
+
# Allow the breakpoint to trigger.
gdb_test -no-prompt-anchor "set var do_wait=0"
base-commit: f60ba4bfaa3d9f499aa0b16d278b969a3074b0e1
--
2.43.0

View File

@@ -1,54 +0,0 @@
From b33811a85ff53af77cdad995ad8cb50431c8c362 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 30 May 2024 12:56:35 +0200
Subject: [PATCH] [gdb/testsuite] Fix error in
gdb.server/server-kill-python.exp
With test-case gdb.server/server-kill-python.exp, I sometimes run into:
...
builtin_spawn gdb -nw -nx -q -iex set height 0 -iex set width 0 \
-data-directory data-directory^M
kill^M
(gdb) kill^M
file /home/abuild/rpmbuild/BUILD/gdb-14.2/build-x86_64-suse-linux/gdb/testsuite.unix.-m64.-fno-PIE.-no-pie/outputs/gdb.server/server-kill-python/server-kill-python^M
The program is not being run.^M
(gdb) ERROR: Couldn't load server-kill-python into GDB.
...
The problem is that the spawn produces a prompt, but it's not explicitly
consumed.
This is a regression since commit 0f077fcae0f ("[gdb/testsuite] Simplify
gdb.server/server-kill-python.exp").
Fix this by consuming the initial prompt.
PR testsuite/31819
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31819
Fixes: 0f077fcae0f ("[gdb/testsuite] Simplify gdb.server/server-kill-python.exp"
---
gdb/testsuite/gdb.server/server-kill-python.exp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp
index 778880984ec..c0768558eeb 100644
--- a/gdb/testsuite/gdb.server/server-kill-python.exp
+++ b/gdb/testsuite/gdb.server/server-kill-python.exp
@@ -63,6 +63,12 @@ if {[gdb_spawn_with_cmdline_opts \
return
}
+gdb_test_multiple "" "initial prompt" {
+ -re "^$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+}
+
gdb_load $binfile
gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
base-commit: 3faa0f850b27f64f08ad4ec5987f711be8862851
--
2.35.3

View File

@@ -1,7 +1,7 @@
From f74652042d7330cd5db2fe1c2f6f4e9cd23f2d55 Mon Sep 17 00:00:00 2001
From 1398f45a2641e0e9e0e331681655404ae1d4ed97 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 4 Feb 2025 14:06:20 +0100
Subject: [PATCH 44/46] [gdb/testsuite] Fix gdb.ada/big_packed_array.exp on
Subject: [PATCH] [gdb/testsuite] Fix gdb.ada/big_packed_array.exp on
s390x-linux
When running test-case gdb.ada/big_packed_array.exp on s390x-linux, I run
@@ -30,19 +30,19 @@ Tested on s390x-linux.
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
index 1ba2c4853c8..1a10ea1d2a5 100644
index 33b1dfd7634..6f030f368d8 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
@@ -21,6 +21,8 @@ standard_ada_testfile foo_ra24_010
set old_gcc [expr [test_compiler_info {gcc-[0-8]-*}]]
set old_gcc [gnat_version_compare < 9]
+set endian [target_endianness]
+
foreach_with_prefix scenario {all minimal} {
set flags [list debug additional_flags=-fgnat-encodings=$scenario]
foreach_gnat_encoding scenario flags {all minimal} {
lappend flags debug
@@ -54,8 +56,13 @@ foreach_with_prefix scenario {all minimal} {
@@ -54,8 +56,13 @@ foreach_gnat_encoding scenario flags {all minimal} {
}
-re -wrap $re_xfail2 {
set last $expect_out(1,string)
@@ -57,6 +57,8 @@ index 1ba2c4853c8..1a10ea1d2a5 100644
# gcc/101643
setup_xfail *-*-*
}
base-commit: 60f9e60b8d92e20277026ee4ad5fdc71b2bbe09d
--
2.43.0

View File

@@ -1,70 +0,0 @@
From 58e1c193329c4e919272f01e5626b912d36ff65d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 23 Jul 2024 14:27:36 +0200
Subject: [PATCH 03/46] [gdb/testsuite] Fix gdb.ada/mi_task_arg.exp on
arm-linux
On arm-linux, I run into:
...
PASS: gdb.ada/mi_task_arg.exp: mi runto task_switch.break_me
Expecting: ^(-stack-list-arguments 1[^M
]+)?(\^done,stack-args=\[frame={level="0",args=\[\]},frame={level="1",args=\[{name="<_task>",value="0x[0-9A-Fa-f]+"}(,{name="<_taskL>",value="[0-9]+"})?\]},frame={level="2",args=\[({name="self_id",value="(0x[0-9A-Fa-f]+|<optimized out>)"})?\]},.*[^M
]+[(]gdb[)] ^M
[ ]*)
-stack-list-arguments 1^M
^done,stack-args=[frame={level="0",args=[]},frame={level="1",args=[{name="<_task>",value="0x40bc48"}]},frame={level="2",args=[]}]^M
(gdb) ^M
FAIL: gdb.ada/mi_task_arg.exp: -stack-list-arguments 1 (unexpected output)
...
The problem is that the test-case expects a level 3 frame, but there is none.
This can be reproduced using cli bt:
...
$ gdb -q -batch outputs/gdb.ada/mi_task_arg/task_switch \
-ex "b task_switch.break_me" \
-ex run \
-ex bt
Breakpoint 1 at 0x34b4: file task_switch.adb, line 57.
Thread 3 "my_caller" hit Breakpoint 1, task_switch.break_me () \
at task_switch.adb:57
57 null;
#0 task_switch.break_me () at task_switch.adb:57
#1 0x00403424 in task_switch.caller (<_task>=0x40bc48) at task_switch.adb:51
#2 0xf7f95a08 in ?? () from /lib/arm-linux-gnueabihf/libgnarl-12.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
...
The purpose of the test-case is printing the frame at level 1, so I don't
think we should bother about the presence of the frame at level 3.
Fix this by allowing the backtrace to stop at level 2.
Tested on arm-linux.
Approved-By: Luis Machado <luis.machado@arm.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
---
gdb/testsuite/gdb.ada/mi_task_arg.exp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/mi_task_arg.exp b/gdb/testsuite/gdb.ada/mi_task_arg.exp
index 098396d5c09..b4b7b4997f3 100644
--- a/gdb/testsuite/gdb.ada/mi_task_arg.exp
+++ b/gdb/testsuite/gdb.ada/mi_task_arg.exp
@@ -49,7 +49,8 @@ set frame1 "frame=\{level=\"1\",args=\\\[${frame1_args}(,$frame1_opt_args)?\\\]\
# Frame for system.tasking.stages.task_wrapper
set frame2_args "(\{name=\"self_id\",value=\"($hex|<optimized out>)\"\})?"
set frame2 "frame=\{level=\"2\",args=\\\[$frame2_args\\\]\}"
-mi_gdb_test "-stack-list-arguments 1" \
- "\\^done,stack-args=\\\[$frame0,$frame1,$frame2,.*" \
- "-stack-list-arguments 1"
+set frames "$frame0,$frame1,${frame2}(,.*)?"
+mi_gdb_test "-stack-list-arguments 1" \
+ "\\^done,stack-args=\\\[$frames\\\]" \
+ "-stack-list-arguments 1"
--
2.43.0

View File

@@ -1,88 +0,0 @@
From 23c9940a62f31071c03e54142e57aea3b8ab1eff Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 17 Jul 2024 17:04:02 +0200
Subject: [PATCH 06/46] [gdb/testsuite] Fix gdb.arch/arm-pseudo-unwind.exp with
unix/mthumb
When running test-case gdb.arch/arm-pseudo-unwind.exp with target board
unix/mthumb, we run into:
...
(gdb) continue^M
Continuing.^M
^M
Program received signal SIGILL, Illegal instruction.^M
0x00400f38 in ?? ()^M
(gdb) FAIL: $exp: continue to breakpoint: continue to callee
...
The test-case attempts to force arm-pseudo-unwind.c to be compiled in arm mode
using additional_flags=-marm, but that's overridden by using target board
unix/mthumb.
This causes function main to be in thumb mode, and consequently function
caller (which is called from main) is is executed as if it's in thumb mode,
while it's actually in arm mode.
Fix this by adding an intermediate function caller_trampoline in
arm-pseudo-unwind.c, and hardcoding it to arm mode using
__attribute__((target("arm"))).
Likewise for test-case gdb.arch/arm-pseudo-unwind-legacy.exp.
Tested on arm-linux.
Approved-By: Luis Machado <luis.machado@arm.com>
---
gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c | 9 ++++++++-
gdb/testsuite/gdb.arch/arm-pseudo-unwind.c | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c
index 49b0553ade4..adda4b8b298 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.c
@@ -24,10 +24,17 @@ break_here_c (uint64_t value)
{
}
+__attribute__((target("arm")))
+uint64_t
+caller_trampoline (void)
+{
+ return caller ();
+}
+
int
main (void)
{
- uint64_t value = caller ();
+ uint64_t value = caller_trampoline ();
break_here_c (value);
return 0;
}
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c
index 49b0553ade4..adda4b8b298 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.c
@@ -24,10 +24,17 @@ break_here_c (uint64_t value)
{
}
+__attribute__((target("arm")))
+uint64_t
+caller_trampoline (void)
+{
+ return caller ();
+}
+
int
main (void)
{
- uint64_t value = caller ();
+ uint64_t value = caller_trampoline ();
break_here_c (value);
return 0;
}
--
2.43.0

View File

@@ -1,79 +0,0 @@
From eb20b0f725b114eb117093971cf0146113517e6b Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 16 Aug 2024 14:22:46 +0200
Subject: [PATCH 33/46] [gdb/testsuite] Fix
gdb.arch/arm-single-step-kernel-helper.exp
On arm-linux I run into:
...
(gdb) p *kernel_user_helper_version^M
Cannot access memory at address 0xffff0ffc^M
(gdb) FAIL: gdb.arch/arm-single-step-kernel-helper.exp: check kernel helper version
...
What the test-case is trying to do, is to access a special address in the arm
linux kernel [1] using ptrace, which doesn't seem to work.
This is with kernel version 6.1.55. Perhaps this used to work, but the kernel
was modified to be more strict with respect to access to this special address.
Fix this by making the inferior access that special address instead.
Tested on arm-linux.
Approved-By: Luis Machado <luis.machado@arm.com>
PR testsuite/32070
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32070
[1] https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
---
gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c | 5 ++++-
gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
index 393004e623a..9b5e137992d 100644
--- a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
+++ b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
@@ -15,7 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-static int *kernel_user_helper_version = (int *) 0xffff0ffc;
+static int *kernel_user_helper_version_ptr = (int *) 0xffff0ffc;
+static int kernel_user_helper_version;
typedef void * (kernel_user_func_t)(void);
#define kernel_user_get_tls (*(kernel_user_func_t *) 0xffff0fe0)
@@ -25,6 +26,8 @@ main (void)
{
int i;
+ kernel_user_helper_version = *kernel_user_helper_version_ptr;
+
for (i = 0; i < 8; i++)
kernel_user_get_tls ();
}
diff --git a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
index 27be5d56883..788bc863799 100644
--- a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
+++ b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
@@ -26,10 +26,13 @@ if { ![runto_main] } {
return -1
}
+# Initialize kernel_user_helper_version.
+gdb_test "next" "for .*"
+
# Check kernel helpers are supported or not.
set kernel_helper_supported 0
-gdb_test_multiple "p *kernel_user_helper_version" \
+gdb_test_multiple "p kernel_user_helper_version" \
"check kernel helper version" {
-re " = ($decimal)\r\n$gdb_prompt $" {
if { $expect_out(1,string) >= 1 } {
--
2.43.0

View File

@@ -1,84 +0,0 @@
From cb85331b671b668aaea1e10b2a37d49e9260bac3 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 4 Sep 2024 15:37:28 +0200
Subject: [PATCH 35/46] [gdb/testsuite] Fix gdb.arch/riscv-tdesc-regs.exp
On riscv64-linux, with test-case gdb.arch/riscv-tdesc-regs.exp I get:
...
(gdb) info registers fflags^M
fflags 0x0 NV:0 DZ:0 OF:0 UF:0 NX:0^M
(gdb) FAIL: gdb.arch/riscv-tdesc-regs.exp: info registers fflags
info registers frm^M
frm 0x0 FRM:0 [RNE (round to nearest; ties to even)]^M
(gdb) FAIL: gdb.arch/riscv-tdesc-regs.exp: info registers frm
...
The FAILs are produced by:
...
foreach reg {fflags frm} {
gdb_test_multiple "info registers $reg" "" {
-re "^info registers $reg\r\n" {
exp_continue
}
-wrap -re "^Invalid register `$reg`" {
fail $gdb_test_name
}
-wrap -re "^$reg\\s+\[^\r\n\]+" {
pass $gdb_test_name
}
}
}
...
The first clause is meant to consume the command.
The '^' char was updated to mean "consume command", so that clause no longer
works since it now attempts to consume the command twice.
Also, it's unnecessary because the following clauses start with ^.
Then, the second clause is unnecessary because there's a default clause
producing the FAIL.
Fix this by simplifying to:
...
foreach reg {fflags frm} {
gdb_test "info registers $reg" "^$reg\\s+\[^\r\n\]+"
}
...
Tested on riscv64-linux.
Approved-By: Andrew Burgess <aburgess@redhat.com>
---
gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
index bd4ba38390a..58859d161b6 100644
--- a/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
+++ b/gdb/testsuite/gdb.arch/riscv-tdesc-regs.exp
@@ -156,17 +156,5 @@ gdb_test_no_output "set tdesc filename $remote_file" \
"load the target description that lacks fflags and frm"
foreach reg {fflags frm} {
- gdb_test_multiple "info registers $reg" "" {
- -re "^info registers $reg\r\n" {
- exp_continue
- }
-
- -wrap -re "^Invalid register `$reg`" {
- fail $gdb_test_name
- }
-
- -wrap -re "^$reg\\s+\[^\r\n\]+" {
- pass $gdb_test_name
- }
- }
+ gdb_test "info registers $reg" "^$reg\\s+\[^\r\n\]+"
}
--
2.43.0

View File

@@ -1,132 +0,0 @@
From bb7497a27dc37f9775c2c00ecb464b7b44a9e8bb Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 23 Sep 2024 07:57:49 +0200
Subject: [PATCH 38/46] [gdb/testsuite] Fix gdb.base/empty-host-env-vars.exp
On aarch64-linux (debian testing) with test-case
gdb.base/empty-host-env-vars.exp I ran into:
...
(gdb) show index-cache directory^M
The directory of the index cache is "/home/linux/.cache/gdb".^M
(gdb) FAIL: $exp: env_var_name=HOME: show index-cache directory
...
Without changing any environment variables, the value of the index-cache dir
is:
...
$ gdb -q -batch -ex "show index-cache directory"
The directory of the index cache is "/home/linux/.cache/gdb".
...
and the expectation of the test-case is that setting HOME to empty will
produce an empty dir, but what it actually produces is:
...
$ HOME= gdb -q -batch -ex "show index-cache directory"
The directory of the index cache is "/home/linux/.cache/gdb".
...
There's nothing wrong with that behaviour, the dir is simply constructed using
XDG_CACHE_HOME which happens to be explictly set to its default value
$HOME/.cache [1]:
...
$ echo $XDG_CACHE_HOME
/home/linux/.cache
...
and indeed also setting that variable to empty gets us the expected empty dir:
...
$ XDG_CACHE_HOME= HOME= gdb -q -batch -ex "show index-cache directory"
gdb: warning: Couldn't determine a path for the index cache directory.
The directory of the index cache is "".
...
Furthermore, the test-case assumption that setting variables to empty either
produces the original dir or an empty dir is incorrect.
Say that XDG_CACHE_HOME has a non-default value:
...
$ echo $XDG_CACHE_HOME
/home/linux/my-xdg-cache-home
$ gdb -q -batch -ex "show index-cache directory"
The directory of the index cache is "/home/linux/my-xdg-cache-home/gdb".
...
then setting that variable to empty:
...
$ XDG_CACHE_HOME= gdb -q -batch -ex "show index-cache directory"
The directory of the index cache is "/home/linux/.cache/gdb".
...
does change the value of the dir.
Fix this by making the test-case less specific.
While we're at it, factor out regexps re_pre and re_post to make regexps more
readable, and use string_to_regexp to reduce quoting.
Tested on aarch64-linux.
PR testsuite/32132
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32132
[1] https://specifications.freedesktop.org/basedir-spec/latest/index.html#variables
---
.../gdb.base/empty-host-env-vars.exp | 32 ++++++-------------
1 file changed, 9 insertions(+), 23 deletions(-)
diff --git a/gdb/testsuite/gdb.base/empty-host-env-vars.exp b/gdb/testsuite/gdb.base/empty-host-env-vars.exp
index e6e9d6e3156..5fab65a3607 100644
--- a/gdb/testsuite/gdb.base/empty-host-env-vars.exp
+++ b/gdb/testsuite/gdb.base/empty-host-env-vars.exp
@@ -21,16 +21,14 @@ require {!is_remote host}
set all_env_vars { HOME XDG_CACHE_HOME LOCALAPPDATA XDG_CONFIG_HOME }
-# Record the initial value of the index-cache directory.
+set re_pre \
+ [string_to_regexp {The directory of the index cache is "}]
+set re_post \
+ [string_to_regexp {".}]
+
+# Show the initial value of the index-cache directory.
clean_restart
-set index_cache_directory ""
-gdb_test_multiple "show index-cache directory" "" {
- -re -wrap "The directory of the index cache is \"(.*)\"\\." {
- set index_cache_directory $expect_out(1,string)
- set index_cache_directory [string_to_regexp $index_cache_directory]
- pass $gdb_test_name
- }
-}
+gdb_test "show index-cache directory" $re_pre\[^\r\n\]*$re_post
foreach_with_prefix env_var_name $all_env_vars {
# Restore the original state of the environment variable.
@@ -38,18 +36,7 @@ foreach_with_prefix env_var_name $all_env_vars {
set env($env_var_name) {}
clean_restart
- # Verify that the empty environment variable didn't affect the
- # index-cache directory setting, that we still see the initial value.
- # "HOME" is different, because if that one is unset, GDB isn't even
- # able to compute the default location. In that case, we expect it to
- # be empty.
- if { $env_var_name == "HOME" } {
- gdb_test "show index-cache directory" \
- "The directory of the index cache is \"\"\\."
- } else {
- gdb_test "show index-cache directory" \
- "The directory of the index cache is \"$index_cache_directory\"\\."
- }
+ gdb_test "show index-cache directory" $re_pre\[^\r\n\]*$re_post
}
}
@@ -69,7 +56,6 @@ with_test_prefix "all env vars" {
clean_restart
- gdb_test "show index-cache directory" \
- "The directory of the index cache is \"\"\\."
+ gdb_test "show index-cache directory" $re_pre$re_post
}
}
--
2.43.0

View File

@@ -1,83 +0,0 @@
From 755699757fc57172c5c9a173fae9bfaf75bc1b6a Mon Sep 17 00:00:00 2001
From: Guinevere Larsen <blarsen@redhat.com>
Date: Fri, 31 May 2024 10:48:54 -0300
Subject: [PATCH 36/46] gdb,testsuite: fix gdb.base/list-dot-nodebug and make
it more robust
Thiago Jung Bauermann noticed that gdb.base/list-dot-nodebug was not
actually compiling the test with some debuginfo in the relevant part,
and while fixing I noticed that the base assumption of the "some" case
was wrong, GDB would select some symtab as a default location and the
test would always fail. This fix makes printing the default location
only be tested when there is no debuginfo.
When testing with no debuginfo, if a system had static libc debuginfo,
the test would also fail. To add an extra layer of robustness to the
test, this rewrite also strips any stray debuginfo from the executable.
The test would only fail now if it runs in a system that can't handle
stripped debuginfo and has static debuginfo pre-installed.
Reported-By: Tom de Vries <tdevries@suse.de>
Reported-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31721
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
---
gdb/testsuite/gdb.base/list-dot-nodebug.exp | 37 +++++++++++++++------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/gdb/testsuite/gdb.base/list-dot-nodebug.exp b/gdb/testsuite/gdb.base/list-dot-nodebug.exp
index c9d732e801b..b7359be1a45 100644
--- a/gdb/testsuite/gdb.base/list-dot-nodebug.exp
+++ b/gdb/testsuite/gdb.base/list-dot-nodebug.exp
@@ -34,21 +34,36 @@ standard_testfile .c -extra.c
foreach_with_prefix debug {"none" "some"} {
- set flags "nodebug"
if {$debug == "some"} {
- set flags "debug"
- }
+ if {[prepare_for_testing_full "failed to prepare" \
+ [list ${testfile}-${debug} $linkflags \
+ $srcfile [list nodebug] \
+ $srcfile2 [list debug]]]} {
+ return -1
+ }
- if {[prepare_for_testing_full "failed to prepare" \
- [list ${testfile}-${debug} $linkflags \
- $srcfile [list nodebug] \
- $srcfile2 [list $debug]]]} {
- return -1
+ # We don't test "list ." before starting with some debug info
+ # because GDB will choose the symtab that has debuginfo, and
+ # print the copyright blurb. This test isn't interested (yet?)
+ # in checking if this default location choice is consistent.
+ } else {
+ set executable ${testfile}-none
+ if {[build_executable "failed to prepare" ${executable} \
+ [list $srcfile $srcfile2] $linkflags]} {
+ return -1
+ }
+
+ # Stripping is a backup in case the system has static libc debuginfo.
+ # We can continue the test even if it fails.
+ gdb_gnu_strip_debug $executable no-debuglink
+
+ clean_restart ${executable}
+
+ gdb_test "list ." \
+ "^Insufficient debug info for showing source lines at default location" \
+ "print before start"
}
- gdb_test "list ." \
- "^Insufficient debug info for showing source lines at default location" \
- "print before start"
if { ![runto bar] } {
return -1
--
2.43.0

View File

@@ -1,88 +0,0 @@
From c77016a72a59a2f32be370d2c8d6729baa97191c Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 24 Jul 2024 14:44:33 +0200
Subject: [PATCH 10/46] [gdb/testsuite] Fix gdb.cp/m-static.exp on arm
With test-case gdb.cp/m-static.exp on arm-linux, I get:
...
(gdb) ptype test5.single_constructor^M
type = class single_constructor {^M
^M
public:^M
single_constructor(void);^M
~single_constructor(void);^M
} *(single_constructor * const)^M
(gdb) FAIL: gdb.cp/m-static.exp: simple object instance, ptype constructor
...
The test-case expects:
- no empty line before "public:", and
- no "~single_constructor(void)", but "~single_constructor()"
The latter is due to commit 137c886e9a6 ("[gdb/c++] Print destructor the same
for gcc and clang").
The failing test is in a part only enabled for is_aarch32_target == 1, so it
looks like it was left behind.
I'm assuming the same happened for the other difference.
Fix this by updating the regexps to match the observed output.
Tested on arm-linux.
Approved-By: Andrew Burgess <aburgess@redhat.com>
---
gdb/testsuite/gdb.cp/m-static.exp | 15 +++++++++++----
gdb/testsuite/lib/gdb-utils.exp | 8 ++++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index 45bc090d01f..5b41898ec9d 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -71,11 +71,18 @@ if { [is_aarch32_target] } {
gdb_test "print test5.single_constructor" \
{ = {single_constructor \*\(single_constructor \* const\)} 0x[0-9a-f]+ <single_constructor::single_constructor\(\)>} \
"simple object instance, print constructor"
- gdb_test "ptype test5.single_constructor" \
- {type = class single_constructor {\r\n public:\r\n single_constructor\(void\);\r\n ~single_constructor\(\);\r\n} \*\(single_constructor \* const\)} \
+
+ set re \
+ [multi_line_string_to_regexp \
+ "type = class single_constructor {" \
+ "" \
+ " public:" \
+ " single_constructor(void);" \
+ " ~single_constructor(void);" \
+ "} *(single_constructor * const)"]
+ gdb_test "ptype test5.single_constructor" $re \
"simple object instance, ptype constructor"
- gdb_test "ptype single_constructor::single_constructor" \
- {type = class single_constructor {\r\n public:\r\n single_constructor\(void\);\r\n ~single_constructor\(\);\r\n} \*\(single_constructor \* const\)} \
+ gdb_test "ptype single_constructor::single_constructor" $re \
"simple object class, ptype constructor"
gdb_test "print test1.~gnu_obj_1" \
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 95c53d030d8..41989da3ed2 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -38,6 +38,14 @@ proc string_to_regexp {str} {
return $result
}
+# Convenience function that calls string_to_regexp for each arg, and
+# joins the results using "\r\n".
+
+proc multi_line_string_to_regexp { args } {
+ set res [lmap arg $args {string_to_regexp $arg}]
+ return [multi_line {*}$res]
+}
+
# Given a list of strings, adds backslashes as needed to each string to
# create a regexp that will match the string, and join the result.
--
2.43.0

View File

@@ -1,54 +0,0 @@
From 80150dc7ac41e767d857905702bf4b57eb1c0029 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 16 Aug 2024 14:22:46 +0200
Subject: [PATCH 11/46] [gdb/testsuite] Fix gdb.dwarf2/dw2-fixed-point.exp on
arm-linux
With test-case gdb.dwarf2/dw2-fixed-point.exp on arm-linux I run into:
...
(gdb) PASS: gdb.dwarf2/dw2-fixed-point.exp: set lang ada
print pck.fp1_var^M
$1 = 0.3125^M
(gdb) FAIL: gdb.dwarf2/dw2-fixed-point.exp: print pck.fp1_var
...
The problem is that the thumb prologue analyzer overshoot, setting the
breakpoint for main after line 49:
...
46 int
47 main (void)
48 {
49 pck__fp1_var++;
...
and consequently we see the value of pck.fp1_var after line 49 instead of
before line 49. This is PR tdep/31981.
Work around this by removing line 49 and all similar subsequent lines, which
turn out to be dead code.
Approved-By: Luis Machado <luis.machado@arm.com>
Tested on arm-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
index 58b97caf055..2789e6ac0fb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.c
@@ -46,11 +46,5 @@ int8_t pck__fp1_range_var = 16;
int
main (void)
{
- pck__fp1_var++;
- pck__fp1_var2++;
- pck__fp2_var++;
- pck__fp3_var++;
- pck__fp1_range_var++;
-
return 0;
}
--
2.43.0

View File

@@ -1,279 +0,0 @@
From e13b5af2c0bc0cdf1b2d66f184fff4ba019b28ec Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 4 Sep 2024 10:07:19 +0200
Subject: [PATCH 12/46] [gdb/testsuite] Fix gdb.dwarf2/dw2-lines.exp on
arm-linux
With test-case gdb.dwarf2/dw2-lines.exp on arm-linux, I run into:
...
(gdb) break bar_label^M
Breakpoint 2 at 0x4004f6: file dw2-lines.c, line 29.^M
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, bar () at dw2-lines.c:29^M
29 foo (2);^M
(gdb) PASS: $exp: cv=2: cdw=32: lv=2: ldw=32: continue to breakpoint: foo \(1\)
...
The pass is incorrect because the continue lands at line 29 with "foo (2)"
instead of line line 27 with "foo (1)".
A minimal version is:
...
$ gdb -q -batch dw2-lines.cv-2-cdw-32-lv-2-ldw-32 -ex "b bar_label"
Breakpoint 1 at 0x4f6: file dw2-lines.c, line 29.
...
where:
...
000004ec <bar>:
4ec: b580 push {r7, lr}
4ee: af00 add r7, sp, #0
000004f0 <bar_label>:
4f0: 2001 movs r0, #1
4f2: f7ff fff1 bl 4d8 <foo>
000004f6 <bar_label_2>:
4f6: 2002 movs r0, #2
4f8: f7ff ffee bl 4d8 <foo>
...
So, how does this happen? In short:
- skip_prologue_sal calls arm_skip_prologue with pc == 0x4ec,
- thumb_analyze_prologue returns 0x4f2
(overshooting by 1 insn, PR tdep/31981), and
- skip_prologue_sal decides that we're mid-line, and updates to 0x4f6.
However, this is a test-case about .debug_line info, so why didn't arm_skip_prologue
use the line info to skip the prologue?
The answer is that the line info starts at bar_label, not at bar.
Fixing that allows us to work around PR tdep/31981.
Likewise in gdb.dwarf2/dw2-line-number-zero.exp.
Instead, add a new test-case gdb.arch/skip-prologue.exp that is dedicated to
checking quality of architecture-specific prologue analysis, without being
written in an architecture-specific way.
If fails on arm-linux for both marm and mthumb:
...
FAIL: gdb.arch/skip-prologue.exp: f2: $bp_addr == $prologue_end_addr (skipped too much)
FAIL: gdb.arch/skip-prologue.exp: f4: $bp_addr == $prologue_end_addr (skipped too much)
...
and passes for:
- x86_64-linux for {m64,m32}x{-fno-PIE/-no-pie,-fPIE/-pie}
- aarch64-linux.
Tested on arm-linux.
---
gdb/testsuite/gdb.arch/skip-prologue.c | 54 +++++++++++++
gdb/testsuite/gdb.arch/skip-prologue.exp | 76 +++++++++++++++++++
.../gdb.dwarf2/dw2-line-number-zero.exp | 8 ++
gdb/testsuite/gdb.dwarf2/dw2-lines.c | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-lines.exp | 4 +
5 files changed, 143 insertions(+), 1 deletion(-)
create mode 100644 gdb/testsuite/gdb.arch/skip-prologue.c
create mode 100644 gdb/testsuite/gdb.arch/skip-prologue.exp
diff --git a/gdb/testsuite/gdb.arch/skip-prologue.c b/gdb/testsuite/gdb.arch/skip-prologue.c
new file mode 100644
index 00000000000..08ceacb6aa8
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/skip-prologue.c
@@ -0,0 +1,54 @@
+/* Copyright 2024 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/>. */
+
+void
+f1 (void)
+{
+ asm ("f1_prologue_end: .globl f1_prologue_end");
+}
+
+int
+f2 (int a)
+{
+ asm ("f2_prologue_end: .globl f2_prologue_end");
+ return a;
+}
+
+void
+f3 (void)
+{
+ asm ("f3_prologue_end: .globl f3_prologue_end");
+ f1 ();
+}
+
+int
+f4 (int a)
+{
+ asm ("f4_prologue_end: .globl f4_prologue_end");
+ return f2 (a);
+}
+
+int
+main (void)
+{
+ f1 ();
+ f2 (0);
+ f3 ();
+ f4 (0);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/skip-prologue.exp b/gdb/testsuite/gdb.arch/skip-prologue.exp
new file mode 100644
index 00000000000..89d2225151a
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/skip-prologue.exp
@@ -0,0 +1,76 @@
+# Copyright 2024 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/>.
+
+# Test-case that checks architecture-specific prologue analyzers.
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {nodebug}] } {
+ return -1
+}
+
+proc do_test { f } {
+ set bp_addr ""
+ gdb_test_multiple "break $f" "" {
+ -re -wrap "Breakpoint $::decimal at ($::hex)" {
+ set bp_addr $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ }
+
+ if { $bp_addr == "" } {
+ return
+ }
+
+ set prologue_end_addr ""
+ gdb_test_multiple "p /x &${f}_prologue_end" "" {
+ -re -wrap " = ($::hex)" {
+ set prologue_end_addr $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ }
+
+ if { $prologue_end_addr == "" } {
+ return
+ }
+
+ set test {$bp_addr == $prologue_end_addr}
+ if { [expr $test] } {
+ pass $test
+ } elseif { $bp_addr < $prologue_end_addr } {
+ # We'll allow this. For instance, amd64 has a prologue
+ # analyzer that doesn't skip the 3rd instruction here, which saves an
+ # argument register to stack:
+ #
+ # 00000000004004ae <f2>:
+ # 4004ae: 55 push %rbp
+ # 4004af: 48 89 e5 mov %rsp,%rbp
+ # 4004b2: 89 7d fc mov %edi,-0x4(%rbp)
+ # 00000000004004b5 <f2_prologue_end>:
+ #
+ pass "$test (skipped less than possible)"
+ } elseif { $bp_addr > $prologue_end_addr } {
+ fail "$test (skipped too much)"
+ } else {
+ fail "$test"
+ }
+}
+
+foreach f { f1 f2 f3 f4 } {
+ with_test_prefix $f {
+ do_test $f
+ }
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
index c510de42037..9124aff1dad 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-line-number-zero.exp
@@ -56,6 +56,10 @@ Dwarf::assemble $asm_file {
file_name "$srcfile" 1
program {
+ DW_LNE_set_address $bar1_start
+ line 25
+ DW_LNS_copy
+
DW_LNE_set_address bar1_label
line 27
DW_LNS_copy
@@ -76,6 +80,10 @@ Dwarf::assemble $asm_file {
DW_LNE_end_sequence
+ DW_LNE_set_address $bar2_start
+ line 39
+ DW_LNS_copy
+
DW_LNE_set_address bar2_label
line 41
DW_LNS_copy
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.c b/gdb/testsuite/gdb.dwarf2/dw2-lines.c
index 67c98fecf02..221d7b95bc3 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.c
@@ -22,7 +22,7 @@ foo (int x)
void
bar (void)
-{
+{ /* bar: */
asm ("bar_label: .globl bar_label");
foo (1);
asm ("bar_label_2: .globl bar_label_2");
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
index af5b6b71768..fd5b83edc5b 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-lines.exp
@@ -88,6 +88,10 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
# to set the current file explicitly.
DW_LNS_set_file $diridx
+ DW_LNE_set_address $bar_start
+ line [line_for bar]
+ DW_LNS_copy
+
DW_LNE_set_address bar_label
line [line_for bar_label]
DW_LNS_copy
--
2.43.0

View File

@@ -0,0 +1,49 @@
From c11539f634a9479e3979c93bc19e0a79457c2c7d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 16 Jan 2025 15:00:11 +0100
Subject: [PATCH] [gdb/testsuite] Fix gdb.dwarf2/implptr.exp regression
When running test-case gdb.dwarf2/implptr.exp on target board unix/-m32, we
get:
...
(gdb) PASS: gdb.dwarf2/implptr.exp: print ***l in implptr:bar
break implptr.c:34^M
No compiled code for line 34 in file "implptr.c".^M
Make breakpoint pending on future shared library load? (y or [n]) n^M
(gdb) FAIL: $exp: set baz breakpoint for implptr (got interactive prompt)
...
This is a regression since commit dcaa85e58c4 ("gdb: reject inserting
breakpoints between functions").
The .debug_line info does not contain an entry with a line number lower than
36, so gdb cannot map it to an address.
Fix this by setting a breakpoint at the function containing line 34 instead.
Tested on x86_64-linux.
PR testsuite/32477
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32477
---
gdb/testsuite/gdb.dwarf2/implptr.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp
index a3f9c6162ce..fa1b68ea8cb 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr.exp
@@ -63,7 +63,7 @@ proc implptr_test_bar {} {
proc implptr_test_baz {} {
global csrcfile
set line [gdb_get_line_number "baz breakpoint" $csrcfile]
- gdb_test "break implptr.c:$line" "Breakpoint 3.*" \
+ gdb_test "break add" "Breakpoint 3.*" \
"set baz breakpoint for implptr"
gdb_continue_to_breakpoint "continue to baz breakpoint for implptr"
base-commit: c9c1feacc153c8715c93c9ca3b6433bbc5b6f9ab
--
2.43.0

View File

@@ -1,95 +0,0 @@
From a6f598be3d0477c5c59bd490573a5d457949658e Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 7 Jun 2024 08:12:34 +0200
Subject: [PATCH] [gdb/testsuite] Fix gdb.fortran/array-bounds.exp on arm
When running test-case gdb.fortran/array-bounds.exp on arm-linux, we run into:
...
(gdb) print &foo^M
$1 = (PTR TO -> ( real(kind=4) (0:1) )) 0xfffef008^M
(gdb) FAIL: gdb.fortran/array-bounds.exp: print &foo
print &bar^M
$2 = (PTR TO -> ( real(kind=4) (-1:0) )) 0xfffef010^M
(gdb) FAIL: gdb.fortran/array-bounds.exp: print &bar
...
This is due to gcc PR debug/54934.
The test-case contains a kfail for this, which is only activated for
x86_64/i386.
Fix this by enabling the kfail for all ilp32 targets.
Also:
- change the kfail into an xfail, because gdb is not at fault here, and
- limit the xfail to the gfortran compiler.
Tested on arm-linux.
(cherry picked from commit f9478936896ada7786e8d68622f6e6ff78b97b0d)
---
gdb/testsuite/gdb.fortran/array-bounds.exp | 45 +++++++++++++++-------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp
index e3f2603a118..a9d6011aed4 100644
--- a/gdb/testsuite/gdb.fortran/array-bounds.exp
+++ b/gdb/testsuite/gdb.fortran/array-bounds.exp
@@ -31,21 +31,38 @@ if {![fortran_runto_main]} {
return
}
-# Convenience proc to setup for KFAIL
-proc kfail_if {exp bugid triplet} {
- if {$exp} {
- setup_kfail $bugid $triplet
+# GCC outputs incorrect range debug info for -m32, gcc PR debug/54934.
+set expect_xfail \
+ [expr \
+ [test_compiler_info {gfortran-*} f90] \
+ && [is_ilp32_target]]
+
+set re_ok [string_to_regexp (4294967296:4294967297)]
+set re_xfail [string_to_regexp (0:1)]
+gdb_test_multiple "print &foo" "" {
+ -re -wrap $re_ok.* {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_xfail.* {
+ if { $expect_xfail } {
+ xfail $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
}
}
-# GCC outputs incorrect range debug info for -m32.
-set expect_fail false
-if {[is_ilp32_target] && ([istarget "i\[34567\]86-*-linux*"]
- || [istarget "x86_64-*-linux*"])} {
- set expect_fail true
+set re_ok [string_to_regexp (-4294967297:-4294967296)]
+set re_xfail [string_to_regexp (-1:0)]
+gdb_test_multiple "print &bar" "" {
+ -re -wrap $re_ok.* {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_xfail.* {
+ if { $expect_xfail } {
+ xfail $gdb_test_name
+ } else {
+ fail $gdb_test_name
+ }
+ }
}
-
-kfail_if $expect_fail "gcc/54934" "*-*-*"
-gdb_test "print &foo" {.*\(4294967296:4294967297\).*}
-kfail_if $expect_fail "gcc/54934" "*-*-*"
-gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*}
base-commit: 4c7dab250c3581e691c2da87395e80244074d8bf
--
2.35.3

View File

@@ -1,88 +0,0 @@
From 37ce118a44994fb178065eaed671c7036f3d93a5 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 20 Jun 2024 16:54:47 +0200
Subject: [PATCH 34/46] [gdb/testsuite] Fix gdb.python/py-format-address.exp on
arm
When running test-case gdb.python/py-format-address.exp on arm-linux, I get:
...
(gdb) python print("Got: " + gdb.format_address(0x103dd))^M
Got: 0x103dd <main at py-format-address.c:30>^M
(gdb) FAIL: $exp: symbol_filename=on: gdb.format_address, \
result should have an offset
...
What is expected here is:
...
Got: 0x103dd <main+1 at py-format-address.c:30>^M
...
Main starts at main_addr:
...
(gdb) print /x &main^M
$1 = 0x103dc^M
...
and we obtained next_addr 0x103dd by adding 1 to it:
...
set next_addr [format 0x%x [expr $main_addr + 1]]
...
Adding 1 to $main_addr results in an address for a thumb function starting at
address 0x103dc, which is incorrect because main is an arm function (because
I'm running with target board unix/-marm).
At some point during the call to format_addr, arm_addr_bits_remove removes
the thumb bit, which causes the +1 offset to be dropped, causing the FAIL.
Fix this by using the address of the breakpoint on main, provided it's not at
the very start of main.
Tested on arm-linux.
PR testsuite/31452
Bug: https://www.sourceware.org/bugzilla/show_bug.cgi?id=31452
---
.../gdb.python/py-format-address.exp | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-format-address.exp b/gdb/testsuite/gdb.python/py-format-address.exp
index 8e7cf47e03a..ab8022c753b 100644
--- a/gdb/testsuite/gdb.python/py-format-address.exp
+++ b/gdb/testsuite/gdb.python/py-format-address.exp
@@ -40,7 +40,23 @@ if ![runto_main] {
# for the program space and architecture (these will be selected based
# on the current inferior).
set main_addr [get_hexadecimal_valueof "&main" "UNKNOWN"]
-set next_addr [format 0x%x [expr $main_addr + 1]]
+require {!string equal $main_addr {UNKNOWN}}
+
+set next_addr "UNKNOWN"
+gdb_test_multiple "info break 1" "" {
+ -re -wrap " y +($hex) +in .*" {
+ set next_addr $expect_out(1,string)
+ set next_addr [regsub {^0x0+} $next_addr "0x"]
+ pass $gdb_test_name
+ }
+}
+if { $next_addr == "UNKNOWN" || $next_addr == $main_addr } {
+ set next_addr [format 0x%x [expr $main_addr + 1]]
+}
+
+verbose -log "main_addr: $main_addr"
+verbose -log "next_addr: $next_addr"
+
foreach_with_prefix symbol_filename { on off } {
gdb_test_no_output "set print symbol-filename ${symbol_filename}"
@@ -56,7 +72,7 @@ foreach_with_prefix symbol_filename { on off } {
"gdb.format_address, result should have no offset"
gdb_test "python print(\"Got: \" + gdb.format_address($next_addr))" \
- "Got: $next_addr <main\\+1${filename_pattern}>" \
+ "Got: $next_addr <main\\+$decimal${filename_pattern}>" \
"gdb.format_address, result should have an offset"
}
--
2.43.0

View File

@@ -1,65 +0,0 @@
From ae564bb3259a6ae34efa3dd48561709d116dc3bc Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 1 Aug 2024 09:23:24 +0200
Subject: [PATCH 01/46] [gdb/testsuite] Fix gdb.python/py-format-string.exp
with python 3.13
On fedora rawhide, with python 3.13, I run into:
...
(gdb) python print (gdb.parse_and_eval ('a_point_t').format_string (invalid=True))^M
Python Exception <class 'TypeError'>: \
this function got an unexpected keyword argument 'invalid'^M
Error occurred in Python: \
this function got an unexpected keyword argument 'invalid'^M
(gdb) FAIL: $exp: format_string: lang_c: test_all_common: test_invalid_args: \
a_point_t with option invalid=True
...
A passing version with an older python version looks like:
...
(gdb) python print (gdb.parse_and_eval ('a_point_t').format_string (invalid=True))^M
Python Exception <class 'TypeError'>: \
'invalid' is an invalid keyword argument for this function^M
Error occurred in Python: \
'invalid' is an invalid keyword argument for this function^M
(gdb) PASS: $exp: format_string: lang_c: test_all_common: test_invalid_args: \
a_point_t with option invalid=True
...
Fix this by accepting the updated error message.
Tested on aarch64-linux.
PR testsuite/31912
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31912
---
gdb/testsuite/gdb.python/py-format-string.exp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index 0c70ad562c7..92092139639 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -1104,10 +1104,16 @@ proc_with_prefix test_invalid_args {} {
"12" \
"TypeError.*: format_string\\(\\) takes 0 positional arguments but 1 were given.*"
+ # For python <= 3.12.
+ set re1 \
+ "TypeError.*: 'invalid' is an invalid keyword argument for this function"
+ # For python >= 3.13.
+ set re2 \
+ "TypeError.*: this function got an unexpected keyword argument 'invalid'"
check_format_string \
"a_point_t" \
"invalid=True" \
- "TypeError.*: 'invalid' is an invalid keyword argument for this function.*"
+ "($re1|$re2).*"
check_format_string \
"a_point_t" \
base-commit: 735d4dc480bcdcb0eddde33b687bd5f11d4f86ee
--
2.43.0

View File

@@ -1,154 +0,0 @@
From 6874385b527cf5d5a43a01484ea58f3912a06b67 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 20 Aug 2024 15:57:36 +0200
Subject: [PATCH 02/46] [gdb/testsuite] Fix gdb.python/py-mi-cmd.exp with
python 3.13
When running test-case gdb.python/py-mi-cmd.exp with python 3.13, I run into:
...
Expecting: ^(-pycmd exp[^M
]+)?(.*&"Traceback \(most recent call last\):.."^M
&"[^^M
]+py-mi-cmd.py[^^M
]+"^M
&"[^^M
]+raise gdb.GdbError\(\).."^M
&"gdb.GdbError.."^M
\^error,msg="Error occurred in Python\."[^M
]+[(]gdb[)] ^M
[ ]*)
-pycmd exp^M
&"Traceback (most recent call last):\n"^M
&" File \"py-mi-cmd.py\", line 76, in invoke\n raise gdb.GdbError()\n"^M
&"gdb.GdbError\n"^M
^error,msg="Error occurred in Python."^M
(gdb) ^M
FAIL: gdb.python/py-mi-cmd.exp: -pycmd exp (unexpected output)
...
In contrast, with python 3.12 I have:
...
Expecting: ^(-pycmd exp[^M
]+)?(.*&"Traceback \(most recent call last\):.."^M
&"[^^M
]+py-mi-cmd.py[^^M
]+"^M
&"[^^M
]+raise gdb.GdbError\(\).."^M
&"gdb.GdbError.."^M
\^error,msg="Error occurred in Python\."[^M
]+[(]gdb[)] ^M
[ ]*)
-pycmd exp^M
&"Traceback (most recent call last):\n"^M
&" File \"py-mi-cmd.py\", line 76, in invoke\n"^M
&" raise gdb.GdbError()\n"^M
&"gdb.GdbError\n"^M
^error,msg="Error occurred in Python."^M
(gdb) ^M
PASS: gdb.python/py-mi-cmd.exp: -pycmd exp
...
To make it easier to understand what we're looking at, let's take this out of
the mi interpreter context and use the cli interpreter:
...
$ gdb -q -batch -ex "set trace-commands on" -x gdb.in
+set python print-stack full
+source py-mi-cmd.py
+python pycmd1('-pycmd')
+python pycmd1.invoke (pycmd1, ["exp"])
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "py-mi-cmd.py", line 76, in invoke
raise gdb.GdbError()
gdb.GdbError
gdb.in:4: Error in sourced command file:
Error occurred in Python.
...
Interestingly, this is what we're seeing with both python 3.12 and 3.13.
The difference between the python versions is that:
- with python 3.12 each line is printed by itself, and
- with python 3.13 two particular lines are printed toghether.
With the cli interpreter, that makes no difference, because the '\n' is
interpreted.
But with the mi interpreter, that causes a difference in output because the
'\n' is not interpreted, but rather printed literally.
Fix this by accepting the new output in addition to the old one.
Tested on aarch64-linux.
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
PR testsuite/31913
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31913
---
gdb/testsuite/gdb.python/py-mi-cmd.exp | 48 ++++++++++++++++++++++----
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-mi-cmd.exp b/gdb/testsuite/gdb.python/py-mi-cmd.exp
index 28c71cd75f3..52914099e6d 100644
--- a/gdb/testsuite/gdb.python/py-mi-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-mi-cmd.exp
@@ -119,13 +119,47 @@ mi_gdb_test "-pycmd dash-key" \
# With this argument the command raises a gdb.GdbError with no message
# string. GDB considers this a bug in the user program, so prints a
# backtrace, and a generic error message.
-mi_gdb_test "-pycmd exp" \
- [multi_line ".*&\"Traceback \\(most recent call last\\):..\"" \
- "&\"\[^\r\n\]+${testfile}.py\[^\r\n\]+\"" \
- "&\"\[^\r\n\]+raise gdb.GdbError\\(\\)..\"" \
- "&\"gdb.GdbError..\"" \
- "\\^error,msg=\"Error occurred in Python\\.\""] \
- "-pycmd exp"
+
+set line1 \
+ [string_to_regexp {Traceback (most recent call last):\n}]
+set line2 \
+ [string cat \
+ [string_to_regexp { File \"}] \
+ "\[^\r\n\]+" \
+ [string_to_regexp ${testfile}.py] \
+ [string_to_regexp {\", line }] \
+ $decimal \
+ [string_to_regexp {, in invoke\n}]]
+set line3 \
+ [string_to_regexp { raise gdb.GdbError()\n}]
+set line4 \
+ [string_to_regexp {gdb.GdbError\n}]
+set errline \
+ [string_to_regexp {^error,msg="Error occurred in Python."}]
+
+set start_line \
+ [string_to_regexp {&"}]
+set end_line \
+ [string_to_regexp {"}]
+
+# With python <= 3.12.
+set re1 \
+ [multi_line \
+ $start_line$line1$end_line \
+ $start_line$line2$end_line \
+ $start_line$line3$end_line \
+ $start_line$line4$end_line \
+ $errline]
+
+# With python >= 3.13.
+set re2 \
+ [multi_line \
+ $start_line$line1$end_line \
+ $start_line$line2$line3$end_line \
+ $start_line$line4$end_line \
+ $errline]
+
+mi_gdb_test "-pycmd exp" ($re1|$re2)
mi_gdb_test "python pycmd2('-pycmd')" \
".*\\^done" \
--
2.43.0

View File

@@ -0,0 +1,52 @@
From 06ca9655c99ce4881f922a5cbac092f0ed0a958b Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 14 Apr 2025 18:25:57 +0200
Subject: [PATCH] [gdb/testsuite] Fix gdb.threads/clone-attach-detach.exp
With test-case gdb.threads/clone-attach-detach.exp I usually get:
...
(gdb) attach <pid> &^M
Attaching to program: clone-attach-detach, process <pid>^M
[New LWP <lwp>]^M
(gdb) PASS: $exp: bg attach <n>: attach
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
...
but sometimes I run into:
...
(gdb) attach <pid> &^M
Attaching to program: clone-attach-detach, process <pid>^M
[New LWP <lwp>]^M
(gdb) [Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
FAIL: $exp: bg attach <n>: attach (timeout)
...
I managed to reproduce this using make target check-readmore and
READMORE_SLEEP=100.
Fix this using -no-prompt-anchor.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.threads/clone-attach-detach.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.threads/clone-attach-detach.exp b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
index de1f6a445a4..21e9649bab1 100644
--- a/gdb/testsuite/gdb.threads/clone-attach-detach.exp
+++ b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
@@ -74,7 +74,7 @@ set attempts 3
for {set attempt 1} {$attempt <= $attempts} {incr attempt} {
with_test_prefix "bg attach $attempt" {
- gdb_test "attach $testpid &" \
+ gdb_test -no-prompt-anchor "attach $testpid &" \
"Attaching to program.*process $testpid.*" \
"attach"
base-commit: e026bf5856f23e9f2bb65b1b01c52d77f106ade8
--
2.43.0

View File

@@ -1,80 +0,0 @@
From e0c1db6156fa8ee35661a9964062eeb69a963576 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 29 Jul 2024 14:05:52 +0200
Subject: [PATCH] [gdb/testsuite] Fix gdb.threads/leader-exit-attach.exp with
check-read1
With test-case gdb.threads/leader-exit-attach.exp and check-read1, I run into:
...
(gdb) attach 18591^M
Attaching to program: leader-exit-attach, process 18591^M
warning: process 18591 is a zombie - the process has already terminatedKFAIL: $exp: attach (PRMS: gdb/31555)
^M
ptrace: Operation not permitted.^M
(gdb) FAIL: $exp: get valueof "$_inferior_thread_count"
...
The problem is that the gdb_test_multiple in the test-case doesn't consume the
prompt in all clauses:
...
gdb_test_multiple "attach $testpid" "attach" {
-re "Attaching to process $testpid failed.*" {
# GNU/Linux gdbserver. Linux ptrace does not let you attach
# to zombie threads.
setup_kfail "gdb/31555" *-*-linux*
fail $gdb_test_name
}
-re "warning: process $testpid is a zombie - the process has already terminated.*" {
# Native GNU/Linux. Linux ptrace does not let you attach to
# zombie threads.
setup_kfail "gdb/31555" *-*-linux*
fail $gdb_test_name
}
-re "Attaching to program: $escapedbinfile, process $testpid.*$gdb_prompt $" {
pass $gdb_test_name
set attached 1
}
}
...
Fix this by using -wrap in the first two clauses.
While we're at it, also use -wrap in the third clause.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.threads/leader-exit-attach.exp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/leader-exit-attach.exp b/gdb/testsuite/gdb.threads/leader-exit-attach.exp
index c1ed1baaa67..a1bc2d470d5 100644
--- a/gdb/testsuite/gdb.threads/leader-exit-attach.exp
+++ b/gdb/testsuite/gdb.threads/leader-exit-attach.exp
@@ -41,19 +41,19 @@ set is_gdbserver [target_is_gdbserver]
set attached 0
gdb_test_multiple "attach $testpid" "attach" {
- -re "Attaching to process $testpid failed.*" {
+ -re -wrap "Attaching to process $testpid failed.*" {
# GNU/Linux gdbserver. Linux ptrace does not let you attach
# to zombie threads.
setup_kfail "gdb/31555" *-*-linux*
fail $gdb_test_name
}
- -re "warning: process $testpid is a zombie - the process has already terminated.*" {
+ -re -wrap "warning: process $testpid is a zombie - the process has already terminated.*" {
# Native GNU/Linux. Linux ptrace does not let you attach to
# zombie threads.
setup_kfail "gdb/31555" *-*-linux*
fail $gdb_test_name
}
- -re "Attaching to program: $escapedbinfile, process $testpid.*$gdb_prompt $" {
+ -re -wrap "Attaching to program: $escapedbinfile, process $testpid.*" {
pass $gdb_test_name
set attached 1
}
base-commit: 6d7adb1f1e6ecad5a6b94319e4d272a82be16277
--
2.43.0

View File

@@ -1,50 +0,0 @@
From d9da3935f1be9c0d008764d6fff4b5dc277a5cd7 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 30 Jul 2024 21:50:17 +0200
Subject: [PATCH 04/46] [gdb/testsuite] Fix regexp in gdb.ada/mi_var_access.exp
some more
When running test-case gdb.ada/mi_var_access.exp on arm-linux (debian trixie),
I run into:
...
Expecting: ^(-var-create A_String_Access \* A_String_Access[
]+)?((\^done,name="A_String_Access",numchild="[0-9]+",.*|\^error,msg="Value out of range.".*)[
]+[(]gdb[)]
[ ]*)
-var-create A_String_Access * A_String_Access
^error,msg="Cannot access memory at address 0x4"
(gdb)
FAIL: gdb.ada/mi_var_access.exp: Create varobj (unexpected output)
...
This is similar to the problem fixed by commit c5a72a8d1c3 ("[gdb/testsuite]
Fix regexp in gdb.ada/mi_var_access.exp").
The problem in both cases is that we're printing an uninitialized variable,
and consequently we can run into various error messages during printing.
Fix this as in the other commit, by accepting the error message.
Tested on arm-linux.
---
gdb/testsuite/gdb.ada/mi_var_access.exp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.ada/mi_var_access.exp b/gdb/testsuite/gdb.ada/mi_var_access.exp
index b71c8f32151..e797a1576cb 100644
--- a/gdb/testsuite/gdb.ada/mi_var_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_access.exp
@@ -42,8 +42,9 @@ mi_continue_to_line \
# to match possible values.
set re_ok "\\^done,name=\"A_String_Access\",numchild=\"$decimal\",.*"
set re_error "\\^error,msg=\"Value out of range\.\".*"
+set re_error2 "\\^error,msg=\"Cannot access memory at address $hex\""
mi_gdb_test "-var-create A_String_Access * A_String_Access" \
- "($re_ok|$re_error)" \
+ "($re_ok|$re_error|$re_error2)" \
"Create varobj"
set bp_location [gdb_get_line_number "STOP2" ${testdir}/mi_access.adb]
--
2.43.0

View File

@@ -1,71 +0,0 @@
From da8d1a26f1015678245f23abc0b96ee6fba9f16d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 29 Aug 2024 07:31:12 +0200
Subject: [PATCH 32/46] [gdb/testsuite] Fix regexp in
gdb.arch/i386-disp-step-self-call.exp
Usually, with test-case gdb.arch/i386-disp-step-self-call.exp I get:
...
(gdb) x/1wx 0xffffc4f8^M
0xffffc4f8: 0x08048472^M
(gdb) PASS: $exp: check return address was updated correctly
...
but sometimes I run into:
...
(gdb) x/1wx 0xffffc5c8^M
0xffffc5c8: 0x0804917e^M
(gdb) FAIL: $exp: check return address was updated correctly
...
The problem is that here:
...
set next_insn_addr 0x[format %08X $next_insn_addr]
gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
"check return address was updated correctly"
...
we're trying to match string 0x0804917e against regexp 0x0804917E due to using
"%08X" as format string.
We only run into this problem if the address contains letters, which apparently
usually isn't the case.
Fix this by using "%08x" instead as format string.
Likewise in test-case gdb.arch/amd64-disp-step-self-call.exp.
Tested on x86_64-linux.
PR testsuite/32121
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32121
---
gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp | 2 +-
gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
index 762d19a2960..2db3ff228c9 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
@@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
-set next_insn_addr 0x[format %016X $next_insn_addr]
+set next_insn_addr 0x[format %016x $next_insn_addr]
gdb_test "x/1gx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
"check return address was updated correctly"
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
index b2cb902f8ed..5de7ebcd69f 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
+++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
@@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
-set next_insn_addr 0x[format %08X $next_insn_addr]
+set next_insn_addr 0x[format %08x $next_insn_addr]
gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
"check return address was updated correctly"
--
2.43.0

View File

@@ -0,0 +1,76 @@
From 0d159d85cd29ea1b4c3abfde2de2c92ad91ddd53 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 14 Apr 2025 15:24:55 +0200
Subject: [PATCH 4/5] [gdb/testsuite] Fix regexp in
gdb.multi/pending-bp-del-inferior.exp
With test-case gdb.multi/pending-bp-del-inferior.exp, occasionally I run into:
...
(gdb) info breakpoints^M
Num Type Disp Enb Address What^M
3 dprintf keep y <MULTIPLE> ^M
printf "in foo"^M
3.1 y 0x004004dc in foo at $c:21 inf 2^M
3.2 y 0x004004dc in foo at $c:21 inf 1^M
(gdb) FAIL: $exp: bp_pending=false: info breakpoints before inferior removal
...
The FAIL happens because the test-case expects:
- breakpoint location 3.1 to be in inferior 1, and
- breakpoint location 3.2 to be in inferior 2
but it's the other way around.
I managed to reproduce this with a trigger patch in
compare_symbols from gdb/linespec.c:
...
uia = (uintptr_t) a.symbol->symtab ()->compunit ()->objfile ()->pspace ();
uib = (uintptr_t) b.symbol->symtab ()->compunit ()->objfile ()->pspace ();
- if (uia < uib)
- return true;
if (uia > uib)
+ return true;
+ if (uia < uib)
return false;
...
Fix this by allowing the alternative order.
Tested on x86_64-linux.
PR testsuite/32202
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32202
---
.../gdb.multi/pending-bp-del-inferior.exp | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
index 12c0a84bb02..2226acb5d78 100644
--- a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
+++ b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
@@ -183,12 +183,16 @@ proc do_dprintf_test { bp_pending } {
"\\s+printf \"in $bp_func\""]
set bp_pattern_after $bp_pattern_before
} else {
- set bp_pattern_before \
- [multi_line \
- "$bp_number\\s+dprintf\\s+keep\\s+y\\s+<MULTIPLE>\\s*" \
- "\\s+printf \"in $bp_func\"" \
- "$bp_number\\.1\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 1" \
- "$bp_number\\.2\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 2"]
+ set res {}
+ foreach inf_a { 1 2 } inf_b { 2 1 } {
+ lappend res \
+ [multi_line \
+ "$bp_number\\s+dprintf\\s+keep\\s+y\\s+<MULTIPLE>\\s*" \
+ "\\s+printf \"in $bp_func\"" \
+ "$bp_number\\.1\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf $inf_a" \
+ "$bp_number\\.2\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf $inf_b"]
+ }
+ set bp_pattern_before "([join $res "|"])"
set bp_pattern_after \
[multi_line \
--
2.43.0

View File

@@ -1,42 +0,0 @@
From 2140bfdb0f523bcfd4475bc9ef779d693f0852fc Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 21 Jun 2024 16:53:19 +0200
Subject: [PATCH 1/2] [gdb/testsuite] Fix regexp in
gdb.threads/stepi-over-clone.exp
On fedora rawhide, I ran into:
...
(gdb) continue^M
Continuing.^M
^M
Catchpoint 2 (call to syscall clone3), 0x000000000042097d in __clone3 ()^M
(gdb) FAIL: gdb.threads/stepi-over-clone.exp: continue
...
Fix this by updating a regexp to also recognize __clone3.
Tested on x86_64-linux.
Tested-By: Guinevere Larsen <blarsen@redhat.com>
---
gdb/testsuite/gdb.threads/stepi-over-clone.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.threads/stepi-over-clone.exp b/gdb/testsuite/gdb.threads/stepi-over-clone.exp
index f671fd7b8bd..da8bbf6a215 100644
--- a/gdb/testsuite/gdb.threads/stepi-over-clone.exp
+++ b/gdb/testsuite/gdb.threads/stepi-over-clone.exp
@@ -48,7 +48,7 @@ gdb_test_multiple "catch syscall group:process" "catch process syscalls" {
}
}
-set re_loc1 "$hex in clone\[23\]? \\(\\)"
+set re_loc1 "$hex in (__)?clone\[23\]? \\(\\)"
set re_loc2 "$decimal\[ \t\]+in \[^\r\n\]+"
set re_loc3 "clone\[23\]? \\(\\) at \[^:\]+:$decimal"
base-commit: 1b57388d5731941f69010502bb59c24bd1db9f68
--
2.43.0

View File

@@ -1,69 +0,0 @@
From 25157766c1f81deecb53f2b784177a0d14c3d945 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 23 Sep 2024 07:45:54 +0200
Subject: [PATCH 41/46] [gdb/testsuite] Fix timeout in
gdb.mi/mi-multi-commands.exp
On aarch64-linux, with test-case gdb.mi/mi-multi-commands.exp once in a while
I run into (edited for readability):
...
(gdb) ^M
<LOTS-OF-SPACES>-data-evaluate-expression $a^M
-data-evaluate-^done,value="\"FIRST COMMAND\""^M
expression $b(gdb) ^M
^M
^done,value="\"TEST COMPLETE\""^M
(gdb) ^M
PASS: $exp: args=: look for first command output, command length 236
FAIL: $exp: args=: look for second command output, command length 236 (timeout)
...
This is more likely to trigger when running the test-case using
taskset -c <cpu> (where in a big.little setup we pick a little cpu).
The setup here is that the test-case issues these two commands at once:
...
-data-evaluate-expression $a
-data-evaluate-expression $b
...
where the length of the first command is artificially increased by prefixing
it with spaces, show as <LOTS-OF-SPACES> above.
What happens is that gdb, after parsing the first command, executes it.
Then the output of the first command intermixes with the echoing of the second
command, which produces this line containing the first prompt:
...
expression $b(gdb) ^M
...
which doesn't match the \r\n prefix of the regexp supposed to consume the
first prompt:
...
-re "\r\n$mi_gdb_prompt" {
...
Fix this by dropping the \r\n prefix.
Tested on aarch64-linux.
PR testsuite/29781
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29781
---
gdb/testsuite/gdb.mi/mi-multi-commands.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
index 3a2e774bddc..028e187366a 100644
--- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
+++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
@@ -103,7 +103,7 @@ proc run_test { args } {
set seen_first_message true
exp_continue
}
- -re "\r\n$mi_gdb_prompt" {
+ -re "$mi_gdb_prompt" {
gdb_assert $seen_first_message $gdb_test_name
}
}
--
2.43.0

View File

@@ -0,0 +1,41 @@
From 4a68297ef46cc70405341b51a476b08119d8173f Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 18 Apr 2025 10:11:39 +0200
Subject: [PATCH] [gdb/testsuite] Fix timeout in gdb.threads/inf-thr-count.exp
With test-case gdb.threads/inf-thr-count.exp, check-readmore and
READMORE_SLEEP=1000 I run into:
...
(gdb) set variable spin = 0^M
(gdb) ^M
Thread 1 "inf-thr-count" hit Breakpoint 2, breakpt () at /data/vries/gdb/src/gdb/testsuite/gdb.threads/inf-thr-count.c:49^M
49 }^M
FAIL: gdb.threads/inf-thr-count.exp: set 'spin' flag to allow main thread to exit (timeout)
PASS: gdb.threads/inf-thr-count.exp: wait for main thread to stop
...
Fix this by using -no-prompt-anchor.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.threads/inf-thr-count.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.threads/inf-thr-count.exp b/gdb/testsuite/gdb.threads/inf-thr-count.exp
index 1c85c955384..81f98b7e6a0 100644
--- a/gdb/testsuite/gdb.threads/inf-thr-count.exp
+++ b/gdb/testsuite/gdb.threads/inf-thr-count.exp
@@ -163,7 +163,7 @@ gdb_test "with print thread-events on -- p \$_inferior_thread_count" \
# Set a variable in the inferior, this will cause the second thread to
# exit.
-gdb_test_no_output "set variable spin = 0" \
+gdb_test_no_output -no-prompt-anchor "set variable spin = 0" \
"set 'spin' flag to allow main thread to exit"
# When the second thread exits, the main thread joins with it, and
base-commit: f233e8e366bcf513f3e1364db71f6773f52918fa
--
2.43.0

View File

@@ -0,0 +1,156 @@
From e026bf5856f23e9f2bb65b1b01c52d77f106ade8 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 18 Mar 2025 14:17:50 +0100
Subject: [PATCH 5/5] [gdb/testsuite] Fix timeout in
gdb.threads/main-thread-exit-during-detach.exp
With a gdb 15.2 based package and test-case
gdb.threads/main-thread-exit-during-detach.exp, I ran into:
...
(gdb) attach 23068
Attaching to program: main-thread-exit-during-detach, process 23068
[New LWP 23080]
...
0x0000ffffb79aa178 in clock_nanosleep@@GLIBC_2.17 () from /lib64/libc.so.6
(gdb) PASS: $exp: spawn_inferior=true: attach to the inferior
p 1 + 2
$1 = 3
(gdb)
Thread 2 "main-thread-exi" stopped.
0x0000ffffb79aa178 in clock_nanosleep@@GLIBC_2.17 () from /lib64/libc.so.6
FAIL: $exp: spawn_inferior=true: p 1 + 2 (timeout)
...
I managed to reproduce this using two timing hacks.
First, we hack display_gdb_prompt to sleep half a second at the end:
...
printf_unfiltered ("%s", actual_gdb_prompt.c_str ());
gdb_flush (gdb_stdout);
}
+ usleep (500 * 1000);
}
...
to make sure expect has time to:
- parse the output of the attach command up until the prompt,
- issue "PASS: $exp: spawn_inferior=true: attach to the inferior", and
- issue "p 1 + 2"
before gdb issues the "Thread ... stopped." message.
Then we hack proc run_test to wait a while between issuing the print command
and parsing the output:
...
- gdb_test "p 1 + 2" " = 3"
+ set cmd "p 1 + 2"
+ send_gdb "$cmd\n"
+ sleep 1
+ gdb_test "" " = 3" $cmd
...
to make sure that gdb has the time to issue the "Thread ... stopped." message
before the output is parsed.
We could fix this by just using -no-prompt-anchor on the print command, but
there's another issue here.
As explained in the test-case, the setup phase is complete if thread 2 is
stopped:
...
# Setup the inferior. When complete the main thread (#1) will
# still be running (due to non-stop mode), while the worker thread
# (#2) will be stopped.
...
The stated goal of the print statement is:
...
# Attaching to a multi-threaded application in non-stop mode
# can result in thread stops being reported after the prompt
# is displayed.
#
# Send a simple command now just to resync the command prompt.
gdb_test "p 1 + 2" " = 3"
...
so the implicit assumption here seems to be that after this gdb_test, thread 2
is in fact stopped.
However, considering that the reported thread stop is the result of a waitpid
call, which is the result of a SIGSTOP arriving at the thread, I don't think
we can make assumptions about when the thread stop will be reported.
We could fix this by trying to detect the "Thread ... stopped." message, but
doing so will make the test-case much more complex, because it may occur
before and after the attach.
So instead, after the attach, loop doing "info thread 2" until the thread is
no longer reported as running:
...
(gdb) attach 8598^M
Attaching to program: main-thread-exit-during-detach, process 8598^M
[New LWP 8608]^M
...
0x00007f23044f1545 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6^M
(gdb) PASS: $exp: spawn_inferior=true: attach to the inferior
info thread 2^M
Id Target Id Frame ^M
2 Thread 0x7f23043ff6c0 (LWP 8608) "main-thread-exi" (running)^M
(gdb) ^M
Thread 2 "main-thread-exi" stopped.^M
0x00007f23044f1545 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6^M
info thread 2^M
Id Target Id Frame ^M
2 Thread 0x7f23043ff6c0 (LWP 8608) "main-thread-exi" 0x00007f23044f1545 \
in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6^M
(gdb) PASS: $exp: spawn_inferior=true: Thread 2 stopped
...
Tested on x86_64-linux.
PR testsuite/32798
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32798
---
.../main-thread-exit-during-detach.exp | 29 +++++++++++++++++--
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
index 2a9320a6914..7d6b3845f1e 100644
--- a/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
+++ b/gdb/testsuite/gdb.threads/main-thread-exit-during-detach.exp
@@ -76,10 +76,33 @@ proc run_test { spawn_inferior } {
# Attaching to a multi-threaded application in non-stop mode
# can result in thread stops being reported after the prompt
- # is displayed.
+ # is displayed, so the thread may still be reported as running.
#
- # Send a simple command now just to resync the command prompt.
- gdb_test "p 1 + 2" " = 3"
+ # Iterate until the thread is no longer reported as running.
+ set stopped 0
+ set re_running [string_to_regexp "(running)"]
+ for { set i 0 } { $i < 10 } { incr i } {
+ with_test_prefix $i {
+ gdb_test_multiple "info thread 2" "" -no-prompt-anchor {
+ -re -wrap $re_running.* {
+ }
+ -re -wrap "" {
+ set stopped 1
+ }
+ }
+ }
+ if { $stopped } {
+ break
+ }
+
+ # Back off to let gdb and inferior make progress.
+ sleep 1
+ }
+
+ gdb_assert { $stopped } "Thread 2 stopped"
+ if { ! $stopped } {
+ return -1
+ }
# Set thread 1 (the current thread) running again.
gdb_test "continue&"
--
2.43.0

View File

@@ -1,76 +0,0 @@
From 56ab56c61f7cba5ed919dfae49c4c8671be8e6b5 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Fri, 31 May 2024 10:19:35 +0200
Subject: [PATCH] [gdb/testsuite] Fix timeout in gdb.tui/resize-2.exp
When running test-case gdb.tui/resize-2.exp with taskset -c 0, I sometimes run
into:
...
tui disable^[[40;1H^M(gdb) PASS: $exp: tui disable
^M^[[K(gdb) FAIL: $exp: two prompt redisplays after resize (timeout)
...
The test-case does "Term::resize 24 80 0" while having the settings of an
earlier "Term::resize 40 90", so both dimensions change.
When TUI is enabled, we call Term::resize with wait_for_msg == 1, and the proc:
- calls stty to change one dimension,
- waits for the message (enabled by "maint set tui-resize-message on")
confirming the resize has happened,
- calls stty to change the other dimension, and again
- waits for the message confirming the resize has happened.
Since TUI is disabled, we call Term::resize with wait_for_msg == 0 because the
message is not printed, so stty is called twice, and afterwards we check for
the results of the two resizes, which is the test that is failing.
The problem is that not waiting for a response after each stty call opens up
the possibility of the responses being merged.
Fix this by calling Term::resize twice, changing one dimension at a time, and
waiting for a single prompt redisplay after each one.
Tested on x86_64-linux.
PR testsuite/31822
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31822
---
gdb/testsuite/gdb.tui/resize-2.exp | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.tui/resize-2.exp b/gdb/testsuite/gdb.tui/resize-2.exp
index 0f1f0b9eb1e..729e1ee23f9 100644
--- a/gdb/testsuite/gdb.tui/resize-2.exp
+++ b/gdb/testsuite/gdb.tui/resize-2.exp
@@ -59,11 +59,23 @@ gdb_test_multiple "tui disable" "" {
}
}
-# Resize with TUI disabled, so don't wait for the resize message.
+# Resize with TUI disabled, so don't wait for the resize message. Instead,
+# do it in two steps, and wait for a prompt redisplay for each. If we do
+# this in one step, it's unpredictable how may prompt redisplays we'll get.
+Term::resize 24 90 0
+set screen_dim { 0 0 90 24 }
+
+gdb_test_multiple "" "prompt redisplays after first resize" {
+ -re "\r.*$gdb_prompt $" {
+ pass $gdb_test_name
+ }
+}
+
Term::resize 24 80 0
set screen_dim { 0 0 80 24 }
-gdb_test_multiple "" "two prompt redisplays after resize" {
- -re "\r.*$gdb_prompt \r.*$gdb_prompt $" {
+
+gdb_test_multiple "" "prompt redisplays after second resize" {
+ -re "\r.*$gdb_prompt $" {
pass $gdb_test_name
}
}
base-commit: 9736d941f271a6c3c14dcbeb5ad03a5fc4106b45
--
2.35.3

View File

@@ -1,7 +1,7 @@
From 2723a9ea67f16593591c4db9101e423ff73e6353 Mon Sep 17 00:00:00 2001
From cc96eb70e17260381e6c59c8de671468b59eee7f Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Thu, 16 Jan 2025 09:39:55 +0100
Subject: [PATCH 31/37] [gdb/testsuite] Fix timeouts in
Subject: [PATCH] [gdb/testsuite] Fix timeouts in
gdb.threads/step-over-thread-exit.exp
Once in a while, I run into a timeout in test-case
@@ -58,10 +58,10 @@ index 8eb93995657..98cc94e9528 100644
}
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index c32dccab43e..008c1b83c1e 100644
index 577eb9368cf..b103c117258 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -977,6 +977,10 @@ proc fill_in_default_prompt {prompt_regexp with_anchor} {
@@ -1024,6 +1024,10 @@ proc command_to_message { command } {
# if one of them matches. If MESSAGE is empty COMMAND will be used.
# -prompt PROMPT_REGEXP specifies a regexp matching the expected prompt
# after the command output. If empty, defaults to "$gdb_prompt $".
@@ -72,7 +72,7 @@ index c32dccab43e..008c1b83c1e 100644
# -lbl specifies that line-by-line matching will be used.
# EXPECT_ARGUMENTS will be fed to expect in addition to the standard
# patterns. Pattern elements will be evaluated in the caller's
@@ -1076,6 +1080,7 @@ proc gdb_test_multiple { command message args } {
@@ -1123,6 +1127,7 @@ proc gdb_test_multiple { command message args } {
set line_by_line 0
set prompt_regexp ""
@@ -80,7 +80,7 @@ index c32dccab43e..008c1b83c1e 100644
for {set i 0} {$i < [llength $args]} {incr i} {
set arg [lindex $args $i]
if { $arg == "-prompt" } {
@@ -1083,6 +1088,8 @@ proc gdb_test_multiple { command message args } {
@@ -1130,6 +1135,8 @@ proc gdb_test_multiple { command message args } {
set prompt_regexp [lindex $args $i]
} elseif { $arg == "-lbl" } {
set line_by_line 1
@@ -89,7 +89,7 @@ index c32dccab43e..008c1b83c1e 100644
} else {
set user_code $arg
break
@@ -1094,7 +1101,7 @@ proc gdb_test_multiple { command message args } {
@@ -1141,7 +1148,7 @@ proc gdb_test_multiple { command message args } {
error "Too few arguments to gdb_test_multiple"
}
@@ -97,7 +97,9 @@ index c32dccab43e..008c1b83c1e 100644
+ set prompt_regexp [fill_in_default_prompt $prompt_regexp $prompt_anchor]
if { $message == "" } {
set message $command
set message [command_to_message $command]
base-commit: cd4f4a663f82e2f8bee58f3ef000964a2dd82769
--
2.43.0

View File

@@ -1,40 +0,0 @@
From 86ab8a78a6947891eaf93fc6910febf3eb7fa8f0 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 8 Jan 2025 16:07:08 +0100
Subject: [PATCH 42/46] [gdb/testsuite] Require can_spawn_for_attach in
gdb.base/gstack.exp
I ran test-case gdb.base/gstack.exp on a machine with kernel.yama.ptrace_scope
set to 1 and ran into:
...
PASS: gdb.base/gstack.exp: spawn gstack
ptrace: Operation not permitted.^M
GSTACK-END^M
PASS: gdb.base/gstack.exp: gstack exits with no error
PASS: gdb.base/gstack.exp: gstack's exit status is 0
FAIL: gdb.base/gstack.exp: got backtrace
...
Fix this by requiring can_spawn_for_attach.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.base/gstack.exp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
index a5dacd582ff..d8a6d78e550 100644
--- a/gdb/testsuite/gdb.base/gstack.exp
+++ b/gdb/testsuite/gdb.base/gstack.exp
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+require can_spawn_for_attach
+
set testfile gstack
set executable ${testfile}
set binfile [standard_output_file $executable]
--
2.43.0

View File

@@ -0,0 +1,58 @@
From 6d61b107f71d644ab35e8d7fe1c156d4f00c33fc Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 8 Apr 2025 14:56:06 +0200
Subject: [PATCH] [gdb/testsuite] Work around PR32850
---
.../gdb.dwarf2/dw2-step-between-different-inline-functions.c | 4 +++-
.../gdb.dwarf2/dw2-step-between-inline-func-blocks.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c
index 5e4fe47b28e..594906e1378 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-different-inline-functions.c
@@ -54,6 +54,8 @@ extern void *foo_label_6 (void);
void
foo (void)
{
+ void *goto_target = &foo_label_6;
+
/* This label is used to find the start of 'foo' when generating the
debug information. */
asm ("foo_label: .globl foo_label");
@@ -76,7 +78,7 @@ foo (void)
destination address be a global label so that we can generate DWARF
that has ranges that start exactly at the destination address. */
if (global_var > 0)
- goto *(&foo_label_6);
+ goto *(goto_target);
LABEL (4);
++global_var;
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c
index 7fdf1bb2c86..62d42506a10 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-step-between-inline-func-blocks.c
@@ -49,6 +49,7 @@ extern void *foo_label_6 (void);
void
foo (void)
{
+ void *goto_target = &foo_label_6;
/* This label is used to find the start of 'foo' when generating the
debug information. */
asm ("foo_label: .globl foo_label");
@@ -71,7 +72,7 @@ foo (void)
destination address be a global label so that we can generate DWARF
that has ranges that start exactly at the destination address. */
if (global_var > 0)
- goto *(&foo_label_6);
+ goto *(goto_target);
LABEL (4);
++global_var;
base-commit: c11539f634a9479e3979c93bc19e0a79457c2c7d
--
2.43.0

View File

@@ -1,47 +1,86 @@
From e76eb034e25f53ef2c17eab700e95d07bbbdc7aa Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 7 Apr 2025 15:09:37 +0200
Subject: [PATCH] [gdb/tui] Don't try deferred curses initialization twice
I noticed that if deferred curses initialization fails, for instance when
using TERM=dumb, and we try the same again, we run into the same error:
...
$ TERM=dumb gdb -batch -ex "tui enable" -ex "tui enable"
Cannot enable the TUI: terminal doesn't support cursor addressing [TERM=dumb]
Cannot enable the TUI: terminal doesn't support cursor addressing [TERM=dumb]
...
I think it's better to try deferred curses initialization only once.
Fix this by changing bool tui_finish_init into a tribool, and using
TRIBOOL_UNKNOWN to represent the "initialization failed" state, such that we
get instead:
...
$ TERM=dumb gdb -batch -ex "tui enable" -ex "tui enable"
Cannot enable the TUI: terminal doesn't support cursor addressing [TERM=dumb]
Cannot enable the TUI
...
Tested on x86_64-linux.
---
gdb/tui/tui.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 828e42bccf7..551a72e3992 100644
index 59aa1bc1483..06a899e2418 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -57,7 +57,7 @@
@@ -67,7 +67,12 @@ show_tui_debug (struct ui_file *file, int from_tty,
/* Tells whether the TUI is active or not. */
bool tui_active = false;
-static bool tui_finish_init = true;
+static int tui_init = -1;
+
+/* Tells whether the TUI should do deferred curses initialization.
+ If TRIBOOL_TRUE, then yes. If TRIBOOL_FALSE. then no (because
+ initialization is already done). If TRIBOOL_UNKNOWN, then no (because
+ initialization failed). */
+static tribool tui_finish_init = TRIBOOL_TRUE;
enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE;
@@ -363,7 +363,13 @@ tui_enable (void)
@@ -390,7 +395,13 @@ tui_enable (void)
/* To avoid to initialize curses when gdb starts, there is a deferred
curses initialization. This initialization is made only once
and the first time the curses mode is entered. */
- if (tui_finish_init)
+ if (tui_init == 0)
+ if (tui_finish_init == TRIBOOL_UNKNOWN)
+ {
+ /* Initalization failed before, just throw a generic error, don't try
+ again. Workaround for segfault in libncurses5 bsc#1179210. */
+ /* Initialization failed before, just throw a generic error, don't try
+ again. */
+ error (_("Cannot enable the TUI"));
+ }
+ else if (tui_init == -1)
+ else if (tui_finish_init == TRIBOOL_TRUE)
{
WINDOW *w;
SCREEN *s;
@@ -383,6 +389,8 @@ tui_enable (void)
@@ -410,6 +421,9 @@ tui_enable (void)
if (!gdb_stderr->isatty ())
error (_("Cannot enable the TUI when output is not a terminal"));
+ tui_init = 0;
+ /* Don't try initialization again. */
+ tui_finish_init = TRIBOOL_UNKNOWN;
+
s = newterm (NULL, stdout, stdin);
#ifdef __MINGW32__
/* The MinGW port of ncurses requires $TERM to be unset in order
@@ -435,7 +443,8 @@ tui_enable (void)
tui_set_win_focus_to (TUI_SRC_WIN);
keypad (TUI_CMD_WIN->handle.get (), TRUE);
wrefresh (TUI_CMD_WIN->handle.get ());
@@ -468,7 +482,7 @@ tui_enable (void)
tui_set_win_focus_to (tui_src_win ());
keypad (tui_cmd_win ()->handle.get (), TRUE);
wrefresh (tui_cmd_win ()->handle.get ());
- tui_finish_init = false;
+
+ tui_init = 1;
+ tui_finish_init = TRIBOOL_FALSE;
}
else
{
base-commit: eaacf3d48a7f16f56d5a69d5fb03ac3638d7b957
--
2.43.0

View File

@@ -1,3 +1,382 @@
-------------------------------------------------------------------
Tue May 27 13:29:06 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Fix "ERROR: is not a date".
-------------------------------------------------------------------
Wed Apr 23 08:28:56 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Mention fixup-gdb-6.5-gcore-buffer-limit-test.patch.
-------------------------------------------------------------------
Tue Apr 22 14:19:23 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Mention changes in GDB 16:
* GDB now supports watchpoints for tagged data pointers (see
https://en.wikipedia.org/wiki/Tagged_pointer) on amd64, such
as the one used by the Linear Address Masking (LAM) feature
provided by Intel.
* Debugging support for Intel MPX has been removed. This
includes the removal of:
* MPX register support
* the commands "show/set mpx bound" (deprecated since GDB 15)
* i386 and amd64 implementation of the hooks report_signal_info
and get_siginfo_type.
* GDB now supports printing of asynchronous events from the
Intel Processor Trace during 'record instruction-history',
'record function-call-history' and all stepping commands.
This can be controlled with the new "set record btrace pt
event-tracing" command.
* GDB now supports printing of ptwrite payloads from the Intel
Processor Trace during 'record instruction-history', 'record
function-call-history' and all stepping commands. The payload
is also accessible in Python as a RecordAuxiliary object.
Printing is customizable via a ptwrite filter function in
Python. By default, the raw ptwrite payload is printed for
each ptwrite that is encountered.
* For breakpoints that are created in the 'pending' state, any
'thread' or 'task' keywords are parsed at the time the
breakpoint is created, rather than at the time the breakpoint
becomes non-pending.
* Thread-specific breakpoints are only inserted into the
program space in which the thread of interest is running.
In most cases program spaces are unique for each inferior,
so this means that thread-specific breakpoints will usually
only be inserted for the inferior containing the thread of
interest. The breakpoint will be hit no less than before.
* For ARM targets, the offset of the pc in the jmp_buf has
been fixed to match glibc 2.20 and later. This should only
matter when not using libc probes. This may cause breakage
when using an incompatible libc, like uclibc or newlib, or
an older glibc.
* MTE (Memory Tagging Extension) debugging is now supported on
AArch64 baremetal targets.
* In a record session, when a forward emulation reaches the end
of the reverse history, the warning message has been changed
to indicate that the end of the history has been reached. It
also specifies that the forward execution can continue, and
the recording will also continue.
* The Ada 'Object_Size attribute is now supported.
* New bash script gstack uses GDB to print stack traces of
running processes.
* Python API:
* Added gdb.record.clear. Clears the trace data of the
current recording. This forces re-decoding of the trace for
successive commands.
* Added the new event source gdb.tui_enabled.
* New module gdb.missing_objfile that facilitates dealing with
missing objfiles when opening a core-file.
* New function gdb.missing_objfile.register_handler that can
register an instance of a sub-class of
gdb.missing_debug.MissingObjfileHandler as a handler for
missing objfiles.
* New class gdb.missing_objfile.MissingObjfileHandler which
can be sub-classed to create handlers for missing objfiles.
* The 'signed' argument to gdb.Architecture.integer_type()
will no longer accept non-bool types.
* The gdb.MICommand.installed property can only be set to True
or False.
* The 'qualified' argument to gdb.Breakpoint constructor will
no longer accept non-bool types.
* Added the gdb.Symbol.is_artificial attribute.
* Debugger Adapter Protocol changes:
* The "scopes" request will now return a scope holding global
variables from the stack frame's compilation unit.
* The "scopes" request will return a "returnValue" scope
holding the return value from the latest "stepOut" command,
when appropriate.
* The "launch" and "attach" requests were rewritten in
accordance with some clarifications to the spec. Now they
can be sent at any time after the "initialized" event, but
will not take effect (or send a response) until after the
"configurationDone" request has been sent.
* The "variables" request will not return artificial symbols.
* New commands:
* show jit-reader-directory
Show the name of the directory that "jit-reader-load" uses
for relative file names.
* set style line-number foreground COLOR
set style line-number background COLOR
set style line-number intensity VALUE
Control the styling of line numbers printed by GDB.
* set style command foreground COLOR
set style command background COLOR
set style command intensity VALUE
Control the styling of GDB commands when displayed by GDB.
* set style title foreground COLOR
set style title background COLOR
set style title intensity VALUE
This style now applies to the header line of lists, for
example the first line of the output of "info breakpoints".
Previous uses of this style have been replaced with the new
"command" style.
* set warn-language-frame-mismatch [on|off]
show warn-language-frame-mismatch
Control the warning that is emitted when specifying a
language that does not match the current frame's language.
* maintenance info inline-frames [ADDRESS]
New command which displays GDB's inline-frame information
for the current address, or for ADDRESS if specified. The
output identifies inlined frames which start at the
specified address.
* maintenance info blocks [ADDRESS]
New command which displays information about all of the
blocks at ADDRESS, or at the current address if ADDRESS is
not given. Blocks are listed starting at the inner global
block out to the most inner block.
* info missing-objfile-handlers
List all the registered missing-objfile handlers.
* enable missing-objfile-handler LOCUS HANDLER
disable missing-objfile-handler LOCUS HANDLER
Enable or disable a missing-objfile handler with a name
matching the regular expression HANDLER, in LOCUS. LOCUS
can be 'global' to operate on global missing-objfile
handler, 'progspace' to operate on handlers within the
current program space, or can be a regular expression which
is matched against the filename of the primary executable in
each program space.
* Changed commands:
* remove-symbol-file
This command now supports file-name completion.
* remove-symbol-file -a ADDRESS
The ADDRESS expression can now be a full expression
consisting of multiple terms, e.g. 'function + 0x1000'
(without quotes), previously only a single term could be
given.
* target core
target exec
target tfile
target ctf
compile file
maint print c-tdesc
save gdb-index
These commands now require their filename argument to be
quoted if it contains white space or quote characters. If
the argument contains no such special characters then
quoting is not required.
* maintenance print remote-registers
Add an "Expedited" column to the output of the command. It
indicates which registers were included in the last stop
reply packet received by GDB.
* show configuration
Now includes the version of GNU Readline library that GDB is
using.
* New remote packets:
* vFile:stat
Return information about files on the remote system. Like
vFile:fstat but takes a filename rather than an open file
descriptor.
* x addr,length
Given ADDR and LENGTH, fetch LENGTH units from the memory at
address ADDR and send the fetched data in binary format.
This packet is equivalent to 'm', except that the data in
the response are in binary format.
* binary-upload in qSupported reply
If the stub sends back 'binary-upload+' in it's qSupported
reply, then GDB will, where possible, make use of the 'x'
packet. If the stub doesn't report this feature supported,
then GDB will not use the 'x' packet.
-------------------------------------------------------------------
Sun Apr 20 21:00:52 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Update to 16.3.
Patches dropped:
* gdb-16.2.90.6c82a557806.17-04-2025.patch
Maintenance script qa-local.sh:
* Update version to 16.3.
- Patches added:
* gdb-testsuite-fix-timeout-in-gdb.threads-inf-thr-cou.patch
-------------------------------------------------------------------
Thu Apr 17 11:39:08 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Update to current gdb-16-branch (gdb 16.2.90).
Patches dropped:
* core-target-open-segfault.patch
* tui-wrefresh-issue.patch
* gdb-rhbz2354997-gstack-drop-readnever.patch
* gdb-record-fix-out-of-bounds-write-in-aarch64_record.patch
* gdb-tdep-backport-i386_canonicalize_syscall-rewrite-.patch
Patches added:
* gdb-16.2.90.6c82a557806.17-04-2025.patch
-------------------------------------------------------------------
Mon Apr 14 14:43:51 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Maintenance script qa.sh:
* Add gdb.base/errno.exp FAILs for PR29244 (SLE-12).
* Add PR31308 kfail.
- Maintenance script import-patches.sh:
* Handle filename clash with existing file.
- Patches added:
* gdb-record-fix-out-of-bounds-write-in-aarch64_record.patch
* gdb-block-sigterm-during-fetch_inferior_event.patch
* gdb-testsuite-fix-another-timeout-in-gdb.base-bg-exe.1.patch
* gdb-testsuite-fix-regexp-in-gdb.multi-pending-bp-del.patch
* gdb-testsuite-fix-timeout-in-gdb.threads-main-thread.patch
* gdb-testsuite-fix-gdb.threads-clone-attach-detach.ex.patch
-------------------------------------------------------------------
Sat Apr 12 09:52:17 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Update to fedora rawhide @ c65d4ba.
Sources dropped:
* gdb-gstack.man
- Update to fedora rawhide @ 73a92e4.
Patched dropped:
* gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
- Update to fedora rawhide @ df0d4c2.
Patches added:
* core-target-open-segfault.patch
* tui-wrefresh-issue.patch
- Update to fedora rawhide @ 5506bde.
Patched dropped:
* gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
- Update to fedora rawhide @ 98da3e0.
Patched dropped:
* gdb-6.5-gcore-buffer-limit-test.patch
* fixup-gdb-6.5-gcore-buffer-limit-test.patch
- Update to fedora rawhide @ a65de0f.
Patched dropped:
* gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
- Update to fedora rawhide @ 7183fb3.
Patches added:
* gdb-rhbz2354997-gstack-drop-readnever.patch
- Update to fedora rawhide @ f9c4079.
Patches dropped:
* gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
-------------------------------------------------------------------
Mon Apr 7 09:52:41 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Update to fedora rawhide @ c65d4ba.
Patched dropped:
* gdb-6.6-buildid-locate-tests.patch
Patches modified:
* gdb-add-rpm-suggestion-script.patch
- Update to fedora rawhide @ 12e32a6.
Patches modified:
* gdb-add-rpm-suggestion-script.patch
* gdb-backport-buildid-related-changes.patch
* gdb-remove-qnx-neutrino-support.patch
- Update to fedora rawhide @ 264209d.
Maintenance script import-fedora.sh:
* Drop gdb-rhbz1156192-recursive-dlopen-test.patch
from skip_patches.
- Update to fedora rawhide @ 020018c.
Maintenance script import-fedora.sh:
* Drop gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch from
skip_patches.
- Update to fedora rawhide @ 1e3eb79.
Maintenance script import-fedora.sh:
* Drop gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch from
skip_patches.
- Update to fedora rawhide @ 1a098a7.
Patches dropped:
* gdb-6.3-gstack-20050411.patch
* gdb-testsuite-require-can_spawn_for_attach-in-gdb.ba.patch
- Update to fedora rawhide @ 5fc2d96.
Patches dropped:
* gdb-backport-buildid-related-changes.patch
* gdb-catchpoint-re-set.patch
* gdb-remove-qnx-neutrino-support.patch
- Update to fedora rawhide @ 6b0ca99 (gdb 16.2).
Patches updated (fedora):
* gdb-add-rpm-suggestion-script.patch
Maintenance script qa-local.sh:
* Update version to 16.2.
Patches updated:
* gdb-testsuite-ada-pie.patch
* gdb-tui-enable-work-around-libncurses-segfault.patch
* gdb-guile-use-scm_debug_typing_strictness-0.patch
* add-gdbarch_dwarf2_reg_piece_offset-hook.patch
* gdb-testsuite-fix-gdb.ada-big_packed_array.exp-on-s3.patch
* gdb-cli-add-ignore-errors-command.patch
* fixup-gdb-add-rpm-suggestion-script.patch
Patches dropped:
* gdb-testsuite-fix-another-regexp-in-gdb.threads-step.patch
* gdb-testsuite-fix-error-in-gdb.server-server-kill-py.patch
* gdb-testsuite-fix-timeout-in-gdb.tui-resize-2.exp.patch
* fix-gdb.dap-step-out.exp-on-s390x.patch
* fix-gdb.dwarf2-shortpiece.exp-on-s390x.patch
* gdb-build-fix-unused-var-in-corelow.c.patch
* gdb-exp-fix-gdb.fortran-intrinsics.exp-fail-on-arm.patch
* gdb-prune-inferior-after-switching-inferior.patch
* gdb-record-fix-out-of-bounds-write-in-aarch64_record.patch
* gdb-symtab-fix-target-type-of-complex-long-double-on.patch
* gdb-symtab-return-correct-reader-for-top-level-cu-in.patch
* gdb-tdep-fix-arm-thumb2-hw-breakpoint.patch
* gdb-tdep-fix-recording-of-t1-push.patch
* gdb-tdep-handle-sycall-statx-for-arm-linux.patch
* gdb-tdep-handle-syscall-clock_gettime64-for-arm-linu.patch
* gdb-tdep-s390-add-arch15-record-replay-support.patch
* gdb-testsuite-avoid-intermittent-failures-on-a-debug.patch
* gdb-testsuite-don-t-use-set-auto-solib-add-off.patch
* gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-on-arm-lin.patch
* gdb-testsuite-fix-gdb.arch-arm-pseudo-unwind.exp-wit.patch
* gdb-testsuite-fix-gdb.arch-arm-single-step-kernel-he.patch
* gdb-testsuite-fix-gdb.arch-riscv-tdesc-regs.exp.patch
* gdb-testsuite-fix-gdb.base-empty-host-env-vars.exp.patch
* gdb-testsuite-fix-gdb.base-list-dot-nodebug-and-make.patch
* gdb-testsuite-fix-gdb.cp-m-static.exp-on-arm.patch
* gdb-testsuite-fix-gdb.dwarf2-dw2-fixed-point.exp-on-.patch
* gdb-testsuite-fix-gdb.dwarf2-dw2-lines.exp-on-arm-li.patch
* gdb-testsuite-fix-gdb.fortran-array-bounds.exp-on-ar.patch
* gdb-testsuite-fix-gdb.python-py-format-address.exp-o.patch
* gdb-testsuite-fix-gdb.python-py-format-string.exp-wi.patch
* gdb-testsuite-fix-gdb.python-py-mi-cmd.exp-with-pyth.patch
* gdb-testsuite-fix-gdb.threads-leader-exit-attach.exp.patch
* gdb-testsuite-fix-regexp-in-gdb.ada-mi_var_access.ex.patch
* gdb-testsuite-fix-regexp-in-gdb.arch-i386-disp-step-.patch
* gdb-testsuite-fix-regexp-in-gdb.threads-stepi-over-c.patch
* gdb-testsuite-fix-timeout-in-gdb.mi-mi-multi-command.patch
* handle-address-class-annotation-for-s390x-in-some-te.patch
* opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch
* s390-add-arch15-concurrent-functions-facility-insns.patch
* s390-add-arch15-instruction-names.patch
* s390-add-arch15-instructions.patch
* s390-align-opcodes-to-lower-case.patch
* s390-fix-disassembly-of-optional-addressing-operands.patch
* s390-relax-risbg-n-z-risb-h-l-gz-rns-ros-rxs-bgt-ope.patch
* s390-simplify-dis-assembly-of-insn-operands-with-con.patch
* s390-treat-addressing-operand-sequence-as-one-in-dis.patch
* use-setvariable-in-gdb.dap-scopes.exp.patch
Patches added:
* gdb-testsuite-fix-gdb.dwarf2-implptr.exp-regression.patch
* gdb-testsuite-work-around-pr32850.patch
* gdb-symtab-fix-gdb.base-fission-macro.exp-with-unix-.patch
* gdb-testsuite-fix-another-timeout-in-gdb.base-bg-exe.patch
- Add "BuildRequires: glibc-locale" for gdb:testsuite to fix
SLFO testsuite failures.
-------------------------------------------------------------------
Mon Apr 7 09:46:31 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Maintenance script qa.sh:
* Fix MISSING for 16.0.
-------------------------------------------------------------------
Thu Apr 3 13:20:03 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Update to fedora rawhide @ bbf9637.
Patched dropped:
* gdb-add-deprecated-settings-py-script.patch
- Update to fedora rawhide @ 4170428.
Drop the 'set/show build-id-verbose' setting. Users should
instead use the 'set/show rpm-suggestion enabled' setting.
Patched modified:
* gdb-6.6-buildid-locate-tests.patch
* gdb-add-rpm-suggestion-script.patch
* gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch
- Patches modified (bsc#1240838):
* gdb-add-rpm-suggestion-script-suse.patch
-------------------------------------------------------------------
Thu Apr 3 13:10:55 UTC 2025 - Tom de Vries <tdevries@suse.com>
- Maintenance script qa.sh (bsc#1221763):
* Remove yama ptrace_scope == 1 kfails.
-------------------------------------------------------------------
Thu Mar 27 12:24:34 UTC 2025 - Tom de Vries <tdevries@suse.com>
@@ -1792,14 +2171,12 @@ Tue Jun 6 06:00:11 UTC 2023 - Tom de Vries <tdevries@suse.com>
* Use -$arch as argument to qa.sh.
-------------------------------------------------------------------
Mon May 22 21:01:44 UTC 2023 - Dirk Müller <dmueller@suse.com>
- disable werror as a workaround for deprecation warnings with
python 3.11 (bsc#1211052)
-------------------------------------------------------------------
Fri Apr 7 07:48:58 UTC 2023 - Tom de Vries <tdevries@suse.com>
- Revert to singlespec multibuild.
@@ -2627,7 +3004,6 @@ Mon Nov 22 09:00:45 UTC 2021 - Tom de Vries <tdevries@suse.com>
BuildRequire babeltrace-devel.
-------------------------------------------------------------------
Mon Nov 22 08:24:21 UTC 2021 - Tom de Vries <tdevries@suse.com>
- Fix SLE-12 x86_64 unresolvable by not doing BuildRequire

200
gdb.spec
View File

@@ -69,7 +69,7 @@ Group: Development/Languages/C and C++
%endif
Name: gdb%{name_suffix}
Version: 15.2
Version: 16.3
Release: 0
# The release always contains a leading reserved number, start it at 1.
@@ -119,10 +119,6 @@ Obsoletes: devtoolset-1.0-%{pkg_name}
#=push
Source2: gdb-orphanripper.c
# Man page for gstack(1).
#=push
Source3: gdb-gstack.man
# /etc/gdbinit (from Debian but with Fedora compliant location).
#=fedora
Source4: gdbinit
@@ -150,7 +146,6 @@ Source20: import-fedora.sh
%if %{build_testsuite}
NoSource: 0
NoSource: 2
NoSource: 3
NoSource: 4
NoSource: 5
NoSource: 7
@@ -170,28 +165,16 @@ NoSource: 20
# Fedora import from branch f38, commit 82cc8e0.
#Fedora Packages begin
Patch2: gdb-6.3-gstack-20050411.patch
Patch3: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Patch4: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Patch5: gdb-6.5-gcore-buffer-limit-test.patch
Patch6: gdb-6.3-mapping-zero-inode-test.patch
Patch8: gdb-archer-next-over-throw-cxx-exec.patch
Patch10: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Patch12: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch13: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Patch16: gdb-remove-qnx-neutrino-support.patch
Patch17: gdb-backport-buildid-related-changes.patch
Patch18: gdb-add-rpm-suggestion-script.patch
Patch19: gdb-add-deprecated-settings-py-script.patch
Patch20: gdb-6.6-buildid-locate-tests.patch
Patch21: gdb-catchpoint-re-set.patch
Patch2: gdb-6.3-mapping-zero-inode-test.patch
Patch4: gdb-archer-next-over-throw-cxx-exec.patch
Patch5: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Patch7: gdb-add-rpm-suggestion-script.patch
#Fedora Packages end
# Fedora patches fixup
# These need a number with at least four digits, otherwise patchlist.pl removes
# them when upgrading.
Patch1000: fixup-gdb-6.5-gcore-buffer-limit-test.patch
Patch1001: fixup-gdb-add-rpm-suggestion-script.patch
# openSUSE specific
@@ -216,8 +199,6 @@ Patch1204: gdb-testsuite-add-gdb.suse-debranding.exp.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=25703
Patch1500: gdb-symtab-set-default-dwarf-max-cache-age-1000.patch
# https://bugzilla.suse.com/show_bug.cgi?id=1179210
Patch1501: gdb-tui-enable-work-around-libncurses-segfault.patch
# Fixes: gdb.x86_64: W: potential-bashisms /usr/bin/gdb-add-index
Patch1503: gdb-add-index.sh-fix-bashism.patch
# Fixes:
@@ -225,55 +206,16 @@ Patch1503: gdb-add-index.sh-fix-bashism.patch
Patch1504: fix-gdb.mi-new-ui-mi-sync.exp.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=32590
Patch1506: gdb-cli-print-at_hwcap3-and-at_hwcap4.patch
# Work around SCM_UNPACK Werror=sequence-point in libguile v2.0.9 (SLE-12).
Patch1507: gdb-guile-use-scm_debug_typing_strictness-0.patch
# SLE-12 specific fix, hard to reproduce with trunk.
Patch1508: gdb-testsuite-fix-gdb_py_module_available-for-python.patch
# Backports from master, available in GDB 16.
Patch2000: gdb-testsuite-fix-gdb.fortran-array-bounds.exp-on-ar.patch
Patch2001: gdb-symtab-return-correct-reader-for-top-level-cu-in.patch
Patch2002: gdb-tdep-s390-add-arch15-record-replay-support.patch
Patch2003: gdb-testsuite-avoid-intermittent-failures-on-a-debug.patch
Patch2005: gdb-testsuite-fix-gdb.threads-leader-exit-attach.exp.patch
Patch2006: gdb-testsuite-fix-gdb.python-py-format-string.exp-wi.patch
Patch2007: gdb-testsuite-fix-gdb.python-py-mi-cmd.exp-with-pyth.patch
Patch2008: gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-on-arm-lin.patch
Patch2009: gdb-testsuite-fix-regexp-in-gdb.ada-mi_var_access.ex.patch
Patch2010: gdb-testsuite-fix-gdb.arch-arm-pseudo-unwind.exp-wit.patch
Patch2011: gdb-symtab-fix-target-type-of-complex-long-double-on.patch
Patch2012: gdb-testsuite-don-t-use-set-auto-solib-add-off.patch
Patch2013: gdb-tdep-fix-arm-thumb2-hw-breakpoint.patch
Patch2014: gdb-testsuite-fix-gdb.cp-m-static.exp-on-arm.patch
Patch2015: gdb-testsuite-fix-gdb.dwarf2-dw2-fixed-point.exp-on-.patch
Patch2016: gdb-testsuite-fix-gdb.dwarf2-dw2-lines.exp-on-arm-li.patch
Patch2017: gdb-exp-fix-gdb.fortran-intrinsics.exp-fail-on-arm.patch
Patch2018: gdb-tdep-handle-sycall-statx-for-arm-linux.patch
Patch2019: gdb-tdep-fix-recording-of-t1-push.patch
Patch2020: gdb-tdep-handle-syscall-clock_gettime64-for-arm-linu.patch
Patch2021: fix-gdb.dwarf2-shortpiece.exp-on-s390x.patch
Patch2022: handle-address-class-annotation-for-s390x-in-some-te.patch
Patch2023: fix-gdb.dap-step-out.exp-on-s390x.patch
Patch2024: use-setvariable-in-gdb.dap-scopes.exp.patch
Patch2025: gdb-testsuite-fix-regexp-in-gdb.arch-i386-disp-step-.patch
Patch2026: gdb-testsuite-fix-gdb.arch-arm-single-step-kernel-he.patch
Patch2027: gdb-testsuite-fix-gdb.python-py-format-address.exp-o.patch
Patch2028: gdb-testsuite-fix-gdb.arch-riscv-tdesc-regs.exp.patch
Patch2029: gdb-testsuite-fix-gdb.base-list-dot-nodebug-and-make.patch
Patch2030: gdb-testsuite-fix-gdb.base-empty-host-env-vars.exp.patch
Patch2031: gdb-prune-inferior-after-switching-inferior.patch
Patch2032: gdb-testsuite-fix-timeout-in-gdb.mi-mi-multi-command.patch
Patch2033: gdb-testsuite-fix-regexp-in-gdb.threads-stepi-over-c.patch
Patch2034: gdb-record-fix-out-of-bounds-write-in-aarch64_record.patch
Patch2035: gdb-build-fix-unused-var-in-corelow.c.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=32850
Patch1509: gdb-testsuite-work-around-pr32850.patch
# Backports from master, available in GDB 17.
Patch2100: gdb-testsuite-record-less-in-gdb.reverse-time-revers.patch
Patch2101: gdb-doc-fix-gdb.unwinder-docs.patch
Patch2102: gdb-doc-fix-qisaddresstagged-anchor.patch
Patch2103: gdb-testsuite-fix-another-regexp-in-gdb.threads-step.patch
Patch2104: gdb-testsuite-fix-timeouts-in-gdb.threads-step-over-.patch
Patch2105: gdb-testsuite-handle-unordered-dict-in-gdb.python-py.patch
Patch2106: gdb-testsuite-check-gnatmake-version-in-gdb.ada-scal.patch
@@ -290,13 +232,15 @@ Patch2116: gdb-testsuite-fix-gdb.rust-completion.exp-timeout-on.patch
Patch2117: gdb-testsuite-require-supports_process_record-in-gdb.patch
Patch2118: gdb-testsuite-fix-gdb.base-list-dot-nodebug.exp-on-o.patch
Patch2119: gdb-testsuite-use-nostdlib-in-gdb.base-list-dot-node.patch
Patch2120: gdb-testsuite-require-can_spawn_for_attach-in-gdb.ba.patch
Patch2121: gdb-testsuite-fix-gdb.ada-big_packed_array.exp-on-s3.patch
Patch2122: gdb-testsuite-fix-gdb.ada-convvar_comp.exp-on-s390x-.patch
Patch2123: gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-for-amd.patch
Patch2124: gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-glibc-2-41.patch
Patch2125: gdb-tdep-backport-i386_canonicalize_syscall-rewrite-.patch
Patch2126: gdb-testsuite-fix-gdb.threads-access-mem-running-thr.patch
Patch2127: gdb-guile-use-scm_debug_typing_strictness-0.patch
Patch2128: gdb-testsuite-fix-gdb.dwarf2-implptr.exp-regression.patch
Patch2129: gdb-symtab-fix-gdb.base-fission-macro.exp-with-unix-.patch
Patch2130: gdb-testsuite-fix-gdb.threads-clone-attach-detach.ex.patch
# Backport from gdb-patches
@@ -306,10 +250,6 @@ Patch3000: gdb-python-finishbreakpoint-update.patch
Patch3001: gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch
# https://sourceware.org/pipermail/gdb-patches/2021-May/178990.html
Patch3002: gdb-cli-add-ignore-errors-command.patch
# https://sourceware.org/pipermail/gdb-patches/2024-May/209469.html
Patch3003: gdb-testsuite-fix-error-in-gdb.server-server-kill-py.patch
# https://sourceware.org/pipermail/gdb-patches/2024-May/209504.html
Patch3004: gdb-testsuite-fix-timeout-in-gdb.tui-resize-2.exp.patch
# https://sourceware.org/pipermail/gdb-patches/2025-January/214982.html
Patch3005: gdb-doc-fix-standard-replies-xref.patch
# https://sourceware.org/pipermail/gdb-patches/2023-December/205054.html
@@ -318,18 +258,20 @@ Patch3006: gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch
Patch3007: gdb-testsuite-use-c-flag-in-c-test-cases.patch
# https://sourceware.org/pipermail/gdb-patches/2025-March/216050.html
Patch3008: gdb-testsuite-add-gdb.arch-s390-disassemble.exp.patch
# s390x libopcodes backports, available in GDB 16.
Patch4000: s390-align-opcodes-to-lower-case.patch
Patch4001: s390-simplify-dis-assembly-of-insn-operands-with-con.patch
Patch4002: s390-relax-risbg-n-z-risb-h-l-gz-rns-ros-rxs-bgt-ope.patch
Patch4003: s390-add-arch15-instructions.patch
Patch4004: opcodes-fix-std-gnu23-compatibility-wrt-static_asser.patch
Patch4005: s390-add-arch15-instruction-names.patch
Patch4006: s390-add-arch15-concurrent-functions-facility-insns.patch
Patch4007: s390-fix-disassembly-of-optional-addressing-operands.patch
Patch4008: s390-treat-addressing-operand-sequence-as-one-in-dis.patch
# https://sourceware.org/pipermail/gdb-patches/2025-April/217015.html
Patch3009: gdb-tui-enable-work-around-libncurses-segfault.patch
# https://sourceware.org/pipermail/gdb-patches/2025-April/217098.html
Patch3010: gdb-testsuite-fix-another-timeout-in-gdb.base-bg-exe.patch
# https://sourceware.org/pipermail/gdb-patches/2025-February/215898.html
Patch3011: gdb-block-sigterm-during-fetch_inferior_event.patch
# https://sourceware.org/pipermail/gdb-patches/2025-April/217188.html
Patch3012: gdb-testsuite-fix-another-timeout-in-gdb.base-bg-exe.1.patch
# https://sourceware.org/pipermail/gdb-patches/2025-April/217193.html
Patch3013: gdb-testsuite-fix-regexp-in-gdb.multi-pending-bp-del.patch
# https://sourceware.org/pipermail/gdb-patches/2025-March/216441.html
Patch3014: gdb-testsuite-fix-timeout-in-gdb.threads-main-thread.patch
# https://sourceware.org/pipermail/gdb-patches/2025-April/217269.html
Patch3015: gdb-testsuite-fix-timeout-in-gdb.threads-inf-thr-cou.patch
# Debug patches.
@@ -511,6 +453,14 @@ BuildRequires: glibc-devel-static-32bit
BuildRequires: glibc-devel-static
%endif
# Avoid:
# (gdb) break -qualified main
# warning: could not convert 'main' from the host encoding (ISO-8859-1) to
# UTF-32.
# This normally should not happen, please file a bug report.
# See also https://sourceware.org/bugzilla/show_bug.cgi?id=32853.
BuildRequires: glibc-locale
%if 0%{?suse_version} > 1500
# The gccgo command is used by make check for some gdb.go test-cases, so we
# need the gcc-go package. However, the gccgo command was missing from the
@@ -643,23 +593,11 @@ 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 8 -p1
%patch -P 10 -p1
%patch -P 12 -p1
%patch -P 13 -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 7 -p1
#Fedora patching end
%patch -P 1000 -p1
%patch -P 1001 -p1
%patch -P 1100 -p1
@@ -671,53 +609,15 @@ find -name "*.info*"|xargs rm -f
%patch -P 1204 -p1
%patch -P 1500 -p1
%patch -P 1501 -p1
%patch -P 1503 -p1
%patch -P 1504 -p1
%patch -P 1506 -p1
%patch -P 1507 -p1
%patch -P 1508 -p1
%patch -P 2000 -p1
%patch -P 2001 -p1
%patch -P 2002 -p1
%patch -P 2003 -p1
%patch -P 2005 -p1
%patch -P 2006 -p1
%patch -P 2007 -p1
%patch -P 2008 -p1
%patch -P 2009 -p1
%patch -P 2010 -p1
%patch -P 2011 -p1
%patch -P 2012 -p1
%patch -P 2013 -p1
%patch -P 2014 -p1
%patch -P 2015 -p1
%patch -P 2016 -p1
%patch -P 2017 -p1
%patch -P 2018 -p1
%patch -P 2019 -p1
%patch -P 2020 -p1
%patch -P 2021 -p1
%patch -P 2022 -p1
%patch -P 2023 -p1
%patch -P 2024 -p1
%patch -P 2025 -p1
%patch -P 2026 -p1
%patch -P 2027 -p1
%patch -P 2028 -p1
%patch -P 2029 -p1
%patch -P 2030 -p1
%patch -P 2031 -p1
%patch -P 2032 -p1
%patch -P 2033 -p1
%patch -P 2034 -p1
%patch -P 2035 -p1
%patch -P 1509 -p1
%patch -P 2100 -p1
%patch -P 2101 -p1
%patch -P 2102 -p1
%patch -P 2103 -p1
%patch -P 2104 -p1
%patch -P 2105 -p1
%patch -P 2106 -p1
@@ -734,33 +634,30 @@ find -name "*.info*"|xargs rm -f
%patch -P 2117 -p1
%patch -P 2118 -p1
%patch -P 2119 -p1
%patch -P 2120 -p1
%patch -P 2121 -p1
%patch -P 2122 -p1
%patch -P 2123 -p1
%patch -P 2124 -p1
%patch -P 2125 -p1
%patch -P 2126 -p1
%patch -P 2127 -p1
%patch -P 2128 -p1
%patch -P 2129 -p1
%patch -P 2130 -p1
%patch -P 3000 -p1
%patch -P 3001 -p1
%patch -P 3002 -p1
%patch -P 3003 -p1
%patch -P 3004 -p1
%patch -P 3005 -p1
%patch -P 3006 -p1
%patch -P 3007 -p1
%patch -P 3008 -p1
%patch -P 4000 -p1
%patch -P 4001 -p1
%patch -P 4002 -p1
%patch -P 4003 -p1
%patch -P 4004 -p1
%patch -P 4005 -p1
%patch -P 4006 -p1
%patch -P 4007 -p1
%patch -P 4008 -p1
%patch -P 3009 -p1
%patch -P 3010 -p1
%patch -P 3011 -p1
%patch -P 3012 -p1
%patch -P 3013 -p1
%patch -P 3014 -p1
%patch -P 3015 -p1
#unpack libipt
%if 0%{have_libipt}
@@ -1197,11 +1094,6 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}
rm -rf $RPM_BUILD_ROOT/usr/src
%endif
# pstack obsoletion
%if %{build_main}
cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1
%endif
%endif # 0%{!?_with_upstream:1}
%if %{build_main}

View File

@@ -1,125 +0,0 @@
From f6d4de8ce34365107106c4af60a9a1fb86a9977d Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Wed, 24 Jul 2024 14:56:56 +0200
Subject: [PATCH 18/46] Handle address class annotation for s390x in some
test-cases
On s390x-linux, I ran into:
...
(gdb) ptype crash^M
type = class crash {^M
^M
public:^M
crash(int (class {...}::*)(class {...} * const @mode32));^M
}^M
(gdb) FAIL: gdb.dwarf2/dw2-anon-mptr.exp: ptype crash
...
The problem is that the test-case doesn't expect the address class annotation
@mode32.
The test-case uses a .S file, with the address size hard-coded to 4 bytes, and
that's something that is annotated with @mode32 on s390x (which uses 8 byte
addresses).
Fix this by allowing the annotation in the regexp.
Likewise in two other test-cases.
Tested on s390-linux and x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp | 16 +++++++++++++++-
gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp | 17 ++++++++++++-----
.../gdb.dwarf2/member-ptr-forwardref.exp | 16 +++++++++++++++-
3 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
index 5935ba628b6..fa98e413ad8 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp
@@ -36,5 +36,19 @@ gdb_test "show cp-abi" {The currently selected C\+\+ ABI is "gnu-v3".*}
gdb_load $binfile
+set re_address_class "@\[^\r\n\]+"
+
+set re_class_ptr_const \
+ [string cat \
+ [string_to_regexp "class {...} * const"] "( $re_address_class)?"]
+
gdb_test "ptype crash" \
- "type = class crash {\[\r\n \t\]*public:\[\r\n \t\]*crash\\(int \\(class {\\.\\.\\.}::\\*\\)\\(class {\\.\\.\\.} \\* const\\)\\);\[\r\n \t\]*}"
+ [multi_line \
+ "type = class crash {" \
+ "" \
+ " public:" \
+ [string cat \
+ [string_to_regexp " crash(int (class {...}::*)("] \
+ $re_class_ptr_const \
+ [string_to_regexp "));"]] \
+ "}"]
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
index cebed1d292b..d73f4a892ba 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-opt-structptr.exp
@@ -126,6 +126,8 @@ proc build_test_program {} {
}
}
+set re_address_class "@\[^\r\n\]+"
+
# Test access to an optimized-out pointer-to-struct using the
# console interpreter.
@@ -210,13 +212,18 @@ proc do_mi_test {} {
# Test that -var-create for 'ptr' is successful.
mi_create_varobj "var1" "ptr" "create varobj for ptr"
+
+ set struct_foo_ptr \
+ [string cat \
+ [string_to_regexp "struct foo *"] "( $::re_address_class)?"]
# Test that -var-list-children of 'ptr' is successful.
- mi_list_varobj_children "var1" { \
- {var1.a a 0 integer} \
- {var1.x x 128 foo__array_type} \
- {var1.y y 3 "struct foo \\*"} \
- } "get children of var1 (ptr)"
+ mi_list_varobj_children "var1" \
+ [list \
+ {var1.a a 0 integer} \
+ {var1.x x 128 foo__array_type} \
+ [list "var1.y" "y" "3" $struct_foo_ptr]] \
+ "get children of var1 (ptr)"
# Test that dereferencing 'ptr' will throw an error.
mi_gdb_test "-var-create var2 * &((ptr)->a)" \
diff --git a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
index c97c887d5a1..21ad111c9ac 100644
--- a/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
+++ b/gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.exp
@@ -34,5 +34,19 @@ gdb_test "show cp-abi" {The currently selected C\+\+ ABI is "gnu-v3".*}
gdb_load ${binfile}
+set re_address_class "@\[^\r\n\]+"
+
+set re_C_ptr \
+ [string cat \
+ [string_to_regexp "C *"] "( const)?( $re_address_class)?"]
+
gdb_test_no_output "set language c++"
-gdb_test "ptype c" "type = struct C {\[\r\n \t\]*private:\[\r\n \t\]*int \\(C::\\*fp\\)\\(C \\*( const)?\\);\[\r\n \t\]*}"
+gdb_test "ptype c" \
+ [multi_line \
+ "type = struct C {" \
+ " private:" \
+ [string cat \
+ [string_to_regexp " int (C::*fp)("] \
+ $re_C_ptr \
+ [string_to_regexp ");"]] \
+ "}"]
--
2.43.0

View File

@@ -9,9 +9,6 @@ skip_patches=(
gdb-6.8-bz466901-backtrace-full-prelinked.patch
# Dropped by fedora.
gdb-rhbz1156192-recursive-dlopen-test.patch
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
gdb-test-bt-cfi-without-die.patch
)
usage ()

View File

@@ -62,6 +62,11 @@ for f in $files; do
# Fix patch.patch.
f=$(echo "$f" \
| sed 's/\.patch\.patch/.patch/')
if [ -f "$f" ]; then
f=$(echo "$f" \
| sed 's/\.patch$/.1.patch/')
fi
# Copy.
cp "$dir"/"$orig_f" tmp.patches/"$f"

View File

@@ -1,44 +0,0 @@
From 899cec1550fa94e4644a3d5be4a229eb89b856d3 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 7 Mar 2025 13:06:52 +0100
Subject: [PATCH 05/10] opcodes: fix -std=gnu23 compatibility wrt static_assert
static_assert is declared in C23 so we can't reuse that identifier:
* Define our own static_assert conditionally;
* Rename "static assert" hacks to _N as we do already in some places
to avoid a conflict.
ChangeLog:
PR ld/32372
* i386-gen.c (static_assert): Define conditionally.
* mips-formats.h (MAPPED_INT): Rename identifier.
(MAPPED_REG): Rename identifier.
(OPTIONAL_MAPPED_REG): Rename identifier.
* s390-opc.c (static_assert): Define conditionally.
(cherry picked from commit 8ebe62f3f0d)
(cherry pick dropped: opcodes/i386-gen.c)
(cherry pick dropped: opcodes/mips-formats.h)
---
opcodes/s390-opc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 9d9f0973e55..49efd714157 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -36,7 +36,9 @@
/* Build-time checks are preferrable over runtime ones. Use this construct
in preference where possible. */
+#ifndef static_assert
#define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
+#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
--
2.43.0

View File

@@ -20,7 +20,7 @@ SLFO
archs="x86_64 i586"
version=15.2
version=16.3
usage ()
{

31
qa.sh
View File

@@ -367,6 +367,9 @@ kfail=(
# https://sourceware.org/bugzilla/show_bug.cgi?id=32688
"FAIL: gdb.threads/thread-specific-bp.exp: non_stop=on: continue to end"
# https://sourceware.org/bugzilla/show_bug.cgi?id=31308
"FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_mxcsr_before_enable: check new value of MXCSR is still in place"
) # kfail
kfail_sle12=(
@@ -437,6 +440,10 @@ kfail_sle12=(
"FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into bar"
"FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into foo"
"FAIL: gdb.base/list-dot-nodebug.exp: debug=none: runto: run to bar"
"FAIL: gdb.base/errno.exp: pthreads-static-macros: runto: run to main"
"FAIL: gdb.base/errno.exp: pthreads-static: runto: run to main"
"FAIL: gdb.base/errno.exp: static-macros: runto: run to main"
"FAIL: gdb.base/errno.exp: static: runto: run to main"
# Fails on both i586 and s390x/-m31 for SLE-12-SP3, but does not reproduce
# on s390x/-m31 for SLE-12-SP5 with trunk.
@@ -471,16 +478,6 @@ kfail_sle11=(
kfail_factory=(
# yama ptrace_scope == 1
# https://sourceware.org/pipermail/gdb-patches/2024-April/208251.html
"FAIL: .*attach.*"
"FAIL: .*detach.*"
"FAIL: gdb.base/gcore-excessive-memory.exp: verify we can get to main"
"FAIL: gdb.base/gcore-excessive-memory.exp: verify we can get to main"
"FAIL: gdb.base/gcore-excessive-memory.exp: Save the core file"
"FAIL: gdb.base/gcorebg.exp: Core file generated by standard gcore"
"FAIL: gdb.threads/check-libthread-db.exp: automated load-time check: libpthread.so fully initialized: check debug libthread-db output \(pattern 1\)"
# https://sourceware.org/pipermail/gdb-patches/2021-October/182449.html
"FAIL: gdb.threads/current-lwp-dead.exp: continue to breakpoint: fn_return"
@@ -823,16 +820,6 @@ case $n in
# https://sourceware.org/bugzilla/show_bug.cgi?id=31648
"SLE-11.*UNRESOLVED: gdb.ada/tick_length_array_enum_idx.exp: print vars'length"
# yama ptrace_scope == 1
# https://sourceware.org/pipermail/gdb-patches/2024-April/208251.html
"(Factory|SLFO).*UNRESOLVED: gdb.base/gstack.exp: spawn gstack"
"(Factory|SLFO).*UNRESOLVED: gdb.multi/multi-term-settings.exp: inf1_how=run: inf2_how=attach: inf2: flush inferior output"
"(Factory|SLFO).*UNRESOLVED: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=run: inf1: flush inferior output"
"(Factory|SLFO).*UNRESOLVED: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=attach: inf2: flush inferior output"
"(Factory|SLFO).*UNRESOLVED: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=run: continue"
"(Factory|SLFO).*UNRESOLVED: gdb.multi/multi-term-settings.exp: inf1_how=attach: inf2_how=run: continue"
"(Factory|SLFO).*UNRESOLVED: gdb.multi/multi-term-settings.exp: inf1_how=run: inf2_how=attach: continue"
# https://sourceware.org/bugzilla/show_bug.cgi?id=31671
"SLE-11.*UNRESOLVED: gdb.objc/basicclass.exp: call an Objective-C method with no arguments"
)
@@ -954,7 +941,7 @@ case $n in
case $arch in
x86_64)
case $id in
SLE-12|SLFO)
SLE-12|SLFO|16.0)
sums=("$config/gdb-$arch-suse-linux-m64.-fPIE.-pie.sum"
"$config/gdb-$arch-suse-linux-m64.sum"
"$config/gdb-$arch-suse-linux-m32.-fPIE.-pie.sum"
@@ -974,7 +961,7 @@ case $n in
;;
aarch64)
case $id in
SLE-12|SLFO)
SLE-12|SLFO|16.0)
sums=("$config/gdb-$arch-suse-linux.-fPIE.-pie.sum"
"$config/gdb-$arch-suse-linux.sum")
;;

View File

@@ -1,65 +0,0 @@
From e709a3a30769a61def5e0995e8b4b0d94815e6ea Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:53 +0100
Subject: [PATCH 07/10] s390: Add arch15 Concurrent-Functions Facility insns
opcodes/
* s390-opc.txt: Add arch15 Concurrent-Functions Facility
instructions.
* s390-opc.c (INSTR_SSF_RRDRD2, MASK_SSF_RRDRD2): New SSF
instruction format variant.
gas/testsuite/
* gas/s390/zarch-arch15.d: Tests for arch15 Concurrent-Functions
Facility instructions.
* gas/s390/zarch-arch15.s: Likewise.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit 76445f36a2f)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-arch15.d)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-arch15.s)
---
opcodes/s390-opc.c | 2 ++
opcodes/s390-opc.txt | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 49efd714157..23c1c3a24e5 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -468,6 +468,7 @@ unused_s390_operands_static_asserts (void)
#define INSTR_SS_RRRDRD2 6, { R_8,D_20,B_16,R_12,D_36,B_32 } /* e.g. plo */
#define INSTR_SS_RRRDRD3 6, { R_8,R_12,D_20,B_16,D_36,B_32 } /* e.g. lmd */
#define INSTR_SSF_RRDRD 6, { D_20,B_16,D_36,B_32,R_8,0 } /* e.g. mvcos */
+#define INSTR_SSF_RRDRD2 6, { R_8,D_20,B_16,D_36,B_32,0 } /* e.g. cal */
#define INSTR_SSF_RERDRD2 6, { RE_8,D_20,B_16,D_36,B_32,0 } /* e.g. lpd */
#define INSTR_S_00 4, { 0,0,0,0,0,0 } /* e.g. hsch */
#define INSTR_S_RD 4, { D_20,B_16,0,0,0,0 } /* e.g. stck */
@@ -700,6 +701,7 @@ unused_s390_operands_static_asserts (void)
#define MASK_SS_RRRDRD2 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_SS_RRRDRD3 { 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define MASK_SSF_RRDRD { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
+#define MASK_SSF_RRDRD2 { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
#define MASK_SSF_RERDRD2 { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
#define MASK_S_00 { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }
#define MASK_S_RD { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index 82d6f06a992..68d8896bf4e 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -2190,3 +2190,11 @@ e6000000004a vcvdq VRI_VV0UU "vector convert to decimal 128 bit" arch15 zarch
e6000000005f vtp VRR_0V0U "vector test decimal" arch15 zarch optparm
e6000000007f vtz VRR_0VVU "vector test zoned" arch15 zarch
+
+# Concurrent-Functions Facility
+
+c806 cal SSF_RRDRD2 "compare and load 32" arch15 zarch
+c807 calg SSF_RRDRD2 "compare and load 64" arch15 zarch
+c80f calgf SSF_RRDRD2 "compare and load 64<32" arch15 zarch
+
+eb0000000016 pfcr RSY_RRRD "perform functions with concurrent results" arch15 zarch
--
2.43.0

View File

@@ -1,246 +0,0 @@
From b813112665aa35b5d5f7f76f26b0f3035bc5a98b Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:52 +0100
Subject: [PATCH 06/10] s390: Add arch15 instruction names
opcodes/
* s390-opc.txt: Add arch15 instruction names.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit b0588b2173b)
---
opcodes/s390-opc.txt | 220 ++++++++++++++++++++++---------------------
1 file changed, 114 insertions(+), 106 deletions(-)
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index bbc00b10355..82d6f06a992 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -2076,109 +2076,117 @@ b28f qpaci S_RD "query processor activity counter information" arch14 zarch
# arch15 instructions
-e70000000089 vblend VRR_VVVU0V " " arch15 zarch
-e70000000089 vblendb VRR_VVV0V " " arch15 zarch
-e70001000089 vblendh VRR_VVV0V " " arch15 zarch
-e70002000089 vblendf VRR_VVV0V " " arch15 zarch
-e70003000089 vblendg VRR_VVV0V " " arch15 zarch
-e70004000089 vblendq VRR_VVV0V " " arch15 zarch
-
-e70000000088 veval VRI_VVV0UV " " arch15 zarch
-
-e70000000054 vgem VRR_VV0U " " arch15 zarch
-e70000000054 vgemb VRR_VV " " arch15 zarch
-e70000001054 vgemh VRR_VV " " arch15 zarch
-e70000002054 vgemf VRR_VV " " arch15 zarch
-e70000003054 vgemg VRR_VV " " arch15 zarch
-e70000004054 vgemq VRR_VV " " arch15 zarch
-
-e700000030d7 vuphg VRR_VV " " arch15 zarch
-e700000030d5 vuplhg VRR_VV " " arch15 zarch
-e700000030d6 vuplg VRR_VV " " arch15 zarch
-e700000030d4 vupllg VRR_VV " " arch15 zarch
-
-e700000040f2 vavgq VRR_VVV " " arch15 zarch
-e700000040f0 vavglq VRR_VVV " " arch15 zarch
-e700000040db vecq VRR_VV " " arch15 zarch
-e700000040d9 veclq VRR_VV " " arch15 zarch
-e700000040f8 vceqq VRR_VVV " " arch15 zarch
-e700001040f8 vceqqs VRR_VVV " " arch15 zarch
-e700000040fb vchq VRR_VVV " " arch15 zarch
-e700001040fb vchqs VRR_VVV " " arch15 zarch
-e700000040f9 vchlq VRR_VVV " " arch15 zarch
-e700001040f9 vchlqs VRR_VVV " " arch15 zarch
-e70000004053 vclzq VRR_VV " " arch15 zarch
-e70000004052 vctzq VRR_VV " " arch15 zarch
-e700000040de vlcq VRR_VV " " arch15 zarch
-e700000040df vlpq VRR_VV " " arch15 zarch
-e700000040ff vmxq VRR_VVV " " arch15 zarch
-e700000040fd vmxlq VRR_VVV " " arch15 zarch
-e700000040fe vmnq VRR_VVV " " arch15 zarch
-e700000040fc vmnlq VRR_VVV " " arch15 zarch
-e700030000aa vmalg VRR_VVV0V " " arch15 zarch
-e700040000aa vmalq VRR_VVV0V " " arch15 zarch
-e700030000ab vmahg VRR_VVV0V " " arch15 zarch
-e700040000ab vmahq VRR_VVV0V " " arch15 zarch
-e700030000a9 vmalhg VRR_VVV0V " " arch15 zarch
-e700040000a9 vmalhq VRR_VVV0V " " arch15 zarch
-e700030000ae vmaeg VRR_VVV0V " " arch15 zarch
-e700030000ac vmaleg VRR_VVV0V " " arch15 zarch
-e700030000af vmaog VRR_VVV0V " " arch15 zarch
-e700030000ad vmalog VRR_VVV0V " " arch15 zarch
-e700000030a3 vmhg VRR_VVV " " arch15 zarch
-e700000040a3 vmhq VRR_VVV " " arch15 zarch
-e700000030a1 vmlhg VRR_VVV " " arch15 zarch
-e700000040a1 vmlhq VRR_VVV " " arch15 zarch
-e700000030a2 vmlg VRR_VVV " " arch15 zarch
-e700000040a2 vmlq VRR_VVV " " arch15 zarch
-e700000030a6 vmeg VRR_VVV " " arch15 zarch
-e700000030a4 vmleg VRR_VVV " " arch15 zarch
-e700000030a7 vmog VRR_VVV " " arch15 zarch
-e700000030a5 vmlog VRR_VVV " " arch15 zarch
-
-e700000000b2 vd VRR_VVV0UU " " arch15 zarch
-e700000020b2 vdf VRR_VVV0U02 " " arch15 zarch
-e700000030b2 vdg VRR_VVV0U02 " " arch15 zarch
-e700000040b2 vdq VRR_VVV0U02 " " arch15 zarch
-
-e700000000b0 vdl VRR_VVV0UU " " arch15 zarch
-e700000020b0 vdlf VRR_VVV0U02 " " arch15 zarch
-e700000030b0 vdlg VRR_VVV0U02 " " arch15 zarch
-e700000040b0 vdlq VRR_VVV0U02 " " arch15 zarch
-
-e700000000b3 vr VRR_VVV0UU " " arch15 zarch
-e700000020b3 vrf VRR_VVV0U02 " " arch15 zarch
-e700000030b3 vrg VRR_VVV0U02 " " arch15 zarch
-e700000040b3 vrq VRR_VVV0U02 " " arch15 zarch
-
-e700000000b1 vrl VRR_VVV0UU " " arch15 zarch
-e700000020b1 vrlf VRR_VVV0U02 " " arch15 zarch
-e700000030b1 vrlg VRR_VVV0U02 " " arch15 zarch
-e700000040b1 vrlq VRR_VVV0U02 " " arch15 zarch
-
-b968 clzg RRE_RR " " arch15 zarch
-b969 ctzg RRE_RR " " arch15 zarch
-
-e30000000060 lxab RXY_RRRD " " arch15 zarch
-e30000000062 lxah RXY_RRRD " " arch15 zarch
-e30000000064 lxaf RXY_RRRD " " arch15 zarch
-e30000000066 lxag RXY_RRRD " " arch15 zarch
-e30000000068 lxaq RXY_RRRD " " arch15 zarch
-
-e30000000061 llxab RXY_RRRD " " arch15 zarch
-e30000000063 llxah RXY_RRRD " " arch15 zarch
-e30000000065 llxaf RXY_RRRD " " arch15 zarch
-e30000000067 llxag RXY_RRRD " " arch15 zarch
-e30000000069 llxaq RXY_RRRD " " arch15 zarch
-
-b96c bextg RRF_R0RR2 " " arch15 zarch
-b96d bdepg RRF_R0RR2 " " arch15 zarch
-
-b93e kimd RRF_U0RR " " arch15 zarch optparm
-b93f klmd RRF_U0RR " " arch15 zarch optparm
-
-e6000000004e vcvbq VRR_VV0U2 " " arch15 zarch
-e6000000004a vcvdq VRI_VV0UU " " arch15 zarch
-
-e6000000005f vtp VRR_0V0U " " arch15 zarch optparm
-e6000000007f vtz VRR_0VVU " " arch15 zarch
+# Vector-Enhancements Facility 3
+
+e70000000089 vblend VRR_VVVU0V "vector blend" arch15 zarch
+e70000000089 vblendb VRR_VVV0V "vector blend byte" arch15 zarch
+e70001000089 vblendh VRR_VVV0V "vector blend halfword" arch15 zarch
+e70002000089 vblendf VRR_VVV0V "vector blend word" arch15 zarch
+e70003000089 vblendg VRR_VVV0V "vector blend doubleword" arch15 zarch
+e70004000089 vblendq VRR_VVV0V "vector blend quadword" arch15 zarch
+
+e70000000088 veval VRI_VVV0UV "vector evaluate" arch15 zarch
+
+e70000000054 vgem VRR_VV0U "vector generate element masks" arch15 zarch
+e70000000054 vgemb VRR_VV "vector generate element masks byte" arch15 zarch
+e70000001054 vgemh VRR_VV "vector generate element masks halfword" arch15 zarch
+e70000002054 vgemf VRR_VV "vector generate element masks word" arch15 zarch
+e70000003054 vgemg VRR_VV "vector generate element masks doubleword" arch15 zarch
+e70000004054 vgemq VRR_VV "vector generate element masks quadword" arch15 zarch
+
+e700000030d7 vuphg VRR_VV "vector unpack high doubleword" arch15 zarch
+e700000030d5 vuplhg VRR_VV "vector unpack logical high doubleword" arch15 zarch
+e700000030d6 vuplg VRR_VV "vector unpack low doubleword" arch15 zarch
+e700000030d4 vupllg VRR_VV "vector unpack logical low doubleword" arch15 zarch
+
+e700000040f2 vavgq VRR_VVV "vector average quadword" arch15 zarch
+e700000040f0 vavglq VRR_VVV "vector average logical quadword" arch15 zarch
+e700000040db vecq VRR_VV "vector element compare quadword" arch15 zarch
+e700000040d9 veclq VRR_VV "vector element compare logical quadword" arch15 zarch
+e700000040f8 vceqq VRR_VVV "vector compare equal quadword" arch15 zarch
+e700001040f8 vceqqs VRR_VVV "vector compare equal quadword" arch15 zarch
+e700000040fb vchq VRR_VVV "vector compare high quadword" arch15 zarch
+e700001040fb vchqs VRR_VVV "vector compare high quadword" arch15 zarch
+e700000040f9 vchlq VRR_VVV "vector compare high logical quadword" arch15 zarch
+e700001040f9 vchlqs VRR_VVV "vector compare high logical quadword" arch15 zarch
+e70000004053 vclzq VRR_VV "vector count leading zeros quadword" arch15 zarch
+e70000004052 vctzq VRR_VV "vector count trailing zeros quadword" arch15 zarch
+e700000040de vlcq VRR_VV "vector load complement quadword" arch15 zarch
+e700000040df vlpq VRR_VV "vector load positive quadword" arch15 zarch
+e700000040ff vmxq VRR_VVV "vector maximum quadword" arch15 zarch
+e700000040fd vmxlq VRR_VVV "vector maximum logical quadword" arch15 zarch
+e700000040fe vmnq VRR_VVV "vector minimum quadword" arch15 zarch
+e700000040fc vmnlq VRR_VVV "vector minimum logical quadword" arch15 zarch
+e700030000aa vmalg VRR_VVV0V "vector multiply and add low doubleword" arch15 zarch
+e700040000aa vmalq VRR_VVV0V "vector multiply and add low quadword" arch15 zarch
+e700030000ab vmahg VRR_VVV0V "vector multiply and add high doubleword" arch15 zarch
+e700040000ab vmahq VRR_VVV0V "vector multiply and add high quadword" arch15 zarch
+e700030000a9 vmalhg VRR_VVV0V "vector multiply and add logical high doubleword" arch15 zarch
+e700040000a9 vmalhq VRR_VVV0V "vector multiply and add logical high quadword" arch15 zarch
+e700030000ae vmaeg VRR_VVV0V "vector multiply and add even doubleword" arch15 zarch
+e700030000ac vmaleg VRR_VVV0V "vector multiply and add logical even doubleword" arch15 zarch
+e700030000af vmaog VRR_VVV0V "vector multiply and add odd doubleword" arch15 zarch
+e700030000ad vmalog VRR_VVV0V "vector multiply and add logical odd doubleword" arch15 zarch
+e700000030a3 vmhg VRR_VVV "vector multiply high doubleword" arch15 zarch
+e700000040a3 vmhq VRR_VVV "vector multiply high quadword" arch15 zarch
+e700000030a1 vmlhg VRR_VVV "vector multiply logical high doubleword" arch15 zarch
+e700000040a1 vmlhq VRR_VVV "vector multiply logical high quadword" arch15 zarch
+e700000030a2 vmlg VRR_VVV "vector multiply low doubleword" arch15 zarch
+e700000040a2 vmlq VRR_VVV "vector multiply low quadword" arch15 zarch
+e700000030a6 vmeg VRR_VVV "vector multiply even doubleword" arch15 zarch
+e700000030a4 vmleg VRR_VVV "vector multiply logical even doubleword" arch15 zarch
+e700000030a7 vmog VRR_VVV "vector multiply odd doubleword" arch15 zarch
+e700000030a5 vmlog VRR_VVV "vector multiply logical odd doubleword" arch15 zarch
+
+e700000000b2 vd VRR_VVV0UU "vector divide" arch15 zarch
+e700000020b2 vdf VRR_VVV0U02 "vector divide word" arch15 zarch
+e700000030b2 vdg VRR_VVV0U02 "vector divide doubleword" arch15 zarch
+e700000040b2 vdq VRR_VVV0U02 "vector divide quadword" arch15 zarch
+
+e700000000b0 vdl VRR_VVV0UU "vector divide logical" arch15 zarch
+e700000020b0 vdlf VRR_VVV0U02 "vector divide logical word" arch15 zarch
+e700000030b0 vdlg VRR_VVV0U02 "vector divide logical doubleword" arch15 zarch
+e700000040b0 vdlq VRR_VVV0U02 "vector divide logical quadword" arch15 zarch
+
+e700000000b3 vr VRR_VVV0UU "vector remainder" arch15 zarch
+e700000020b3 vrf VRR_VVV0U02 "vector remainder word" arch15 zarch
+e700000030b3 vrg VRR_VVV0U02 "vector remainder doubleword" arch15 zarch
+e700000040b3 vrq VRR_VVV0U02 "vector remainder quadword" arch15 zarch
+
+e700000000b1 vrl VRR_VVV0UU "vector remainder logical" arch15 zarch
+e700000020b1 vrlf VRR_VVV0U02 "vector remainder logical word" arch15 zarch
+e700000030b1 vrlg VRR_VVV0U02 "vector remainder logical doubleword" arch15 zarch
+e700000040b1 vrlq VRR_VVV0U02 "vector remainder logical quadword" arch15 zarch
+
+# Miscellaneous-Instruction-Extensions Facility 4
+
+b968 clzg RRE_RR "count leading zeros" arch15 zarch
+b969 ctzg RRE_RR "count trailing zeros" arch15 zarch
+
+e30000000060 lxab RXY_RRRD "load indexed address (shift left 0)" arch15 zarch
+e30000000062 lxah RXY_RRRD "load indexed address (shift left 1)" arch15 zarch
+e30000000064 lxaf RXY_RRRD "load indexed address (shift left 2)" arch15 zarch
+e30000000066 lxag RXY_RRRD "load indexed address (shift left 3)" arch15 zarch
+e30000000068 lxaq RXY_RRRD "load indexed address (shift left 4)" arch15 zarch
+
+e30000000061 llxab RXY_RRRD "load logical indexed address (shift left 0)" arch15 zarch
+e30000000063 llxah RXY_RRRD "load logical indexed address (shift left 1)" arch15 zarch
+e30000000065 llxaf RXY_RRRD "load logical indexed address (shift left 2)" arch15 zarch
+e30000000067 llxag RXY_RRRD "load logical indexed address (shift left 3)" arch15 zarch
+e30000000069 llxaq RXY_RRRD "load logical indexed address (shift left 4)" arch15 zarch
+
+b96c bextg RRF_R0RR2 "bit extract" arch15 zarch
+b96d bdepg RRF_R0RR2 "bit deposit" arch15 zarch
+
+# Message-Security-Assist Extension 12
+
+b93e kimd RRF_U0RR "compute intermediate message digest" arch15 zarch optparm
+b93f klmd RRF_U0RR "compute last message digest" arch15 zarch optparm
+
+# Vector-Packed-Decimal-Enhancement Facility 3
+
+e6000000004e vcvbq VRR_VV0U2 "vector convert to binary 128 bit" arch15 zarch
+e6000000004a vcvdq VRI_VV0UU "vector convert to decimal 128 bit" arch15 zarch
+
+e6000000005f vtp VRR_0V0U "vector test decimal" arch15 zarch optparm
+e6000000007f vtz VRR_0VVU "vector test zoned" arch15 zarch
--
2.43.0

View File

@@ -1,262 +0,0 @@
From e6ae6b0fa91079a90643c04a57a9efdb2b97644c Mon Sep 17 00:00:00 2001
From: Andreas Krebbel <krebbel@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:52 +0100
Subject: [PATCH 04/10] s390: Add arch15 instructions
opcodes/
* s390-mkopc.c (main) Accept arch15 as CPU string.
* s390-opc.txt: Add arch15 instructions.
include/
* opcode/s390.h (enum s390_opcode_cpu_val): Add
S390_OPCODE_ARCH15.
gas/
* config/tc-s390.c (s390_parse_cpu): New entry for arch15.
* doc/c-s390.texi: Document arch15 march option.
* doc/as.texi: Likewise.
* testsuite/gas/s390/s390.exp: Run the arch15 related tests.
* testsuite/gas/s390/zarch-arch15.d: Tests for arch15
instructions.
* testsuite/gas/s390/zarch-arch15.s: Likewise.
Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit a98a6fa2d8e)
(cherry pick dropped: gas/config/tc-s390.c)
(cherry pick dropped: gas/doc/as.texi)
(cherry pick dropped: gas/doc/c-s390.texi)
(cherry pick dropped: gas/testsuite/gas/s390/s390.exp)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-arch15.d)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-arch15.s)
---
include/opcode/s390.h | 1 +
opcodes/s390-mkopc.c | 2 +
opcodes/s390-opc.c | 18 +++++--
opcodes/s390-opc.txt | 110 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 128 insertions(+), 3 deletions(-)
diff --git a/include/opcode/s390.h b/include/opcode/s390.h
index 8de03701172..8322882410e 100644
--- a/include/opcode/s390.h
+++ b/include/opcode/s390.h
@@ -45,6 +45,7 @@ enum s390_opcode_cpu_val
S390_OPCODE_ARCH12,
S390_OPCODE_ARCH13,
S390_OPCODE_ARCH14,
+ S390_OPCODE_ARCH15,
S390_OPCODE_MAXCPU
};
diff --git a/opcodes/s390-mkopc.c b/opcodes/s390-mkopc.c
index 1f5729a3db0..825188407ee 100644
--- a/opcodes/s390-mkopc.c
+++ b/opcodes/s390-mkopc.c
@@ -443,6 +443,8 @@ main (void)
else if (strcmp (cpu_string, "z16") == 0
|| strcmp (cpu_string, "arch14") == 0)
min_cpu = S390_OPCODE_ARCH14;
+ else if (strcmp (cpu_string, "arch15") == 0)
+ min_cpu = S390_OPCODE_ARCH15;
else {
print_error ("Mnemonic \"%s\": Couldn't parse CPU string: %s\n",
mnemonic, cpu_string);
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index fe0299aa4e5..9d9f0973e55 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -228,7 +228,9 @@ const struct s390_operand s390_operands[] =
{ 12, 16, 0 },
#define U16_16 (U12_16 + 1) /* 16 bit unsigned value starting at 16 */
{ 16, 16, 0 },
-#define U16_32 (U16_16 + 1) /* 16 bit unsigned value starting at 32 */
+#define U16_20 (U16_16 + 1) /* 16 bit unsigned value starting at 20 */
+ { 16, 20, 0 },
+#define U16_32 (U16_20 + 1) /* 16 bit unsigned value starting at 32 */
{ 16, 32, 0 },
#define U32_16 (U16_32 + 1) /* 32 bit unsigned value starting at 16 */
{ 32, 16, 0 },
@@ -484,6 +486,8 @@ unused_s390_operands_static_asserts (void)
#define INSTR_VRI_VVUUU 6, { V_8,V_12,U12_16,U4_32,U4_28,0 } /* e.g. vftci */
#define INSTR_VRI_VVUUU2 6, { V_8,V_12,U8_28,U8_16,U4_24,0 } /* e.g. vpsop */
#define INSTR_VRI_VR0UU 6, { V_8,R_12,U8_28,U4_24,0,0 } /* e.g. vcvd */
+#define INSTR_VRI_VV0UU 6, { V_8,V_12,U8_28,U4_24,0,0 } /* e.g. vcvdq */
+#define INSTR_VRI_VVV0UV 6, { V_8,V_12,V_16,V_32,U8_24,0 } /* e.g. veval */
#define INSTR_VRX_VRRD 6, { V_8,D_20,X_12,B_16,0,0 } /* e.g. vl */
#define INSTR_VRX_VV 6, { V_8,V_12,0,0,0,0 } /* e.g. vlr */
#define INSTR_VRX_VRRDU 6, { V_8,D_20,X_12,B_16,U4_32,0 } /* e.g. vlrep */
@@ -494,10 +498,10 @@ unused_s390_operands_static_asserts (void)
#define INSTR_VRS_VRRDU 6, { V_8,R_12,D_20,B_16,U4_32,0 } /* e.g. vlvg */
#define INSTR_VRS_VRRD 6, { V_8,R_12,D_20,B_16,0,0 } /* e.g. vlvgb */
#define INSTR_VRS_RRDV 6, { V_32,R_12,D_20,B_16,0,0 } /* e.g. vlrlr */
-#define INSTR_VRR_0V 6, { V_12,0,0,0,0,0 } /* e.g. vtp */
#define INSTR_VRR_VRR 6, { V_8,R_12,R_16,0,0,0 } /* e.g. vlvgp */
#define INSTR_VRR_VVV0U 6, { V_8,V_12,V_16,U4_32,0,0 } /* e.g. vmrh */
#define INSTR_VRR_VVV0U0 6, { V_8,V_12,V_16,U4_24,0,0 } /* e.g. vfaeb */
+#define INSTR_VRR_VVV0U02 6, { V_8,V_12,V_16,U4_28,0,0 } /* e.g. vd */
#define INSTR_VRR_VVV0U1 INSTR_VRR_VVV0U0 /* e.g. vfaebs*/
#define INSTR_VRR_VVV0U2 INSTR_VRR_VVV0U0 /* e.g. vfaezb*/
#define INSTR_VRR_VVV0U3 INSTR_VRR_VVV0U0 /* e.g. vfaezbs*/
@@ -523,6 +527,9 @@ unused_s390_operands_static_asserts (void)
#define INSTR_VRR_VV0UUU 6, { V_8,V_12,U4_32,U4_28,U4_24,0 } /* e.g. vcdg */
#define INSTR_VRR_VVVU0UV 6, { V_8,V_12,V_16,V_32,U4_28,U4_20 } /* e.g. vfma */
#define INSTR_VRR_VV0U0U 6, { V_8,V_12,U4_32,U4_24,0,0 } /* e.g. vistr */
+#define INSTR_VRR_0V 6, { V_12,0,0,0,0,0 } /* e.g. vtp */
+#define INSTR_VRR_0V0U 6, { V_12,U16_20,0,0,0,0 } /* e.g. vtp */
+#define INSTR_VRR_0VVU 6, { V_12,V_16,U16_20,0,0,0 } /* e.g. vtz */
#define INSTR_VRR_0VV0U 6, { V_12,V_16,U4_24,0,0,0 } /* e.g. vcp */
#define INSTR_VRR_RV0U 6, { R_8,V_12,U4_24,0,0,0 } /* e.g. vcvb */
#define INSTR_VRR_RV0UU 6, { R_8,V_12,U4_24,U4_28,0,0 } /* e.g. vcvb */
@@ -711,6 +718,8 @@ unused_s390_operands_static_asserts (void)
#define MASK_VRI_VVUUU { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_VRI_VVUUU2 { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_VRI_VR0UU { 0xff, 0x00, 0xff, 0x00, 0x00, 0xff }
+#define MASK_VRI_VV0UU { 0xff, 0x00, 0xff, 0x00, 0x00, 0xff }
+#define MASK_VRI_VVV0UV { 0xff, 0x00, 0x0f, 0x00, 0x00, 0xff }
#define MASK_VRX_VRRD { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
#define MASK_VRX_VV { 0xff, 0x00, 0xff, 0xff, 0xf0, 0xff }
#define MASK_VRX_VRRDU { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
@@ -721,10 +730,10 @@ unused_s390_operands_static_asserts (void)
#define MASK_VRS_VRRDU { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
#define MASK_VRS_VRRD { 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff }
#define MASK_VRS_RRDV { 0xff, 0xf0, 0x00, 0x00, 0x00, 0xff }
-#define MASK_VRR_0V { 0xff, 0xf0, 0xff, 0xff, 0xf0, 0xff }
#define MASK_VRR_VRR { 0xff, 0x00, 0x0f, 0xff, 0xf0, 0xff }
#define MASK_VRR_VVV0U { 0xff, 0x00, 0x0f, 0xff, 0x00, 0xff }
#define MASK_VRR_VVV0U0 { 0xff, 0x00, 0x0f, 0x0f, 0xf0, 0xff }
+#define MASK_VRR_VVV0U02 { 0xff, 0x00, 0x0f, 0xf0, 0xf0, 0xff }
#define MASK_VRR_VVV0U1 { 0xff, 0x00, 0x0f, 0x1f, 0xf0, 0xff }
#define MASK_VRR_VVV0U2 { 0xff, 0x00, 0x0f, 0x2f, 0xf0, 0xff }
#define MASK_VRR_VVV0U3 { 0xff, 0x00, 0x0f, 0x3f, 0xf0, 0xff }
@@ -750,6 +759,9 @@ unused_s390_operands_static_asserts (void)
#define MASK_VRR_VV0UUU { 0xff, 0x00, 0xff, 0x00, 0x00, 0xff }
#define MASK_VRR_VVVU0UV { 0xff, 0x00, 0x00, 0xf0, 0x00, 0xff }
#define MASK_VRR_VV0U0U { 0xff, 0x00, 0xff, 0x0f, 0x00, 0xff }
+#define MASK_VRR_0V { 0xff, 0xf0, 0xff, 0xff, 0xf0, 0xff }
+#define MASK_VRR_0V0U { 0xff, 0xf0, 0xf0, 0x00, 0x00, 0xff }
+#define MASK_VRR_0VVU { 0xff, 0xf0, 0x00, 0x00, 0x00, 0xff }
#define MASK_VRR_0VV0U { 0xff, 0xf0, 0x0f, 0x0f, 0xf0, 0xff }
#define MASK_VRR_RV0U { 0xff, 0x00, 0xff, 0x0f, 0xf0, 0xff }
#define MASK_VRR_RV0UU { 0xff, 0x00, 0xff, 0x00, 0xf0, 0xff }
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index 4610a8fddd7..bbc00b10355 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -2072,3 +2072,113 @@ b201 stbear S_RD "store bear" arch14 zarch
# Processor-Activity-Instrumentation Facility
b28f qpaci S_RD "query processor activity counter information" arch14 zarch
+
+
+# arch15 instructions
+
+e70000000089 vblend VRR_VVVU0V " " arch15 zarch
+e70000000089 vblendb VRR_VVV0V " " arch15 zarch
+e70001000089 vblendh VRR_VVV0V " " arch15 zarch
+e70002000089 vblendf VRR_VVV0V " " arch15 zarch
+e70003000089 vblendg VRR_VVV0V " " arch15 zarch
+e70004000089 vblendq VRR_VVV0V " " arch15 zarch
+
+e70000000088 veval VRI_VVV0UV " " arch15 zarch
+
+e70000000054 vgem VRR_VV0U " " arch15 zarch
+e70000000054 vgemb VRR_VV " " arch15 zarch
+e70000001054 vgemh VRR_VV " " arch15 zarch
+e70000002054 vgemf VRR_VV " " arch15 zarch
+e70000003054 vgemg VRR_VV " " arch15 zarch
+e70000004054 vgemq VRR_VV " " arch15 zarch
+
+e700000030d7 vuphg VRR_VV " " arch15 zarch
+e700000030d5 vuplhg VRR_VV " " arch15 zarch
+e700000030d6 vuplg VRR_VV " " arch15 zarch
+e700000030d4 vupllg VRR_VV " " arch15 zarch
+
+e700000040f2 vavgq VRR_VVV " " arch15 zarch
+e700000040f0 vavglq VRR_VVV " " arch15 zarch
+e700000040db vecq VRR_VV " " arch15 zarch
+e700000040d9 veclq VRR_VV " " arch15 zarch
+e700000040f8 vceqq VRR_VVV " " arch15 zarch
+e700001040f8 vceqqs VRR_VVV " " arch15 zarch
+e700000040fb vchq VRR_VVV " " arch15 zarch
+e700001040fb vchqs VRR_VVV " " arch15 zarch
+e700000040f9 vchlq VRR_VVV " " arch15 zarch
+e700001040f9 vchlqs VRR_VVV " " arch15 zarch
+e70000004053 vclzq VRR_VV " " arch15 zarch
+e70000004052 vctzq VRR_VV " " arch15 zarch
+e700000040de vlcq VRR_VV " " arch15 zarch
+e700000040df vlpq VRR_VV " " arch15 zarch
+e700000040ff vmxq VRR_VVV " " arch15 zarch
+e700000040fd vmxlq VRR_VVV " " arch15 zarch
+e700000040fe vmnq VRR_VVV " " arch15 zarch
+e700000040fc vmnlq VRR_VVV " " arch15 zarch
+e700030000aa vmalg VRR_VVV0V " " arch15 zarch
+e700040000aa vmalq VRR_VVV0V " " arch15 zarch
+e700030000ab vmahg VRR_VVV0V " " arch15 zarch
+e700040000ab vmahq VRR_VVV0V " " arch15 zarch
+e700030000a9 vmalhg VRR_VVV0V " " arch15 zarch
+e700040000a9 vmalhq VRR_VVV0V " " arch15 zarch
+e700030000ae vmaeg VRR_VVV0V " " arch15 zarch
+e700030000ac vmaleg VRR_VVV0V " " arch15 zarch
+e700030000af vmaog VRR_VVV0V " " arch15 zarch
+e700030000ad vmalog VRR_VVV0V " " arch15 zarch
+e700000030a3 vmhg VRR_VVV " " arch15 zarch
+e700000040a3 vmhq VRR_VVV " " arch15 zarch
+e700000030a1 vmlhg VRR_VVV " " arch15 zarch
+e700000040a1 vmlhq VRR_VVV " " arch15 zarch
+e700000030a2 vmlg VRR_VVV " " arch15 zarch
+e700000040a2 vmlq VRR_VVV " " arch15 zarch
+e700000030a6 vmeg VRR_VVV " " arch15 zarch
+e700000030a4 vmleg VRR_VVV " " arch15 zarch
+e700000030a7 vmog VRR_VVV " " arch15 zarch
+e700000030a5 vmlog VRR_VVV " " arch15 zarch
+
+e700000000b2 vd VRR_VVV0UU " " arch15 zarch
+e700000020b2 vdf VRR_VVV0U02 " " arch15 zarch
+e700000030b2 vdg VRR_VVV0U02 " " arch15 zarch
+e700000040b2 vdq VRR_VVV0U02 " " arch15 zarch
+
+e700000000b0 vdl VRR_VVV0UU " " arch15 zarch
+e700000020b0 vdlf VRR_VVV0U02 " " arch15 zarch
+e700000030b0 vdlg VRR_VVV0U02 " " arch15 zarch
+e700000040b0 vdlq VRR_VVV0U02 " " arch15 zarch
+
+e700000000b3 vr VRR_VVV0UU " " arch15 zarch
+e700000020b3 vrf VRR_VVV0U02 " " arch15 zarch
+e700000030b3 vrg VRR_VVV0U02 " " arch15 zarch
+e700000040b3 vrq VRR_VVV0U02 " " arch15 zarch
+
+e700000000b1 vrl VRR_VVV0UU " " arch15 zarch
+e700000020b1 vrlf VRR_VVV0U02 " " arch15 zarch
+e700000030b1 vrlg VRR_VVV0U02 " " arch15 zarch
+e700000040b1 vrlq VRR_VVV0U02 " " arch15 zarch
+
+b968 clzg RRE_RR " " arch15 zarch
+b969 ctzg RRE_RR " " arch15 zarch
+
+e30000000060 lxab RXY_RRRD " " arch15 zarch
+e30000000062 lxah RXY_RRRD " " arch15 zarch
+e30000000064 lxaf RXY_RRRD " " arch15 zarch
+e30000000066 lxag RXY_RRRD " " arch15 zarch
+e30000000068 lxaq RXY_RRRD " " arch15 zarch
+
+e30000000061 llxab RXY_RRRD " " arch15 zarch
+e30000000063 llxah RXY_RRRD " " arch15 zarch
+e30000000065 llxaf RXY_RRRD " " arch15 zarch
+e30000000067 llxag RXY_RRRD " " arch15 zarch
+e30000000069 llxaq RXY_RRRD " " arch15 zarch
+
+b96c bextg RRF_R0RR2 " " arch15 zarch
+b96d bdepg RRF_R0RR2 " " arch15 zarch
+
+b93e kimd RRF_U0RR " " arch15 zarch optparm
+b93f klmd RRF_U0RR " " arch15 zarch optparm
+
+e6000000004e vcvbq VRR_VV0U2 " " arch15 zarch
+e6000000004a vcvdq VRI_VV0UU " " arch15 zarch
+
+e6000000005f vtp VRR_0V0U " " arch15 zarch optparm
+e6000000007f vtz VRR_0VVU " " arch15 zarch
--
2.43.0

View File

@@ -1,33 +0,0 @@
From 1e4d5d4928d64022b8e17e20ffa8a7b2134842e1 Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:51 +0100
Subject: [PATCH 01/10] s390: Align opcodes to lower-case
opcodes/
* s390-opc.txt (rdp): Change opcode to lower-case.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit 1afe02759f1)
---
opcodes/s390-opc.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index 1182e196059..4610a8fddd7 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -2061,7 +2061,7 @@ e60000000055 vcnf VRR_VV0UU2 "vector fp convert to nnp" arch14 zarch
# Reset-DAT-Protection Facility
-b98B rdp RRF_RURR2 "reset dat protection" arch14 zarch optparm
+b98b rdp RRF_RURR2 "reset dat protection" arch14 zarch optparm
# BEAR-Enhancement Facility
base-commit: 31276843acc9aac2e5ce4a9181eecd33b0e0a6cc
--
2.43.0

View File

@@ -1,99 +0,0 @@
From 708495beae38a6b5c265a3865f38d2be79414a63 Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:53 +0100
Subject: [PATCH 08/10] s390: Fix disassembly of optional addressing operands
"nop D1(B1)" erroneously disassembled into "nop D1(B1" (missing
closing parenthesis). "nop D1(X1,0)" and "nop D1(X1,)" erroneously
disassembled into "nop D1(X1)" (missing zero base register) instead
of "nop D1(X1,0)".
Do not skip disassembly of optional operands if they are index (X)
or base (B) registers or length (L) in an addressing operand sequence
"D(X,B)", "D(B)", or "D(L,B). Index and base register operand values
of zero are being handled separately, as they may not be omitted
unconditionally. For instance a base register value of zero must be
printed in above mentioned case, to distinguish the index from the
base register. This also ensures proper formatting of addressing
operand sequences.
While at it add further test cases for instructions with optional
operands.
opcodes/
* s390-dis.c (s390_print_insn_with_opcode): Do not
unconditionally skip disassembly of optional operands with a
value of zero, if within an addressing operand sequence.
gas/testsuite/
* gas/s390/zarch-optargs.d: Add further test cases for
instructions with optional operands.
* gas/s390/zarch-optargs.s: Likewise.
Reported-by: Florian Krohm <flo2030@eich-krohm.de>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit 7507fe37980)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-optargs.d)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-optargs.s)
---
opcodes/s390-dis.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c
index 852d2f6ebb9..1a23afc8f40 100644
--- a/opcodes/s390-dis.c
+++ b/opcodes/s390-dis.c
@@ -214,20 +214,29 @@ s390_print_insn_with_opcode (bfd_vma memaddr,
continue;
}
- /* For instructions with a last optional operand don't print it
- if zero. */
- if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2))
- && val.u == 0
- && opindex[1] == 0)
- break;
-
- if ((opcode->flags & S390_INSTR_FLAG_OPTPARM2)
- && val.u == 0 && opindex[1] != 0 && opindex[2] == 0)
+ /* Omit optional last operands with a value of zero, except if
+ within an addressing operand sequence D(X,B), D(B), and D(L,B).
+ Index and base register operands with a value of zero are
+ handled separately, as they may not be omitted unconditionally. */
+ if (!(operand->flags & (S390_OPERAND_BASE
+ | S390_OPERAND_INDEX
+ | S390_OPERAND_LENGTH)))
{
- union operand_value next_op_val =
- s390_extract_operand (buffer, s390_operands + opindex[1]);
- if (next_op_val.u == 0)
+ if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2))
+ && val.u == 0
+ && opindex[1] == 0)
break;
+
+ if ((opcode->flags & S390_INSTR_FLAG_OPTPARM2)
+ && val.u == 0
+ && opindex[1] != 0 && opindex[2] == 0)
+ {
+ union operand_value next_op_val =
+ s390_extract_operand (buffer, s390_operands + opindex[1]);
+
+ if (next_op_val.u == 0)
+ break;
+ }
}
if (flags & S390_OPERAND_GPR)
@@ -312,6 +321,7 @@ s390_print_insn_with_opcode (bfd_vma memaddr,
&& val.u == 0
&& opindex[1] == 0)
break;
+
info->fprintf_styled_func (info->stream, dis_style_text,
"%c", separator);
style = ((flags & S390_OPERAND_DISP)
--
2.43.0

View File

@@ -1,112 +0,0 @@
From 4ace867f88db894184062814e6ae71e0b9dfffd8 Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:51 +0100
Subject: [PATCH 03/10] s390: Relax risbg[n]z, risb{h|l}gz, {rns|ros|rxs}bgt
operand constraints
This leverages commit ("s390: Simplify (dis)assembly of insn operands
with const bits") to relax the operand constraints of the immediate
operand that contains the constant Z- or T-bit of the following extended
mnemonics:
risbgz, risbgnz, risbhgz, risblgz, rnsbgt, rosbgt, rxsbgt
Previously those instructions were the only ones where the assembler
on s390 restricted the specification of the subject I3/I4 operand values
exactly according to their specification to an unsigned 6- or 5-bit
unsigned integer. For any other instructions the assembler allows to
specify any operand value allowed by the instruction format, regardless
of whether the instruction specification is more restrictive.
Allow to specify the subject I3/I4 operand as unsigned 8-bit integer
with the constant operand bits being ORed during assembly.
Relax the instructions subject significant operand bit masks to only
consider the Z/T-bit as significant, so that the instructions get
disassembled as their *z or *t flavor regardless of whether any reserved
bits are set in addition to the Z/T-bit.
Adapt the rnsbg, rosbg, and rxsbg test cases not to inadvertently set
the T-bit in operand I3, as they otherwise get disassembled as their
rnsbgt, rosbgt, and rxsbgt counterpart.
This aligns GNU Assembler to LLVM Assembler.
opcodes/
* s390-opc.c (U6_18, U5_27, U6_26): Remove.
(INSTR_RIE_RRUUU2, INSTR_RIE_RRUUU3, INSTR_RIE_RRUUU4): Define
as INSTR_RIE_RRUUU while retaining insn fmt mask.
(MASK_RIE_RRUUU2, MASK_RIE_RRUUU3, MASK_RIE_RRUUU4): Treat only
Z/T-bit of I3/I4 operand as significant.
gas/testsuite/
* gas/s390/zarch-z10.s (rnsbg, rosbg, rxsbg): Do not set T-bit.
Reported-by: Dominik Steenken <dost@de.ibm.com>
Suggested-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit b8b60e2d0cb)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-z10.d)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-z10.s)
---
opcodes/s390-opc.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 987004d7b07..fe0299aa4e5 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -216,15 +216,9 @@ const struct s390_operand s390_operands[] =
{ 4, 36, 0 },
#define U8_8 (U4_36 + 1) /* 8 bit unsigned value starting at 8 */
{ 8, 8, 0 },
-#define U6_18 (U8_8 + 1) /* 6 bit unsigned value starting at 18 */
- { 6, 18, 0 },
-#define U8_16 (U6_18 + 1) /* 8 bit unsigned value starting at 16 */
+#define U8_16 (U8_8 + 1) /* 8 bit unsigned value starting at 16 */
{ 8, 16, 0 },
-#define U5_27 (U8_16 + 1) /* 5 bit unsigned value starting at 27 */
- { 5, 27, 0 },
-#define U6_26 (U5_27 + 1) /* 6 bit unsigned value starting at 26 */
- { 6, 26, 0 },
-#define U8_24 (U6_26 + 1) /* 8 bit unsigned value starting at 24 */
+#define U8_24 (U8_16 + 1) /* 8 bit unsigned value starting at 24 */
{ 8, 24, 0 },
#define U8_28 (U8_24 + 1) /* 8 bit unsigned value starting at 28 */
{ 8, 28, 0 },
@@ -288,7 +282,7 @@ unused_s390_operands_static_asserts (void)
p - pc relative
r - general purpose register
re - gpr extended operand, a valid general purpose register pair
- u - unsigned integer, 4, 6, 8, 16 or 32 bit
+ u - unsigned integer, 4, 8, 16 or 32 bit
m - mode field, 4 bit
0 - operand skipped.
The order of the letters reflects the layout of the format in
@@ -324,9 +318,9 @@ unused_s390_operands_static_asserts (void)
#define INSTR_RIE_R0U0 6, { R_8,U16_16,0,0,0,0 } /* e.g. clfitne */
#define INSTR_RIE_RUI0 6, { R_8,I16_16,U4_12,0,0,0 } /* e.g. lochi */
#define INSTR_RIE_RRUUU 6, { R_8,R_12,U8_16,U8_24,U8_32,0 } /* e.g. rnsbg */
-#define INSTR_RIE_RRUUU2 6, { R_8,R_12,U8_16,U6_26,U8_32,0 } /* e.g. risbgz */
-#define INSTR_RIE_RRUUU3 6, { R_8,R_12,U8_16,U5_27,U8_32,0 } /* e.g. risbhg */
-#define INSTR_RIE_RRUUU4 6, { R_8,R_12,U6_18,U8_24,U8_32,0 } /* e.g. rnsbgt */
+#define INSTR_RIE_RRUUU2 INSTR_RIE_RRUUU /* e.g. risbgz */
+#define INSTR_RIE_RRUUU3 INSTR_RIE_RRUUU /* e.g. risbhg */
+#define INSTR_RIE_RRUUU4 INSTR_RIE_RRUUU /* e.g. rnsbgt */
#define INSTR_RIL_0P 6, { J32_16,0,0,0,0 } /* e.g. jg */
#define INSTR_RIL_RP 6, { R_8,J32_16,0,0,0,0 } /* e.g. brasl */
#define INSTR_RIL_UP 6, { U4_8,J32_16,0,0,0,0 } /* e.g. brcl */
@@ -551,9 +545,9 @@ unused_s390_operands_static_asserts (void)
#define MASK_RIE_R0U0 { 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff }
#define MASK_RIE_RUI0 { 0xff, 0x00, 0x00, 0x00, 0xff, 0xff }
#define MASK_RIE_RRUUU { 0xff, 0x00, 0x00, 0x00, 0x00, 0xff }
-#define MASK_RIE_RRUUU2 { 0xff, 0x00, 0x00, 0xc0, 0x00, 0xff }
-#define MASK_RIE_RRUUU3 { 0xff, 0x00, 0x00, 0xe0, 0x00, 0xff }
-#define MASK_RIE_RRUUU4 { 0xff, 0x00, 0xc0, 0x00, 0x00, 0xff }
+#define MASK_RIE_RRUUU2 { 0xff, 0x00, 0x00, 0x80, 0x00, 0xff }
+#define MASK_RIE_RRUUU3 { 0xff, 0x00, 0x00, 0x80, 0x00, 0xff }
+#define MASK_RIE_RRUUU4 { 0xff, 0x00, 0x80, 0x00, 0x00, 0xff }
#define MASK_RIL_0P { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RIL_RP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
#define MASK_RIL_UP { 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00 }
--
2.43.0

View File

@@ -1,163 +0,0 @@
From 0a5b57ac3e464b3e4a1eaf4aba5d6bd8c98b7186 Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:51 +0100
Subject: [PATCH 02/10] s390: Simplify (dis)assembly of insn operands with
const bits
Simplify assembly and disassembly of extended mnemonics with operands
with constant ORed bits:
Their instruction template already contains the respective constant
operand bits, as they are significant to distinguish the extended from
their base mnemonic. Operands are ORed into the instruction template.
Therefore it is not necessary to OR the constant bits into the operand
value during assembly in s390_insert_operand.
Additionally the constant operand bits from the instruction template
can be used to mask them from the operand value during disassembly in
s390_print_insn_with_opcode. For now do so for non-length unsigned
integer operands only.
The separate instruction formats need to be retained, as their masks
differ, which is relevant during disassembly to distinguish the base
and extended mnemonics from each other.
This affects the following extended mnemonics:
- vfaebs, vfaehs, vfaefs
- vfaezb, vfaezh, vfaezf
- vfaezbs, vfaezhs, vfaezfs
- vstrcbs, vstrchs, vstrcfs
- vstrczb, vstrczh, vstrczf
- vstrczbs, vstrczhs, vstrczfs
- wcefb, wcdgb
- wcelfb, wcdlgb
- wcfeb, wcgdb
- wclfeb, wclgdb
- wfisb, wfidb, wfixb
- wledb, wflrd, wflrx
include/
* opcode/s390.h (S390_OPERAND_OR1, S390_OPERAND_OR2,
S390_OPERAND_OR8): Remove.
opcodes/
* s390-opc.c (U4_OR1_24, U4_OR2_24, U4_OR8_28): Remove.
(INSTR_VRR_VVV0U1, INSTR_VRR_VVV0U2, INSTR_VRR_VVV0U3): Define
as INSTR_VRR_VVV0U0 while retaining respective insn fmt mask.
(INSTR_VRR_VV0UU8): Define as INSTR_VRR_VV0UU while retaining
respective insn fmt mask.
(INSTR_VRR_VVVU0VB1, INSTR_VRR_VVVU0VB2, INSTR_VRR_VVVU0VB3):
Define as INSTR_VRR_VVVU0VB while retaining respective insn fmt
mask.
* s390-dis.c (s390_print_insn_with_opcode): Mask constant
operand bits set in insn template of non-length unsigned
integer operands.
gas/
* config/tc-s390.c (s390_insert_operand): Do not OR constant
operand value bits.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit a3f1e7c56a6)
(cherry pick dropped: gas/config/tc-s390.c)
---
include/opcode/s390.h | 4 ----
opcodes/s390-dis.c | 14 ++++++++------
opcodes/s390-opc.c | 26 +++++++++-----------------
3 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/include/opcode/s390.h b/include/opcode/s390.h
index e5dfcb27570..8de03701172 100644
--- a/include/opcode/s390.h
+++ b/include/opcode/s390.h
@@ -193,8 +193,4 @@ extern const struct s390_operand s390_operands[];
#define S390_OPERAND_CP16 0x1000
-#define S390_OPERAND_OR1 0x2000
-#define S390_OPERAND_OR2 0x4000
-#define S390_OPERAND_OR8 0x8000
-
#endif /* S390_H */
diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c
index ee2f2cb62ed..852d2f6ebb9 100644
--- a/opcodes/s390-dis.c
+++ b/opcodes/s390-dis.c
@@ -299,12 +299,14 @@ s390_print_insn_with_opcode (bfd_vma memaddr,
{
enum disassembler_style style;
- if (flags & S390_OPERAND_OR1)
- val.u &= ~1;
- if (flags & S390_OPERAND_OR2)
- val.u &= ~2;
- if (flags & S390_OPERAND_OR8)
- val.u &= ~8;
+ if (!(flags & S390_OPERAND_LENGTH))
+ {
+ union operand_value insn_opval;
+
+ /* Mask any constant operand bits set in insn template. */
+ insn_opval = s390_extract_operand (opcode->opcode, operand);
+ val.u &= ~insn_opval.u;
+ }
if ((opcode->flags & S390_INSTR_FLAG_OPTPARM)
&& val.u == 0
diff --git a/opcodes/s390-opc.c b/opcodes/s390-opc.c
index 10482fbc1e0..987004d7b07 100644
--- a/opcodes/s390-opc.c
+++ b/opcodes/s390-opc.c
@@ -208,17 +208,9 @@ const struct s390_operand s390_operands[] =
{ 4, 20, 0 },
#define U4_24 (U4_20 + 1) /* 4 bit unsigned value starting at 24 */
{ 4, 24, 0 },
-#define U4_OR1_24 (U4_24 + 1) /* 4 bit unsigned value ORed with 1 */
- { 4, 24, S390_OPERAND_OR1 }, /* starting at 24 */
-#define U4_OR2_24 (U4_OR1_24+1) /* 4 bit unsigned value ORed with 2 */
- { 4, 24, S390_OPERAND_OR2 }, /* starting at 24 */
-#define U4_OR3_24 (U4_OR2_24+1) /* 4 bit unsigned value ORed with 3 */
- { 4, 24, S390_OPERAND_OR1 | S390_OPERAND_OR2 }, /* starting at 24 */
-#define U4_28 (U4_OR3_24+1) /* 4 bit unsigned value starting at 28 */
+#define U4_28 (U4_24+1) /* 4 bit unsigned value starting at 28 */
{ 4, 28, 0 },
-#define U4_OR8_28 (U4_28 + 1) /* 4 bit unsigned value ORed with 8 */
- { 4, 28, S390_OPERAND_OR8 }, /* starting at 28 */
-#define U4_32 (U4_OR8_28+1) /* 4 bit unsigned value starting at 32 */
+#define U4_32 (U4_28+1) /* 4 bit unsigned value starting at 32 */
{ 4, 32, 0 },
#define U4_36 (U4_32 + 1) /* 4 bit unsigned value starting at 36 */
{ 4, 36, 0 },
@@ -512,23 +504,23 @@ unused_s390_operands_static_asserts (void)
#define INSTR_VRR_VRR 6, { V_8,R_12,R_16,0,0,0 } /* e.g. vlvgp */
#define INSTR_VRR_VVV0U 6, { V_8,V_12,V_16,U4_32,0,0 } /* e.g. vmrh */
#define INSTR_VRR_VVV0U0 6, { V_8,V_12,V_16,U4_24,0,0 } /* e.g. vfaeb */
-#define INSTR_VRR_VVV0U1 6, { V_8,V_12,V_16,U4_OR1_24,0,0 } /* e.g. vfaebs*/
-#define INSTR_VRR_VVV0U2 6, { V_8,V_12,V_16,U4_OR2_24,0,0 } /* e.g. vfaezb*/
-#define INSTR_VRR_VVV0U3 6, { V_8,V_12,V_16,U4_OR3_24,0,0 } /* e.g. vfaezbs*/
+#define INSTR_VRR_VVV0U1 INSTR_VRR_VVV0U0 /* e.g. vfaebs*/
+#define INSTR_VRR_VVV0U2 INSTR_VRR_VVV0U0 /* e.g. vfaezb*/
+#define INSTR_VRR_VVV0U3 INSTR_VRR_VVV0U0 /* e.g. vfaezbs*/
#define INSTR_VRR_VVV 6, { V_8,V_12,V_16,0,0,0 } /* e.g. vmrhb */
#define INSTR_VRR_VVV2 6, { V_8,V_CP16_12,0,0,0,0 } /* e.g. vnot */
#define INSTR_VRR_VV0U 6, { V_8,V_12,U4_32,0,0,0 } /* e.g. vseg */
#define INSTR_VRR_VV0U2 6, { V_8,V_12,U4_24,0,0,0 } /* e.g. vistrb*/
#define INSTR_VRR_VV0UU 6, { V_8,V_12,U4_28,U4_24,0,0 } /* e.g. vcdgb */
#define INSTR_VRR_VV0UU2 6, { V_8,V_12,U4_32,U4_28,0,0 } /* e.g. wfc */
-#define INSTR_VRR_VV0UU8 6, { V_8,V_12,U4_OR8_28,U4_24,0,0 } /* e.g. wcdgb */
+#define INSTR_VRR_VV0UU8 INSTR_VRR_VV0UU /* e.g. wcdgb */
#define INSTR_VRR_VV 6, { V_8,V_12,0,0,0,0 } /* e.g. vsegb */
#define INSTR_VRR_VVVUU0V 6, { V_8,V_12,V_16,V_32,U4_20,U4_24 } /* e.g. vstrc */
#define INSTR_VRR_VVVU0V 6, { V_8,V_12,V_16,V_32,U4_20,0 } /* e.g. vac */
#define INSTR_VRR_VVVU0VB 6, { V_8,V_12,V_16,V_32,U4_24,0 } /* e.g. vstrcb*/
-#define INSTR_VRR_VVVU0VB1 6, { V_8,V_12,V_16,V_32,U4_OR1_24,0 } /* e.g. vstrcbs*/
-#define INSTR_VRR_VVVU0VB2 6, { V_8,V_12,V_16,V_32,U4_OR2_24,0 } /* e.g. vstrczb*/
-#define INSTR_VRR_VVVU0VB3 6, { V_8,V_12,V_16,V_32,U4_OR3_24,0 } /* e.g. vstrczbs*/
+#define INSTR_VRR_VVVU0VB1 INSTR_VRR_VVVU0VB /* e.g. vstrcbs*/
+#define INSTR_VRR_VVVU0VB2 INSTR_VRR_VVVU0VB /* e.g. vstrczb*/
+#define INSTR_VRR_VVVU0VB3 INSTR_VRR_VVVU0VB /* e.g. vstrczbs*/
#define INSTR_VRR_VVV0V 6, { V_8,V_12,V_16,V_32,0,0 } /* e.g. vacq */
#define INSTR_VRR_VVV0U0U 6, { V_8,V_12,V_16,U4_32,U4_24,0 } /* e.g. vfae */
#define INSTR_VRR_VVVV 6, { V_8,V_12,V_16,V_32,0,0 } /* e.g. vfmadb*/
--
2.43.0

View File

@@ -1,138 +0,0 @@
From 921996dc9f1d1322fcad32822125546a7c6a6e93 Mon Sep 17 00:00:00 2001
From: Jens Remus <jremus@linux.ibm.com>
Date: Fri, 7 Mar 2025 13:06:53 +0100
Subject: [PATCH 09/10] s390: Treat addressing operand sequence as one in
disassembler
Reuse logic introduced with the preceding commit in the assembler to
treat addressing operand sequences D(X,B), D(B), and D(L,B) as one
with regards to optional last operands (i.e. optparm and optparm2).
With this "nop" now disassembles into "nop" instead of "nop 0".
opcodes/
* s390-dis.c (operand_count): New helper to count the remaining
operands, treating D(X,B), D(B), and D(L,B) as one.
(skip_optargs_p): New helper to test whether remaining operands
are optional.
(skip_optargs_zero_p): New helper to test whether remaining
operands are optional and their values are zero.
(s390_print_insn_with_opcode): Use skip_optargs_zero_p to skip
optional last operands with a value of zero.
gas/testsuite/
* gas/s390/zarch-optargs.d (nop): Adjust test case accordingly.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit 36bbf8646c8)
(cherry pick dropped: gas/testsuite/gas/s390/zarch-optargs.d)
---
opcodes/s390-dis.c | 84 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 66 insertions(+), 18 deletions(-)
diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c
index 1a23afc8f40..8e7b9838f81 100644
--- a/opcodes/s390-dis.c
+++ b/opcodes/s390-dis.c
@@ -180,6 +180,69 @@ s390_extract_operand (const bfd_byte *insn,
return ret;
}
+/* Return remaining operand count. */
+
+static unsigned int
+operand_count (const unsigned char *opindex_ptr)
+{
+ unsigned int count = 0;
+
+ for (; *opindex_ptr != 0; opindex_ptr++)
+ {
+ /* Count D(X,B), D(B), and D(L,B) as one operand. Assuming correct
+ instruction operand definitions simply do not count D, X, and L. */
+ if (!(s390_operands[*opindex_ptr].flags & (S390_OPERAND_DISP
+ | S390_OPERAND_INDEX
+ | S390_OPERAND_LENGTH)))
+ count++;
+ }
+
+ return count;
+}
+
+/* Return true if all remaining instruction operands are optional. */
+
+static bool
+skip_optargs_p (unsigned int opcode_flags, const unsigned char *opindex_ptr)
+{
+ if ((opcode_flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2)))
+ {
+ unsigned int opcount = operand_count (opindex_ptr);
+
+ if (opcount == 1)
+ return true;
+
+ if ((opcode_flags & S390_INSTR_FLAG_OPTPARM2) && opcount == 2)
+ return true;
+ }
+
+ return false;
+}
+
+/* Return true if all remaining instruction operands are optional
+ and their values are zero. */
+
+static bool
+skip_optargs_zero_p (const bfd_byte *buffer, unsigned int opcode_flags,
+ const unsigned char *opindex_ptr)
+{
+ /* Test if remaining operands are optional. */
+ if (!skip_optargs_p (opcode_flags, opindex_ptr))
+ return false;
+
+ /* Test if remaining operand values are zero. */
+ for (; *opindex_ptr != 0; opindex_ptr++)
+ {
+ const struct s390_operand *operand = &s390_operands[*opindex_ptr];
+ union operand_value value = s390_extract_operand (buffer, operand);
+
+ if (value.u != 0)
+ return false;
+ }
+
+ return true;
+}
+
/* Print the S390 instruction in BUFFER, assuming that it matches the
given OPCODE. */
@@ -220,24 +283,9 @@ s390_print_insn_with_opcode (bfd_vma memaddr,
handled separately, as they may not be omitted unconditionally. */
if (!(operand->flags & (S390_OPERAND_BASE
| S390_OPERAND_INDEX
- | S390_OPERAND_LENGTH)))
- {
- if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2))
- && val.u == 0
- && opindex[1] == 0)
- break;
-
- if ((opcode->flags & S390_INSTR_FLAG_OPTPARM2)
- && val.u == 0
- && opindex[1] != 0 && opindex[2] == 0)
- {
- union operand_value next_op_val =
- s390_extract_operand (buffer, s390_operands + opindex[1]);
-
- if (next_op_val.u == 0)
- break;
- }
- }
+ | S390_OPERAND_LENGTH))
+ && skip_optargs_zero_p (buffer, opcode->flags, opindex))
+ break;
if (flags & S390_OPERAND_GPR)
{
--
2.43.0

View File

@@ -1,64 +0,0 @@
From 44651f4eae0a9ecf4a734e996bf75c9cd67e5f63 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Tue, 10 Dec 2024 20:30:05 +0100
Subject: [PATCH 20/46] Use setVariable in gdb.dap/scopes.exp
The test-case gdb.dap/scopes.exp contains the following outdated comment:
...
# setVariable isn't implemented yet, so use the register name.
...
Now that setVariable is implemented, use it to set variable scalar, and remove
the bit that sets the first register. That part is known to fail on s390x,
because the first register isn't writeable [1].
Tested on x86_64-linux.
Suggested-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
[1] https://sourceware.org/pipermail/gdb-patches/2024-December/213823.html
---
gdb/testsuite/gdb.dap/scopes.exp | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/gdb/testsuite/gdb.dap/scopes.exp b/gdb/testsuite/gdb.dap/scopes.exp
index aa3bb688c0e..c78ae6e1202 100644
--- a/gdb/testsuite/gdb.dap/scopes.exp
+++ b/gdb/testsuite/gdb.dap/scopes.exp
@@ -133,23 +133,14 @@ set val [dap_check_request_and_response "fetch first register" \
"variables" \
[format {o variablesReference [i %d] count [i 1]} $num]]
-# Try setting the value to something else.
-set val [dict get [lindex $val 0] body variables]
-set name [dict get [lindex $val 0] name]
-set val [dict get [lindex $val 0] value]
-# Just make sure it is different from the original value.
-set val [expr {$val ^ 7}]
-
-# setVariable isn't implemented yet, so use the register name. Note
-# that we sneak the "$" into the name, written in a slightly funny way
-# to work around apparent TON limitations.
-set response [dap_check_request_and_response "set first register" \
- setExpression \
- [format {o expression [s \$%s] value [s %d] frameId [i %d]} \
- $name $val $frame_id]]
-set response [lindex $response 0]
-
-gdb_assert {[dict get $response body value] == $val} \
- "setting register yields updated value"
+set num [dict get $scope variablesReference]
+set refs [lindex [dap_check_request_and_response "set variable scalar" \
+ "setVariable" \
+ [format {o variablesReference [i %d] name [s scalar] \
+ value [s 32]} \
+ $num]] \
+ 0]
+gdb_assert { [dict get $refs body value] == 32 } \
+ "setting variable yields updated value"
dap_shutdown
--
2.43.0