public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: add "breakpoint always-inserted" axis in gdb.base/continue-after-aborted-step-over.exp
@ 2020-11-09 21:13 Simon Marchi
  2020-11-11 15:14 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2020-11-09 21:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

The test gdb.base/continue-after-aborted-step-over.exp fails on ROCm GDB
[1] when using the unix board (when debugging a standard x86-64/Linux
program), with:

    (gdb) b *0^M
    Breakpoint 2 at 0x0^M
    Warning:^M
    Cannot insert breakpoint 2.^M
    Cannot access memory at address 0x0^M
    ^M
    (gdb) FAIL: gdb.base/continue-after-aborted-step-over.exp: displaced-stepping=off: b *0

This happens because that build of GDB defaults to "set breakpoint
always-inserted on", for reasons that are unrelevant to explain here.
As soon as the breakpoint is created, GDB tries to insert it and
(expectedly) fails.  This causes more text to be output than what the
pattern expects.

It is actually be relevant to run the test with both "set breakpoint
always-inserted" on and off.  With it on, it mimics what happens when
running in non-stop mode, with other threads running.  This is relevant
for upstream even outside of the ROCm port, so here's a patch for it.

Add this other axis and adjust the "b *0" test to handle the extra
output when it is on.

[1] https://github.com/ROCm-Developer-Tools/ROCgdb

gdb/testsuite/ChangeLog:

	* gdb.base/continue-after-aborted-step-over.exp: Add "breakpoint
	always-inserted" axis.
	(do_test): Add breakpoint_always_inserted parameter.

Change-Id: I95126cae563a0b9a72f4a99627809fc34340cd5e
---
 .../gdb.base/continue-after-aborted-step-over.exp   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp
index 6a54ce1ff9f0..558f5fb9d101 100644
--- a/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp
+++ b/gdb/testsuite/gdb.base/continue-after-aborted-step-over.exp
@@ -41,13 +41,14 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
 }
 
 # DISPLACED indicates whether to use displaced-stepping.
-proc do_test {displaced} {
+proc do_test {displaced breakpoint_always_inserted} {
     global gdb_prompt decimal
     global srcfile binfile
 
     clean_restart $binfile
 
     gdb_test_no_output "set displaced-stepping $displaced"
+    gdb_test_no_output "set breakpoint always-inserted $breakpoint_always_inserted"
 
     if ![runto_main] {
 	fail "run to main"
@@ -64,7 +65,11 @@ proc do_test {displaced} {
     }
 
     # Set a breakpoint that fails to insert.
-    gdb_test "b *0" "Breakpoint $decimal at 0x0"
+    if { $breakpoint_always_inserted == "on" } {
+	gdb_test "b *0" "Breakpoint $decimal at 0x0.*"
+    } else {
+	gdb_test "b *0" "Breakpoint $decimal at 0x0"
+    }
 
     gdb_test "continue" \
 	"Command aborted\\." \
@@ -83,5 +88,7 @@ proc do_test {displaced} {
 # machinery.  So make sure this runs with displaced stepping disabled,
 # and for good measure, also try with displaced stepping enabled.
 foreach_with_prefix displaced-stepping {"off" "on"} {
-    do_test ${displaced-stepping}
+    foreach_with_prefix breakpoint-always-inserted {"off" "on"} {
+	do_test ${displaced-stepping} ${breakpoint-always-inserted}
+    }
 }
-- 
2.26.2


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

* Re: [PATCH] gdb/testsuite: add "breakpoint always-inserted" axis in gdb.base/continue-after-aborted-step-over.exp
  2020-11-09 21:13 [PATCH] gdb/testsuite: add "breakpoint always-inserted" axis in gdb.base/continue-after-aborted-step-over.exp Simon Marchi
@ 2020-11-11 15:14 ` Pedro Alves
  2020-11-11 20:09   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2020-11-11 15:14 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 11/9/20 9:13 PM, Simon Marchi via Gdb-patches wrote:

> gdb/testsuite/ChangeLog:
> 
> 	* gdb.base/continue-after-aborted-step-over.exp: Add "breakpoint
> 	always-inserted" axis.
> 	(do_test): Add breakpoint_always_inserted parameter.

OK.

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

* Re: [PATCH] gdb/testsuite: add "breakpoint always-inserted" axis in gdb.base/continue-after-aborted-step-over.exp
  2020-11-11 15:14 ` Pedro Alves
@ 2020-11-11 20:09   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2020-11-11 20:09 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2020-11-11 10:14 a.m., Pedro Alves wrote:
> On 11/9/20 9:13 PM, Simon Marchi via Gdb-patches wrote:
> 
>> gdb/testsuite/ChangeLog:
>>
>> 	* gdb.base/continue-after-aborted-step-over.exp: Add "breakpoint
>> 	always-inserted" axis.
>> 	(do_test): Add breakpoint_always_inserted parameter.
> 
> OK.
> 

Thanks, I pushed it.

Simon

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

end of thread, other threads:[~2020-11-11 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 21:13 [PATCH] gdb/testsuite: add "breakpoint always-inserted" axis in gdb.base/continue-after-aborted-step-over.exp Simon Marchi
2020-11-11 15:14 ` Pedro Alves
2020-11-11 20:09   ` Simon Marchi

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