public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <palves@redhat.com>,
	"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 19:17:25 +0200	[thread overview]
Message-ID: <eef8d619-8a5f-046f-012a-88bf36accf6b@suse.de> (raw)
In-Reply-To: <0bd64ab2-e736-2dbc-5fc2-99b32a44d670@redhat.com>

On 15-05-2020 17:46, Pedro Alves wrote:
> On 5/15/20 3:16 PM, Tom de Vries wrote:
> 
>> With attached patch, we have:
>> ...
>> Running src/gdb/testsuite/gdb.ada/info_auto_lang.exp ...
>> WARNING: info_auto_lang.exp defined global array type_in_c
>> WARNING: info_auto_lang.exp defined global array rbreak_func_in_ada
>> WARNING: info_auto_lang.exp defined global array var_in_c
>> WARNING: info_auto_lang.exp defined global array func_in_c
>> WARNING: info_auto_lang.exp defined global array func_in_ada
>> WARNING: info_auto_lang.exp defined global array type_in_ada
>> WARNING: info_auto_lang.exp defined global array var_in_ada
>> WARNING: info_auto_lang.exp defined global array rbreak_func_in_c
>> ...
> 
> Seems like a good thing to have to me.
> 

Great.  Probably it's a good idea to fix the known occurrences before
enabling this by default.

>>  
>> +# Returns 1 if __VAR is a global array.
>> +
>> +proc global_array_exists { __var } {
> 
> ...
> 
>> +proc global_unset { __var } {
> 
> Curious -- is there a reason for the underscores?
> 

Yeah, I'm trying to avoid this:
...
$ cat test.tcl
#!/usr/bin/tclsh

proc foo { var } {
    global $var
}

foo var
$ ./test.tcl
variable "var" already exists
    while executing
"global $var"
    (procedure "foo" line 2)
    invoked from within
"foo var"
    (file "./test.tcl" line 7)
...

Thanks,
- Tom

>> +proc check_global_vars { } {
>> +    global gdb_global_vars
>> +    set vars [info globals]
>> +    set skip [list "expect_out" "spawn_out"]
>> +    foreach var $vars {
>> +        set found [lsearch -exact $gdb_global_vars $var]
>> +        if { $found != -1 } {
>> +            # Already present
> 
> Missing period.
> 
>> +            continue
>> +        }
>> +        set found [lsearch -exact $skip $var]
>> +        if { $found != -1 } {
>> +            continue
>> +        }
>> +        if { ![global_array_exists $var] } {
>> +	    continue
>> +        }
>> +
>> +	global gdb_test_file_name
>> +        warning "$gdb_test_file_name.exp defined global array $var"
> 
> Tabs vs spaces.
> 
> Thanks,
> Pedro Alves
> 

  reply	other threads:[~2020-05-15 17:17 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
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 [this message]
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=eef8d619-8a5f-046f-012a-88bf36accf6b@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).