Message ID | 1428666671-12926-1-git-send-email-qiyaoltc@gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 81438 invoked by alias); 10 Apr 2015 11:51:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 81419 invoked by uid 89); 10 Apr 2015 11:51:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f50.google.com Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 10 Apr 2015 11:51:22 +0000 Received: by paboj16 with SMTP id oj16so19562290pab.0 for <gdb-patches@sourceware.org>; Fri, 10 Apr 2015 04:51:20 -0700 (PDT) X-Received: by 10.66.227.169 with SMTP id sb9mr2027404pac.11.1428666676592; Fri, 10 Apr 2015 04:51:16 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id cs17sm2070028pac.12.2015.04.10.04.51.15 for <gdb-patches@sourceware.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 04:51:16 -0700 (PDT) From: Yao Qi <qiyaoltc@gmail.com> To: gdb-patches@sourceware.org Subject: [RFC] Unset tcl variable addr to avoid clashing Date: Fri, 10 Apr 2015 12:51:11 +0100 Message-Id: <1428666671-12926-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes |
Commit Message
Yao Qi
April 10, 2015, 11:51 a.m. UTC
From: Yao Qi <yao.qi@linaro.org>
Hi,
I see some tcl ERRORs in gdb.sum recently:
ERROR: tcl error sourcing ../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp.
ERROR: can't set "addr": variable is array
while executing
"set addr "0x\[0-9a-zA-Z\]+""
(file "../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp" line 45)
invoked from within
"source ../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp"
("uplevel" body line 1)
invoked from within
"uplevel #0 source ../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp"
invoked from within
"catch "uplevel #0 source $test_file_name""
It is OK to run single dmsym.exp. This error is caused by the name
clashing with coredump-filter.exp, and it can be reproduced,
$ make check RUNTESTFLAGS='coredump-filter.exp dmsym.exp exception.exp stepi-random-signal.exp'
as variable addr is used in all of them. This patch is to unset array
addr, but manually unset variables isn't good to me. Is there any
approaches we can do to avoid name clashing?
gdb/testsuite:
2015-04-10 Yao Qi <yao.qi@linaro.org>
* gdb.base/coredump-filter.exp: Unset addr.
---
gdb/testsuite/gdb.base/coredump-filter.exp | 2 ++
1 file changed, 2 insertions(+)
Comments
On Fri, Apr 10, 2015 at 4:51 AM, Yao Qi <qiyaoltc@gmail.com> wrote: > From: Yao Qi <yao.qi@linaro.org> > > Hi, > I see some tcl ERRORs in gdb.sum recently: > > ERROR: tcl error sourcing ../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp. > ERROR: can't set "addr": variable is array > while executing > "set addr "0x\[0-9a-zA-Z\]+"" > (file "../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp" line 45) > invoked from within > "source ../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp" > ("uplevel" body line 1) > invoked from within > "uplevel #0 source ../../../../../binutils-gdb/gdb/testsuite/gdb.base/dmsym.exp" > invoked from within > "catch "uplevel #0 source $test_file_name"" > > It is OK to run single dmsym.exp. This error is caused by the name > clashing with coredump-filter.exp, and it can be reproduced, > > $ make check RUNTESTFLAGS='coredump-filter.exp dmsym.exp exception.exp stepi-random-signal.exp' > > as variable addr is used in all of them. This patch is to unset array > addr, but manually unset variables isn't good to me. Is there any > approaches we can do to avoid name clashing? Bleah. :-) The first thing that comes to mind is of course a convention that array globals must be prefixed with the name of the test. OTOH gdb_base_coredump_filter_addr is painful. > > gdb/testsuite: > > 2015-04-10 Yao Qi <yao.qi@linaro.org> > > * gdb.base/coredump-filter.exp: Unset addr. > --- > gdb/testsuite/gdb.base/coredump-filter.exp | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp > index f3203be..2deb7b3 100644 > --- a/gdb/testsuite/gdb.base/coredump-filter.exp > +++ b/gdb/testsuite/gdb.base/coredump-filter.exp > @@ -196,3 +196,5 @@ foreach item $all_anon_corefiles { > with_test_prefix "loading and testing corefile for non-Private-Shared-Anon-File" { > test_disasm $non_private_shared_anon_file_core $main_addr 1 > } > + > +unset addr I'd prefer a comment explaining why that is there appear in the code rather than having to go find it in commit logs or emails.
On 04/10/2015 09:53 AM, Doug Evans wrote: > Bleah. :-) > The first thing that comes to mind is of course a convention that > array globals must be prefixed with the name of the test. > OTOH gdb_base_coredump_filter_addr is painful. I've had to do this in several places, too, with my big locations patchset. In the end, I felt the path-of-least-resistance was to encapsulate the whole test in its own namespace and then declare variables: namespace eval $testfile { variable addr variable linespec variable location # do all test stuff } namespace delete $testfile This is rather inconvenient, so I played for a short while with trying to automate this in some way. The only solution that I could devise that didn't involve modifying dejagnu was to track the global variable list in standard_testfile or prepare_for_testing, unset'ing "new" globals every time the procedure was called. It proved a bit problematic, and I ended up with the namespace approach. It was far less risky/invasive. If there is any interest, I could dig that up and play with it some more. Keith
On Fri, Apr 10, 2015 at 10:55 AM, Keith Seitz <keiths@redhat.com> wrote: > On 04/10/2015 09:53 AM, Doug Evans wrote: >> >> Bleah. :-) >> The first thing that comes to mind is of course a convention that >> array globals must be prefixed with the name of the test. >> OTOH gdb_base_coredump_filter_addr is painful. > > > I've had to do this in several places, too, with my big locations patchset. > > In the end, I felt the path-of-least-resistance was to encapsulate the whole > test in its own namespace and then declare variables: > > namespace eval $testfile { > variable addr > variable linespec > variable location > > # do all test stuff > } > > namespace delete $testfile > > This is rather inconvenient, so I played for a short while with trying to > automate this in some way. The only solution that I could devise that didn't > involve modifying dejagnu was to track the global variable list in > standard_testfile or prepare_for_testing, unset'ing "new" globals every time > the procedure was called. Tucking the thing away in a namespace works too. [for a definition of "works" that recognizes we have to be pragmatic here :-)]
diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp index f3203be..2deb7b3 100644 --- a/gdb/testsuite/gdb.base/coredump-filter.exp +++ b/gdb/testsuite/gdb.base/coredump-filter.exp @@ -196,3 +196,5 @@ foreach item $all_anon_corefiles { with_test_prefix "loading and testing corefile for non-Private-Shared-Anon-File" { test_disasm $non_private_shared_anon_file_core $main_addr 1 } + +unset addr