public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom de Vries <tdevries@suse.de>,
	"Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop
Date: Fri, 15 May 2020 11:35:04 +0100	[thread overview]
Message-ID: <7e3fc6cd-4296-2e83-f8e3-82fbd3cccdab@redhat.com> (raw)
In-Reply-To: <d87186f5-5f6c-068c-2790-2783bc5cf028@suse.de>

On 5/15/20 11:17 AM, Tom de Vries wrote:
> On 14-05-2020 20:58, Pedro Alves wrote:
> Actually, we still need to declare the variable as a namespace variable
> using:
> ...
> variable testpid
> array set testpid {}
> ...
> otherwise we run into:
> ...
> ERROR: tcl error sourcing
> /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-kill.exp.
> ERROR: can't array set "testpid": variable isn't array
>     while executing
> "array set testpid {}"
>     (in namespace eval "::multi-kill" script line 36)
>     invoked from within
> "namespace eval $testfile {
> ...

Whoops, sorry, and thanks.  I had already merged the patch, so
I went ahead and applied that fix, as below.

From 3c5c3649729ba3f94f9d28f10aa2270c8c7e4aa9 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 15 May 2020 11:22:47 +0100
Subject: [PATCH] Fix gdb.multi/multi-kill.exp

The previous patch misssed declaring the 'testpid' array as namespace
variable.  While it at, might as well go back to having start_inferior
refer to the "global" testpid, using "variable" too.

gdb/testsuite/ChangeLog:
2020-05-15  Pedro Alves  <palves@redhat.com>

	* gdb.multi/multi-kill.exp (start_inferior): Remove
	'testpid' parameter.  Refer to namespace variable directly.
	(testpid): Declare as namespace variable.
---
 gdb/testsuite/ChangeLog                |  6 ++++++
 gdb/testsuite/gdb.multi/multi-kill.exp | 11 ++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 93ad65b32a2..b35d10e01bd 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-15  Pedro Alves  <palves@redhat.com>
+
+	* gdb.multi/multi-kill.exp (start_inferior): Remove
+	'testpid' parameter.  Refer to namespace variable directly.
+	(testpid): Declare as namespace variable.
+
 2020-05-15  Pedro Alves  <palves@redhat.com>
 
 	* gdb.multi/multi-kill.exp: Wrap in namespace.
diff --git a/gdb/testsuite/gdb.multi/multi-kill.exp b/gdb/testsuite/gdb.multi/multi-kill.exp
index 03bf8449cf8..b4853a1ea40 100644
--- a/gdb/testsuite/gdb.multi/multi-kill.exp
+++ b/gdb/testsuite/gdb.multi/multi-kill.exp
@@ -44,9 +44,9 @@ namespace eval $testfile {
 
 # Start inferior NUM and record its PID in the TESTPID array.
 
-proc start_inferior {num testpid} {
+proc start_inferior {num} {
     with_test_prefix "start_inferior $num" {
-	upvar $testpid tpid
+	variable testpid
 	global binfile srcfile
 
 	if {$num != 1} {
@@ -62,8 +62,8 @@ proc start_inferior {num testpid} {
 	gdb_run_cmd
 	gdb_test "" ".*reakpoint .*, initialized .*${srcfile}.*" "run"
 
-	set tpid($num) [get_integer_valueof "pid" -1]
-	if {$tpid($num) == -1} {
+	set testpid($num) [get_integer_valueof "pid" -1]
+	if {$testpid($num) == -1} {
 	    return -1
 	}
 
@@ -76,10 +76,11 @@ proc start_inferior {num testpid} {
 set NUM_INFS 10
 
 # The array holding each inferior's PID, indexed by inferior number.
+variable testpid
 array set testpid {}
 
 for {set i 1} {$i <= $NUM_INFS} {incr i} {
-    if {[start_inferior $i testpid] < 0} {
+    if {[start_inferior $i] < 0} {
 	return -1
     }
 }

base-commit: 272c36b87f81fd64e5f4669730da72c39d0716b3
-- 
2.14.5




  reply	other threads:[~2020-05-15 10:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 20:53 [PATCH v8 0/6] Handle already-exited threads in 'stop_all_threads' Pedro Alves
2020-05-13 20:53 ` [PATCH v8 1/6] gdb: protect some 'regcache_read_pc' calls Pedro Alves
2020-05-13 20:53 ` [PATCH v8 2/6] gdb/infrun: move a 'regcache_read_pc' call down to first use Pedro Alves
2020-05-13 20:53 ` [PATCH v8 3/6] gdb/infrun: extract out a code piece into 'mark_non_executing_threads' function Pedro Alves
2020-05-13 20:53 ` [PATCH v8 4/6] gdb: introduce 'all_non_exited_process_targets' and 'switch_to_target_no_thread' Pedro Alves
2020-05-14  8:44   ` Aktemur, Tankut Baris
2020-05-14 11:12     ` Pedro Alves
2020-05-14 11:23       ` Aktemur, Tankut Baris
2020-05-13 20:53 ` [PATCH v8 5/6] gdb/infrun: enable/disable thread events of all targets in stop_all_threads Pedro Alves
2020-05-14  8:44   ` Aktemur, Tankut Baris
2020-05-14 11:16     ` Pedro Alves
2020-05-14 11:30       ` Aktemur, Tankut Baris
2020-05-13 20:53 ` [PATCH v8 6/6] gdb/infrun: handle already-exited threads when attempting to stop Pedro Alves
2020-05-14  8:47   ` Aktemur, Tankut Baris
2020-05-14 11:16     ` Pedro Alves
2020-05-14 11:40       ` Aktemur, Tankut Baris
2020-05-14 18:00   ` Tom de Vries
2020-05-14 18:54     ` Aktemur, Tankut Baris
2020-05-14 18:58       ` Pedro Alves
2020-05-15  7:53         ` Aktemur, Tankut Baris
2020-05-15 10:14           ` Pedro Alves
2020-05-15 10:17         ` Tom de Vries
2020-05-15 10:35           ` Pedro Alves [this message]
2020-05-15 11:53         ` Tom de Vries
2020-05-15 12:02           ` Pedro Alves
2020-05-15 14:16             ` Tom de Vries
2020-05-15 15:46               ` Pedro Alves
2020-05-15 17:17                 ` Tom de Vries
2020-05-18  6:18                   ` [PATCH][gdb/testsuite] Warn about leaked global array Tom de Vries
2020-05-18 10:41                     ` Pedro Alves
2020-05-19 16:34                       ` Tom de Vries

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=7e3fc6cd-4296-2e83-f8e3-82fbd3cccdab@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tankut.baris.aktemur@intel.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).