aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-08-30 11:20:58 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-09-30 22:21:52 -0400
commitc5dfcc218832f26e7ecefa6c44a2b350c605148f (patch)
tree33f3415c2b03071d53e5f512dab8ce077ab10b39 /gdb/python/python.h
parent33d16dd987d16fe1eb289853e5a444192bb31d9e (diff)
downloadbinutils-c5dfcc218832f26e7ecefa6c44a2b350c605148f.zip
binutils-c5dfcc218832f26e7ecefa6c44a2b350c605148f.tar.gz
binutils-c5dfcc218832f26e7ecefa6c44a2b350c605148f.tar.bz2
gdb/testsuite/dwarf: don't define nested procs for rnglists/loclists
When I wrote support for rnglists and loclists in the testsuite's DWARF assembler, I made it with nested procs, for example proc "table" inside proc "rnglists". The intention was that this proc "table" could only be used by the user while inside proc "rnglists"'s body. I had chosen very simple names, thinking there was no chance of name clashes. I recently learned that this is not how TCL works. This ends up defining a proc "table" in the current namespace ("Dwarf" in this case). Things still work if you generate rnglists and loclists in the same file, as each redefines its own procedures when executing. But if a user of the assembler happened to define a convenience "table" or "start_end" procedure, for example, it would get overriden. I'd like to change how this works to reduce the chances of a name clash. - Move the procs out of each other, so they are not defined in a nested fashion. - Prefix them with "_rnglists_" or "_loclists_". - While calling $body in the various procs, temporarily make the procs available under their "short" name. For example, while in rngllists' body, make _rnglists_table available as just "table". This allows existing code to keep working and keeps it not too verbose. - Modify with_override to allow the overriden proc to not exist. In that case, the temporary proc is deleted on exit. Note the non-conforming indentation when calling with_override in _loclists_list. This is on purpose: as we implement more loclists (and rnglists) entry types, the indentation would otherwise get larger and larger without much value for readability. So I think it's reasonable here to put them on the same level. Change-Id: I7bb48d26fcb0dba1ae4dada05c0c837212424328
Diffstat (limited to 'gdb/python/python.h')
0 files changed, 0 insertions, 0 deletions