public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simark@simark.ca>, Pedro Alves <palves@redhat.com>,
	Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [committed][gdb/testsuite] Make gdb.base/dbx.exp more robust
Date: Thu, 11 Jun 2020 16:52:20 +0200	[thread overview]
Message-ID: <bfceabf7-e963-6083-9e37-047cd82ed851@suse.de> (raw)
In-Reply-To: <33977d5b-3735-eaef-36fa-584f9111b5de@simark.ca>

On 11-06-2020 16:39, Simon Marchi wrote:
> On 2020-06-11 8:11 a.m., Tom de Vries wrote:
>> [ was: Re: [PATCH 3/3][gdb/testsuite] Warn about leaked global array ]
>>
>> On 04-06-2020 13:40, Tom de Vries wrote:
>>>> BTW, global variables alone aren't the full scope of the
>>>> bleeding between testcases.  There's also the case of
>>>> testcases overriding procedures, like gdb.base/dbx.exp,
>>>> but those are perhaps rare enough that we can continue
>>>> handling it "manually" as before.
>>> AFAICT, that test-case does an effort to undo the override, though I'm
>>> not sure how certain it is that the undo will be executed.
>>
>> I've committed patch below to make sure the undo is executed (and
>> similar for GDBFLAGS).
>>
>> Thanks,
>> - Tom
>>
> 
> Ah!  That reminded me that I had a patch I had forgotten about that did something
> similar:
> 
>   https://sourceware.org/pipermail/gdb-patches/2020-May/169109.html
> 

Sorry, didn't notice that one.

> I'm fine with your version.

Right, I see the solutions are really the same.

>  One nit: you have an unnecessary return at the end of
> the with_override proc.

Um, if I add this code to a random test-case:
...
diff --git a/gdb/testsuite/gdb.ada/O2_float_param.exp
b/gdb/testsuite/gdb.ada/O2_float_param.exp
index 09ebeec405..31c36c9cde 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param.exp
+++ b/gdb/testsuite/gdb.ada/O2_float_param.exp
@@ -29,3 +29,17 @@ runto "increment"

 gdb_test "frame" \
          "#0\\s+callee\\.increment \\(val(=val@entry)?=99\\.0,
msg=\\.\\.\\.\\).*"
+
+proc foo { } {
+    return 1
+}
+
+proc foo_2 {} {
+    return 2
+}
+
+set res [foo]
+puts "RES: $res"
+
+set res [with_override foo foo_2 foo]
+puts "RES: $res"
...

And run it, I get:
...
RES: 1
RES: 2
...
but if I remove the return at the end of with_override, I get instead:
...
Running
/data/gdb_versions/devel/src/gdb/testsuite/gdb.ada/O2_float_param.exp ...
RES: 1
RES:
...

So, I'm not sure why you say that it's not necessary.

Thanks,
- Tom

  reply	other threads:[~2020-06-11 14:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 16:30 [PATCH 3/3][gdb/testsuite] Warn about leaked global array Tom de Vries
2020-05-22 20:15 ` Tom Tromey
2020-06-02 13:08   ` Tom de Vries
2020-06-02 15:38 ` Andrew Burgess
2020-06-02 15:52   ` Andrew Burgess
2020-06-02 16:31     ` Tom de Vries
2020-06-02 17:01       ` Andrew Burgess
2020-06-02 20:18         ` Andrew Burgess
2020-06-03  8:47           ` Tom de Vries
2020-06-03  9:38             ` Tom de Vries
2020-06-03 10:09               ` Tom de Vries
2020-06-03 10:24                 ` Tom de Vries
2020-06-03 12:54                   ` Andrew Burgess
2020-06-03 15:35                     ` Tom de Vries
2020-06-04 11:16                       ` Pedro Alves
2020-06-04 12:29                         ` Tom de Vries
2020-06-12 13:11                           ` [committed] gdb/testsuite: Prevent globals leaking between test scripts Tom de Vries
2020-06-03  9:49   ` [PATCH 3/3][gdb/testsuite] Warn about leaked global array Pedro Alves
2020-06-04 11:40     ` Tom de Vries
2020-06-05 10:06       ` [PATCH][gdb/testsuite] Don't leak tuiterm.exp spawn override Tom de Vries
2020-06-11 13:55         ` Tom Tromey
2020-06-12 11:36           ` [committed][gdb/testsuite] " Tom de Vries
2020-06-15 19:46             ` Tom Tromey
2020-06-17 14:55               ` Tom de Vries
2020-06-17 15:28                 ` Andreas Schwab
2020-06-11 12:11       ` [committed][gdb/testsuite] Make gdb.base/dbx.exp more robust Tom de Vries
2020-06-11 12:16         ` Pedro Alves
2020-06-11 14:39         ` Simon Marchi
2020-06-11 14:52           ` Tom de Vries [this message]
2020-06-11 14:59             ` Simon Marchi

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=bfceabf7-e963-6083-9e37-047cd82ed851@suse.de \
    --to=tdevries@suse.de \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simark@simark.ca \
    /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).