public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Carl Love <cel@us.ibm.com>
To: gdb-patches@sourceware.org
Cc: will schmidt <will_schmidt@vnet.ibm.com>,
	Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	Rogerio Alves <rogealve@br.ibm.com>,
	cel@us.ibm.com
Subject: [PATCH] PowerPC: bp-permanent.exp, kill-after-signal fix
Date: Thu, 28 Apr 2022 18:06:58 -0700	[thread overview]
Message-ID: <e3e2f2288f5492f39a65c104cccfb5aa8e494957.camel@us.ibm.com> (raw)

GDB maintainers:

The gdb.base/bp-permanent.exp and the gdb.base/kill-after-signal tests
fail on Power 10  The tests pass without the patch on Power 9 and
Intel.  As stated in the commit log below, the tests have been run on
Power 10 Linux version 5.14.0-70.9.1.el9_0.ppc64le and on a Power 9
5.4.0-96-generic kernels.  I have examined the code for the
__kernel_start_sigtramp_rt64 function on both systems and the file is
identical.  As far as I can tell, the failure is hardware specific.

The following patch fixes the issue on Power 10 without introducing any
regression failures on Power 9 or Intel.

Please let me know if the patch is acceptable for mainline gdb. 
Thanks.

                    Carl Love

----------------------------------------------------------------------
PowerPC: bp-permanent.exp, kill-after-signal fix

The break point after the stepi on Intel is the entry point of the user
signal handler function test_signal_handler.  The code at the break point
looks like:

     0x<hex address> <test_signal_handler>: endbr64

On Power 10, the address where gdb stops after the stepi is in the kernel.
The code at the breakpoint looks like:

  0x<hex address>  <__kernel_start_sigtramp_rt64>:	bctrl

Power 10 requires one more stepi to reach the user signal handler.

The tests run fine on Power 9.  The tests have been run on multiple Power 10
systems.  The tests were done with newer and older Linux kernels and gcc
compiler versions from the Power 9 system.  The tests fail identically on
the two Power 10 systems but pass on the Power 9 system.

The two tests were run on the following PowerPC configurations:

Power 9, Ubuntu 20.04 LE, linux 5.4.0-96-generic,
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

  gdb.base/bp-permanent.exp 186 passes, no failures
  gdb.base/kill-after-signal.exp 4 passes, no failures

Power 10, RHEL 9, Linux 5.14.0-70.9.1.el9_0.ppc64le,
gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
  gdb.base/bp-permanent.exp 182 passes, 4 failures
  gdb.base/kill-after-signal.exp 3 passes, 1 failure

Power 10, SLE 15 SP3 , Linux 5.3.18-150300.59.63-default,
gcc (SUSE Linux) 7.5.0
  gdb.base/bp-permanent.exp 182 passes, 4 failures
  gdb.base/kill-after-signal.exp 3 passes, 1 failure

The following patch fixes the tests on Power 10. The patch does not
introduce regessions on Power 9 or Intel systems.
---
 gdb/testsuite/gdb.base/bp-permanent.exp      |  8 ++++++++
 gdb/testsuite/gdb.base/kill-after-signal.exp | 15 ++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/bp-permanent.exp b/gdb/testsuite/gdb.base/bp-permanent.exp
index 8be46e96238..f3f47e675ff 100644
--- a/gdb/testsuite/gdb.base/bp-permanent.exp
+++ b/gdb/testsuite/gdb.base/bp-permanent.exp
@@ -258,8 +258,16 @@ proc test {always_inserted sw_watchpoint} {
 		set test "single-step to handler"
 		gdb_test_multiple "stepi" $test {
 		    -re "Program received signal SIGTRAP.*$gdb_prompt $" {
+			# Intel needs one stepi to get to the signal handler.
 			fail $test
 		    }
+		    -re ".*signal handler called.*" {
+			# PowerPC needs one more stepi to reach the user
+			# signal handler.
+			gdb_test "p \$pc" ".*__kernel_start_sigtramp_rt64.*" \
+			    "In kernel"
+			gdb_test "stepi" "$decimal.*\{" $test
+		    }
 		    -re "handler .*$gdb_prompt $" {
 			pass $test
 		    }
diff --git a/gdb/testsuite/gdb.base/kill-after-signal.exp b/gdb/testsuite/gdb.base/kill-after-signal.exp
index 09f5cbc39a6..fc1f82bc70a 100644
--- a/gdb/testsuite/gdb.base/kill-after-signal.exp
+++ b/gdb/testsuite/gdb.base/kill-after-signal.exp
@@ -36,7 +36,20 @@ if ![runto_main] {
 }
 
 gdb_test "continue" "Program received signal SIGUSR1, .*"
-gdb_test "stepi" "\r\nhandler .*"
+
+set test "handler"
+gdb_test_multiple "stepi" $test {
+    -re "\r\nhandler .*" {
+	# Intel requires one stepi to get to the signal handler.
+	pass $test
+    }
+    -re ".*signal handler called.*" {
+	# PowerPC needs one more stepi to reach the user signal handler.
+	gdb_test "p \$pc" ".*__kernel_start_sigtramp_rt64.*" "In kernel"
+	gdb_test "stepi" "$decimal.*\{" $test
+    }
+}
+
 gdb_test_multiple "kill" "kill" {
     -re "Kill the program being debugged\\? \\(y or n\\) $" {
        gdb_test "y" "\\\[Inferior $decimal \\(.*\\) killed\\\]" "kill"
-- 
2.31.1



             reply	other threads:[~2022-04-29  1:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29  1:06 Carl Love [this message]
2022-05-02 14:09 ` Ulrich Weigand
2022-05-02 14:32 ` Pedro Alves
2022-05-02 14:55   ` will schmidt
2022-05-02 15:19     ` Carl Love
2022-05-02 15:24       ` Pedro Alves
2022-05-03 20:10   ` Carl Love
2022-05-06 16:16     ` Pedro Alves
2022-05-09 17:35     ` Tom de Vries
2022-05-09 19:22       ` Carl Love
2022-05-09 20:43       ` [PATCH Fixup] " Carl Love
2022-05-10  9:27         ` Tom de Vries
2022-05-10 15:13           ` Carl Love
2022-05-10 19:07             ` [PATCH Fixup V2] " Carl Love
2022-05-16 15:46               ` [PATCH PING " Carl Love
2022-05-18  7:33                 ` Tom de Vries
2022-05-02 15:04 ` [PATCH] " will schmidt
2022-05-02 15:10   ` Ulrich Weigand
2022-05-02 17:18     ` will schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3e2f2288f5492f39a65c104cccfb5aa8e494957.camel@us.ibm.com \
    --to=cel@us.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=rogealve@br.ibm.com \
    --cc=will_schmidt@vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).