public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] testsuite: small tweaks to MI testing
@ 2023-04-11 11:19 Andrew Burgess
  2023-04-11 11:19 ` [PATCH 1/2] gdb/testsuite: avoid {"} pattern in lib/mi-support.exp Andrew Burgess
  2023-04-11 11:19 ` [PATCH 2/2] gdb/testsuite: accept script argument for mi_make_breakpoint_pending Andrew Burgess
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Burgess @ 2023-04-11 11:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Two patches related to MI testing.  No changes to GDB functionality,
though this does extend the testing to cover something which I believe
was previous untested.

---

Andrew Burgess (2):
  gdb/testsuite: avoid {"} pattern in lib/mi-support.exp
  gdb/testsuite: accept script argument for mi_make_breakpoint_pending

 gdb/testsuite/gdb.mi/mi-dprintf-pending.exp |  6 ++++--
 gdb/testsuite/gdb.mi/mi-pending.exp         | 15 +++++++++++++++
 gdb/testsuite/lib/mi-support.exp            |  7 +++----
 3 files changed, 22 insertions(+), 6 deletions(-)


base-commit: f7c3b037c0b424bc0a30e75c76fe78fb74ad01b1
-- 
2.25.4


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

* [PATCH 1/2] gdb/testsuite: avoid {"} pattern in lib/mi-support.exp
  2023-04-11 11:19 [PATCH 0/2] testsuite: small tweaks to MI testing Andrew Burgess
@ 2023-04-11 11:19 ` Andrew Burgess
  2023-04-13 13:42   ` Tom Tromey
  2023-04-11 11:19 ` [PATCH 2/2] gdb/testsuite: accept script argument for mi_make_breakpoint_pending Andrew Burgess
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Burgess @ 2023-04-11 11:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Commit:

  commit c569a946f6925d3f210c3eaf74dcda56843350ef
  Date:   Fri Mar 24 10:45:37 2023 +0100

      [gdb/testsuite] Fix unbalanced quotes in mi_expect_stop argument

Introduced the use of {"} in mi-support.exp.  There is absolutely
nothing wrong with this in any way.  However, this is causing my
editor to get the syntax highlighting of this file wrong after this
point.

Maybe the real answer is to use a better editor, or fix my current
editor.... but I'm hoping I can instead take the lazy approach of just
changing {"} to "\"", which is handled fine, and means exactly the
same as far as I understand it.

There should be no change in what is tested after this commit.
---
 gdb/testsuite/lib/mi-support.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 1841816ffeb..52c188df49d 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1271,7 +1271,7 @@ proc mi_expect_stop { reason func args file line extra test } {
 
     set r ""
     if { $reason != "" } {
-	if { [regexp {"} $reason] } {
+	if { [regexp "\"" $reason] } {
 	   set r "reason=$reason,"
 	} else {
 	   set r "reason=\"$reason\","
-- 
2.25.4


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

* [PATCH 2/2] gdb/testsuite: accept script argument for mi_make_breakpoint_pending
  2023-04-11 11:19 [PATCH 0/2] testsuite: small tweaks to MI testing Andrew Burgess
  2023-04-11 11:19 ` [PATCH 1/2] gdb/testsuite: avoid {"} pattern in lib/mi-support.exp Andrew Burgess
@ 2023-04-11 11:19 ` Andrew Burgess
  2023-04-13 13:48   ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Burgess @ 2023-04-11 11:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

This commit changes mi_make_breakpoint_pending to accept the 'script'
and 'times' arguments.

I've then added a new test that makes use of 'scripts' in
gdb.mi/mi-pending.exp and gdb.mi/mi-dprintf-pending.exp.

There is already a test in gdb.mi/mi-pending.exp that uses the 'times'
argument -- previously this argument was being ignored, but is now
used.
---
 gdb/testsuite/gdb.mi/mi-dprintf-pending.exp |  6 ++++--
 gdb/testsuite/gdb.mi/mi-pending.exp         | 15 +++++++++++++++
 gdb/testsuite/lib/mi-support.exp            |  5 ++---
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
index 358d929f1bb..28f52938aeb 100644
--- a/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-dprintf-pending.exp
@@ -48,9 +48,11 @@ mi_load_shlibs $lib_sl1
 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 
 # Set pending dprintf via MI.
+set bp [mi_make_breakpoint_pending -number "1" -type "dprintf" \
+	    -disp "keep" -enabled "y" -pending "pendfunc1" \
+	    -original-location "pendfunc1"]
 mi_gdb_test "-dprintf-insert -f pendfunc1 \"hello\"" \
-    ".*\\^done,bkpt={number=\"1\",type=\"dprintf\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"}" \
-    "mi set dprintf"
+    ".*\\^done,$bp" "mi set dprintf"
 
 mi_create_breakpoint $bp_location1 "mi insert breakpoint bp_location1" \
     -type "breakpoint" -line $bp_location1 -file ".*$srcfile"
diff --git a/gdb/testsuite/gdb.mi/mi-pending.exp b/gdb/testsuite/gdb.mi/mi-pending.exp
index 71c3d45fe44..79f0db8e35e 100644
--- a/gdb/testsuite/gdb.mi/mi-pending.exp
+++ b/gdb/testsuite/gdb.mi/mi-pending.exp
@@ -61,6 +61,21 @@ mi_create_breakpoint_pending "-f pendfunc1" \
     -pending "pendfunc1" \
     -original-location "pendfunc1"
 
+# Add some commands to the pending breakpoint, use -break-info to
+# check that the commands show up, then clear the commands again.
+mi_gdb_test "-break-commands 1 \"print 1\" \"print 2\" \"print 3\""\
+    "\\^done" \
+    "set breakpoint commands on pending breakpoint"
+set bp [mi_make_breakpoint_pending -number 1 -disp keep -func pendfunc1 \
+	    -disp keep -enabled y -original-location pendfunc1 \
+	    -script {\["print 1","print 2","print 3"\]}]
+mi_gdb_test "-break-info 1" \
+    "\\^done,[mi_make_breakpoint_table [list $bp]]" \
+    "breakpoint commands: check that commands are set"
+mi_gdb_test "-break-commands 1"\
+    "\\^done" \
+    "clear breakpoint commands on pending breakpoint"
+
 # Set pending breakpoint with a condition via MI.
 mi_create_breakpoint_pending "-f -c x==4 ${libfile1}.c:pendfunc2" \
     "MI pending breakpoint on ${libfile1}.c:pendfunc2 if x==4" \
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 52c188df49d..0d830d8e4ae 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -2685,7 +2685,8 @@ proc mi_make_breakpoint_multi {args} {
 
 proc mi_make_breakpoint_pending {args} {
     parse_args {{number .*} {type .*} {disp .*} {enabled .*}
-	{pending .*} {original-location .*} {thread ""} {cond ""}}
+	{pending .*} {original-location .*} {thread ""} {cond ""}
+	{script ""} {times .*}}
 
     set attr_list {}
     foreach attr [list number type disp enabled] {
@@ -2699,8 +2700,6 @@ proc mi_make_breakpoint_pending {args} {
     }
 
     set ignore 0
-    set times 0
-    set script ""
     set evaluated-by ""
 
     set result [mi_make_breakpoint_1 \
-- 
2.25.4


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

* Re: [PATCH 1/2] gdb/testsuite: avoid {"} pattern in lib/mi-support.exp
  2023-04-11 11:19 ` [PATCH 1/2] gdb/testsuite: avoid {"} pattern in lib/mi-support.exp Andrew Burgess
@ 2023-04-13 13:42   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-04-13 13:42 UTC (permalink / raw)
  To: Andrew Burgess via Gdb-patches; +Cc: Andrew Burgess

>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:

Andrew> Maybe the real answer is to use a better editor, or fix my current
Andrew> editor.... but I'm hoping I can instead take the lazy approach of just
Andrew> changing {"} to "\"", which is handled fine, and means exactly the
Andrew> same as far as I understand it.

Andrew> There should be no change in what is tested after this commit.

This seems totally fine to me.
I've also made changes just to make Emacs happy.

Reviewed-By: Tom Tromey <tom@tromey.com>

Tom

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

* Re: [PATCH 2/2] gdb/testsuite: accept script argument for mi_make_breakpoint_pending
  2023-04-11 11:19 ` [PATCH 2/2] gdb/testsuite: accept script argument for mi_make_breakpoint_pending Andrew Burgess
@ 2023-04-13 13:48   ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-04-13 13:48 UTC (permalink / raw)
  To: Andrew Burgess via Gdb-patches; +Cc: Andrew Burgess

>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:

Andrew> This commit changes mi_make_breakpoint_pending to accept the 'script'
Andrew> and 'times' arguments.

Andrew> I've then added a new test that makes use of 'scripts' in
Andrew> gdb.mi/mi-pending.exp and gdb.mi/mi-dprintf-pending.exp.

Andrew> There is already a test in gdb.mi/mi-pending.exp that uses the 'times'
Andrew> argument -- previously this argument was being ignored, but is now
Andrew> used.

Looks good to me, thank you.
Reviewed-By: Tom Tromey <tom@tromey.com>

Tom

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

end of thread, other threads:[~2023-04-13 13:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 11:19 [PATCH 0/2] testsuite: small tweaks to MI testing Andrew Burgess
2023-04-11 11:19 ` [PATCH 1/2] gdb/testsuite: avoid {"} pattern in lib/mi-support.exp Andrew Burgess
2023-04-13 13:42   ` Tom Tromey
2023-04-11 11:19 ` [PATCH 2/2] gdb/testsuite: accept script argument for mi_make_breakpoint_pending Andrew Burgess
2023-04-13 13:48   ` Tom Tromey

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