This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Unset tcl variable addr to avoid clashing


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 :-)]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]