Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <pedro@palves.net>,
	"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 13:53:06 +0200	[thread overview]
Message-ID: <d0a19577-3167-3747-8d07-5d9100f84baf@suse.de> (raw)
In-Reply-To: <4ade3da1-a8cd-ba29-80da-f5e742f7b52a@palves.net>

On 14-05-2020 20:58, Pedro Alves wrote:
> On 5/14/20 7:54 PM, Aktemur, Tankut Baris wrote:
>> On Thursday, May 14, 2020 8:00 PM, Tom de Vries wrote:
>>> On 13-05-2020 22:53, Pedro Alves via Gdb-patches wrote:
>>>> +	set testpid($num) [get_integer_valueof "pid" -1]
>>>
>>> I'm running into:
>>> ...
>>> ERROR: tcl error sourcing
>>> /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-kill.exp.
>>> ERROR: can't set "testpid(1)": variable isn't array
>>>     while executing
>>> "set testpid($num) [get_integer_valueof "pid" -1]"
>>
>> I'm not able to reproduce this problem.  The test runs fine on my system
>> with 58 expected passes and no failures.  Could it be related to the tcl
>> version?
> 
> It's related to testcase run order, and the fact that global variables
> can leak between testcases.
> 
>>
>> As a rough guess, could you try the patch below to initialize the array
>> variable?
>>
>> diff --git a/gdb/testsuite/gdb.multi/multi-kill.exp b/gdb/testsuite/gdb.multi/multi-kill.exp
>> index ce6075045fc..a21f8a78b0d 100644
>> --- a/gdb/testsuite/gdb.multi/multi-kill.exp
>> +++ b/gdb/testsuite/gdb.multi/multi-kill.exp
>> @@ -70,6 +70,7 @@ proc start_inferior {num} {
>>  # Sufficient inferiors to make sure that at least some other inferior
>>  # is killed while we're handling a killed event.
>>  set NUM_INFS 10
>> +array set testpid {}
> 
> That's not sufficient, because the variable can leak to other tests.
> For example:
> 
>  $ runtest gdb.threads/check-libthread-db.exp gdb.multi/multi-kill.exp
> 
>  Running /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.multi/multi-kill.exp ...
>  Running /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.threads/check-libthread-db.exp ...
>  ERROR: tcl error sourcing /home/pedro/gdb/binutils-gdb/src/gdb/testsuite/gdb.threads/check-libthread-db.exp.
>  ERROR: can't set "testpid": variable is array
>      while executing
>  "set testpid [spawn_id_get_pid $test_spawn_id]"
>      ("uplevel" body line 8)

It occurred to me that we can find leaked global arrays using a
runtest.exp patch. I've filed a testsuite cleanup PR ( PR25996 - "wrap
global arrays in namespace",
https://sourceware.org/bugzilla/show_bug.cgi?id=25996 ).

Thanks,
- Tom


  parent reply	other threads:[~2020-05-15 11:53 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
2020-05-15 11:53         ` Tom de Vries [this message]
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=d0a19577-3167-3747-8d07-5d9100f84baf@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --cc=tankut.baris.aktemur@intel.com \
    /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