This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Unset tcl variable addr to avoid clashing
- From: Keith Seitz <keiths at redhat dot com>
- To: Doug Evans <dje at google dot com>, Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Fri, 10 Apr 2015 10:55:38 -0700
- Subject: Re: [RFC] Unset tcl variable addr to avoid clashing
- Authentication-results: sourceware.org; auth=none
- References: <1428666671-12926-1-git-send-email-qiyaoltc at gmail dot com> <CADPb22TpwGMD1CPKodSCPmeRWaiqdKe+_1WYVT+poxH+c7hODg at mail dot gmail dot com>
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