public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix for the gdb.base/sigstep.exp test.
@ 2021-11-08 18:26 Carl Love
  2021-11-10 23:17 ` Tom de Vries
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Love @ 2021-11-08 18:26 UTC (permalink / raw)
  To: gdb-patches, cel, Will Schmidt, Rogerio Alves




GDB maintainers:

The gdb.base/sigstep.exp has 6 fails on the PowerPC platforms.  Th
following patch fixes the minor differences of how the test runs on
PowerPC versus X86.  The differences have to do with the number of
assembly instructions generated for the two systems and where gdb stops
at the beginning of a function.  On PowerPC, gdb stops in the prolog
rather than at the first line of code.  

The fix adds an addtional stepi in one case and an additional step in
the other case to get to the expected location in the code.

The patch only consists of changes to the test.  No GDB internal
changes are made.

The patch was also tested on X86 with no regression failures. 

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

                 Carl Love

---------------------------------------------------------------------

This patch fixes the test for a few differences in how the test runs on
PPC.  The firs fix adds a gdb_test_multiple to check for PPC.  The assembly
sequence on PPC reqires two stepi commands to get into the handler where as
it only takes one stepi on x86.

The second change in proc advance is due to gdb stopping int the prolog of
the function on PPC.  Specificially it stops at the opening brace for the
function not with the first line of code.  The patch adds an extra step for
PPC to get gdb to the expected location.
---
 gdb/testsuite/gdb.base/sigstep.exp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index ea254af5297..dca9d39d1b6 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -93,7 +93,17 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
 	    gdb_test "handle SIGVTALRM print pass stop"
 	    gdb_test "continue" "Program received signal.*" "continue to signal"
 	}
-	gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler"
+
+	set test_cmd ".*handler .*"
+	gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" {
+	    -re "handler .*sig=.*" {
+		pass "$test_cmd"
+	    }
+	    -re ".*signal handler called.*" {
+	    #ppc is at branch instruction, need one more stepi to get to handler
+	    gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler ppc"
+	    }
+	}
 
 	delete_breakpoints
 
@@ -113,6 +123,11 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } {
 		setup_kfail gdb/8841 "nios2*-*-linux*"
 		fail "$test (could not insert single-step breakpoint)"
 	    }
+	    -re ".*\{.*${gdb_prompt} $" {
+		#ppc stops at the opening brace, step to get to the first done=1
+		send_gdb "step\n"
+		exp_continue -continue_timer
+	    }
 	    -re "done = 1;.*${gdb_prompt} $" {
 		send_gdb "$exit_cmd\n"
 		exp_continue -continue_timer
-- 
2.30.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-12 17:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 18:26 [PATCH] Fix for the gdb.base/sigstep.exp test Carl Love
2021-11-10 23:17 ` Tom de Vries
2021-11-12  0:28   ` Carl Love
2021-11-12  8:08     ` Tom de Vries
2021-11-12 16:52       ` Carl Love
2021-11-12 17:15         ` Tom de Vries

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).