public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove 'eval' from gdb_breakpoint
@ 2023-02-22 22:22 Tom Tromey
  2023-02-22 23:54 ` Kevin Buettner
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2023-02-22 22:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Now that Tcl has the {*} operator, we can remove the use of eval from
gdb_breakpoint.  Tested on x86-64 Fedora 36.
---
 gdb/testsuite/lib/gdb.exp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6864dac3ac9..66a5d31d9ad 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -704,12 +704,7 @@ proc runto { linespec args } {
 
     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 $linespec may have multiple
-    # elements, and we don't want Tcl to move the remaining elements after
-    # the first to $args.  That is why $linespec is wrapped in {}.
-    if ![eval gdb_breakpoint {$linespec} $args] {
+    if {![gdb_breakpoint $linespec {*}$args]} {
 	return 0
     }
 
-- 
2.39.1


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

* Re: [PATCH] Remove 'eval' from gdb_breakpoint
  2023-02-22 22:22 [PATCH] Remove 'eval' from gdb_breakpoint Tom Tromey
@ 2023-02-22 23:54 ` Kevin Buettner
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Buettner @ 2023-02-22 23:54 UTC (permalink / raw)
  To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey

On Wed, 22 Feb 2023 15:22:42 -0700
Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> wrote:

> Now that Tcl has the {*} operator, we can remove the use of eval from
> gdb_breakpoint.  Tested on x86-64 Fedora 36.

I didn't know about Tcl's {*} operator, but found an explanation here:

https://stackoverflow.com/questions/5124185/what-does-do-in-tcl

Anyway, LGTM.

Kevin


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

end of thread, other threads:[~2023-02-22 23:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 22:22 [PATCH] Remove 'eval' from gdb_breakpoint Tom Tromey
2023-02-22 23:54 ` Kevin Buettner

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