Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix set $var val in gdb.dwarf2/dw2-is-stmt.exp
Date: Fri, 24 Sep 2021 12:40:51 +0200	[thread overview]
Message-ID: <20210924104049.GA1519@delia> (raw)

Hi,

When doing a testrun with:
...
$ make check RUNTESTFLAGS=$(cd $src/gdb/testsuite/; echo gdb.dwarf2/*.exp)
...
I ran into:
...
ERROR: tcl error sourcing gdb.dwarf2/dw2-is-stmt.exp.
ERROR: expected integer but got "dw2-abs-hi-pc-world.c"
    while executing
"incr i"
...

The variable i is set in gdb.dwarf2/dw2-abs-hi-pc.exp, and leaks to
gdb.dwarf2/dw2-is-stmt.exp.  It's not removed by gdb_cleanup_globals because i
is set as global variable by runtest.exp, which does:
...
for { set i 0 } { $i < $argc } { incr i } {
...
at toplevel but forgets to unset the variable.

Fix this by removing '$' in front of the variable name when doing set:
...
-set $i 0
+set i 0
...

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix set $var val in gdb.dwarf2/dw2-is-stmt.exp

---
 gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
index 90f7647cbee..bb0afe1c282 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-is-stmt.exp
@@ -188,7 +188,7 @@ runto_main
 # be a single instruction between line_label_1 and line_label_2, but
 # we allow for up to 25 (just a random number).
 
-set $i 0
+set i 0
 set pc [get_hexadecimal_valueof "\$pc" "NO-PC" \
 	   "get pc before stepi loop at line_label_1"]
 while { $pc < $ll2 } {
@@ -218,7 +218,7 @@ while { $pc < $ll2 } {
 # Now single instruction step forward until GDB reports a new source
 # line, at which point we should be at line_label_5.
 
-set $i 0
+set i 0
 set pc [get_hexadecimal_valueof "\$pc" "NO-PC" \
 	   "get pc before stepi loop at line_label_2"]
 while { $pc < $ll5 } {

                 reply	other threads:[~2021-09-24 10:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210924104049.GA1519@delia \
    --to=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox