Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: make gdb_breakpoint and runto take a linespec
@ 2022-02-08 21:31 Simon Marchi via Gdb-patches
  2022-04-07 14:18 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi via Gdb-patches @ 2022-02-08 21:31 UTC (permalink / raw)
  To: gdb-patches

From: Simon Marchi <simon.marchi@polymtl.ca>

Change gdb_breakpoint to accept a linespec, not just a function.  In
fact, no behavior changes are necessary, this only changes the parameter
name and documentation.  Change runto as well, since the two are so
close (runto forwards all its arguments to gdb_breakpoint).

I wrote this for a downstrean GDB port,  but thought it could be
useful upstream, eventually, even though not callers take advantage of
it yet.

Change-Id: I08175fd444d5a60df90fd9985e1b5dfd87c027cc
---
 gdb/testsuite/lib/gdb.exp | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a3717a40229..76401d01a91 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -510,9 +510,11 @@ proc gdb_starti_cmd { {inferior_args {}} } {
     return -1
 }
 
-# Set a breakpoint at FUNCTION.  If there is an additional argument it is
-# a list of options; the supported options are allow-pending, temporary,
-# message, no-message and qualified.
+# Set a breakpoint using LINESPEC.
+#
+# If there is an additional argument it is a list of options; the supported
+# options are allow-pending, temporary, message, no-message and qualified.
+#
 # The result is 1 for success, 0 for failure.
 #
 # Note: The handling of message vs no-message is messed up, but it's based
@@ -521,7 +523,7 @@ proc gdb_starti_cmd { {inferior_args {}} } {
 # no-message: turns off printing of fails (and passes, but they're already off)
 # message: turns on printing of passes (and fails, but they're already on)
 
-proc gdb_breakpoint { function args } {
+proc gdb_breakpoint { linespec args } {
     global gdb_prompt
     global decimal
 
@@ -552,9 +554,9 @@ proc gdb_breakpoint { function args } {
 	set print_pass 1
     }
 
-    set test_name "setting breakpoint at $function"
+    set test_name "gdb_breakpoint: set breakpoint at $linespec"
 
-    send_gdb "$break_command $function\n"
+    send_gdb "$break_command $linespec\n"
     # The first two regexps are what we get with -g, the third is without -g.
     gdb_expect 30 {
 	-re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
@@ -622,7 +624,7 @@ proc gdb_breakpoint { function args } {
 # no-message: turns off printing of fails (and passes, but they're already off)
 # message: turns on printing of passes (and fails, but they're already on)
 
-proc runto { function args } {
+proc runto { linespec args } {
     global gdb_prompt
     global decimal
 
@@ -639,14 +641,14 @@ proc runto { function args } {
 	set print_pass 1
     }
 
-    set test_name "running to $function in runto"
+    set test_name "runto: run to $linespec"
 
     # We need to use eval here to pass our varargs args to gdb_breakpoint
     # which is also a varargs function.
-    # But we also have to be careful because $function may have multiple
+    # But we also have to be careful because $linespec may have multiple
     # elements, and we don't want Tcl to move the remaining elements after
-    # the first to $args.  That is why $function is wrapped in {}.
-    if ![eval gdb_breakpoint {$function} $args] {
+    # the first to $args.  That is why $linespec is wrapped in {}.
+    if ![eval gdb_breakpoint {$linespec} $args] {
 	return 0
     }
 
-- 
2.35.0


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

* Re: [PATCH] gdb/testsuite: make gdb_breakpoint and runto take a linespec
  2022-02-08 21:31 [PATCH] gdb/testsuite: make gdb_breakpoint and runto take a linespec Simon Marchi via Gdb-patches
@ 2022-04-07 14:18 ` Tom Tromey
  2022-04-07 17:04   ` Simon Marchi via Gdb-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2022-04-07 14:18 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> From: Simon Marchi <simon.marchi@polymtl.ca>
Simon> Change gdb_breakpoint to accept a linespec, not just a function.  In
Simon> fact, no behavior changes are necessary, this only changes the parameter
Simon> name and documentation.  Change runto as well, since the two are so
Simon> close (runto forwards all its arguments to gdb_breakpoint).

Simon> I wrote this for a downstrean GDB port,  but thought it could be
Simon> useful upstream, eventually, even though not callers take advantage of
Simon> it yet.

I didn't see a response to this, but FWIW it seems like a good idea to me.

Tom

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

* Re: [PATCH] gdb/testsuite: make gdb_breakpoint and runto take a linespec
  2022-04-07 14:18 ` Tom Tromey
@ 2022-04-07 17:04   ` Simon Marchi via Gdb-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi via Gdb-patches @ 2022-04-07 17:04 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches; +Cc: Simon Marchi



On 2022-04-07 10:18, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> From: Simon Marchi <simon.marchi@polymtl.ca>
> Simon> Change gdb_breakpoint to accept a linespec, not just a function.  In
> Simon> fact, no behavior changes are necessary, this only changes the parameter
> Simon> name and documentation.  Change runto as well, since the two are so
> Simon> close (runto forwards all its arguments to gdb_breakpoint).
> 
> Simon> I wrote this for a downstrean GDB port,  but thought it could be
> Simon> useful upstream, eventually, even though not callers take advantage of
> Simon> it yet.
> 
> I didn't see a response to this, but FWIW it seems like a good idea to me.
> 
> Tom

I had forgotten about this, thanks.  Will push.

Simon

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

end of thread, other threads:[~2022-04-07 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 21:31 [PATCH] gdb/testsuite: make gdb_breakpoint and runto take a linespec Simon Marchi via Gdb-patches
2022-04-07 14:18 ` Tom Tromey
2022-04-07 17:04   ` Simon Marchi via Gdb-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox