aboutsummaryrefslogtreecommitdiff
path: root/gdb/d-lang.c
diff options
context:
space:
mode:
authorLancelot SIX <lsix@lancelotsix.com>2021-09-14 23:36:53 +0100
committerLancelot SIX <lsix@lancelotsix.com>2021-10-03 17:53:16 +0100
commit702991711a91bd47b209289562843a11e7009396 (patch)
treeb7b71ddfc72ce5ebddc1118cba7f97f3fb2700d8 /gdb/d-lang.c
parente0700ba44c5695d07f4cc9841315adc91ca18bf5 (diff)
downloadgdb-702991711a91bd47b209289562843a11e7009396.zip
gdb-702991711a91bd47b209289562843a11e7009396.tar.gz
gdb-702991711a91bd47b209289562843a11e7009396.tar.bz2
gdb: Have setter and getter callbacks for settings
The main motivation behind this improvement is to help the implementation of a patch Simon Marchi is preparing to fix a bug when MI or Python try to access parameters that are inferior dependent (see PR/28085). This commit extends the previous ones, which introduces the setting object to represent a static variable whose value can be set or shown with the appropriate commands. This patch proposes that a setting can either contain a pointer to a static variable holding a setting, or pointers to a pair of setter and getter callback functions. The callbacks functions can be used to retrieve or change the value with custom logic. This is useful when the source of truth for a given setting is not contained in the variable pointed to by the setting instance. Given that the callback function call is hidden within the setting abstraction introduced earlier, none of the sites accessing the setting needs to be updated. The registered getter or setter is used whatever the way to access it is (through MI, Python, Guile, the "with" command and the $_gdb_setting / $_gdb_setting_str convenience functions). All the add_setshow_*_cmd are given a new overload that will accept the pair of function pointers (set / get functions) instead of the pointer to a global variable. Tested on GNU/Linux x86_64 with no regression observed. Change-Id: Ieb81fef57550632ff66e6aa85f637372a226be8c Co-authored-by: Simon Marchi <simon.marchi@polymtl.ca>
Diffstat (limited to 'gdb/d-lang.c')
0 files changed, 0 insertions, 0 deletions