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 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


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