diff options
author | Tom Tromey <tromey@adacore.com> | 2023-06-01 11:54:17 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-06-22 09:46:24 -0600 |
commit | d8a001f57016eff05977e9699c7aabdf4302c71b (patch) | |
tree | 8f52cf811c7b40b9168be6bd7f51e9dfa9e418fc /gdb/target.c | |
parent | 0aafd5d038581b1eaf7f37b185f9d2c9be47386d (diff) | |
download | binutils-d8a001f57016eff05977e9699c7aabdf4302c71b.zip binutils-d8a001f57016eff05977e9699c7aabdf4302c71b.tar.gz binutils-d8a001f57016eff05977e9699c7aabdf4302c71b.tar.bz2 |
Implement DAP "hover" context
A DAP client can request that an expression be evaluated in "hover"
context, meaning that it should not cause side effects. In gdb, this
can be implemented by temporarily setting a few "may-" parameters to
"off".
In order to make this work, I had to also change "may-write-registers"
so that it can be changed while the program is running. I don't think
there was any reason for this prohibition in the first place.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30476
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/target.c b/gdb/target.c index 80d2c80..fecbc89 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -4494,7 +4494,6 @@ set_target_permissions (const char *args, int from_tty, } /* Make the real values match the user-changed values. */ - may_write_registers = may_write_registers_1; may_insert_breakpoints = may_insert_breakpoints_1; may_insert_tracepoints = may_insert_tracepoints_1; may_insert_fast_tracepoints = may_insert_fast_tracepoints_1; @@ -4502,14 +4501,15 @@ set_target_permissions (const char *args, int from_tty, update_observer_mode (); } -/* Set memory write permission independently of observer mode. */ +/* Set some permissions independently of observer mode. */ static void -set_write_memory_permission (const char *args, int from_tty, - struct cmd_list_element *c) +set_write_memory_registers_permission (const char *args, int from_tty, + struct cmd_list_element *c) { /* Make the real values match the user-changed values. */ may_write_memory = may_write_memory_1; + may_write_registers = may_write_registers_1; update_observer_mode (); } @@ -4578,7 +4578,7 @@ Set permission to write into registers."), _("\ Show permission to write into registers."), _("\ When this permission is on, GDB may write into the target's registers.\n\ Otherwise, any sort of write attempt will result in an error."), - set_target_permissions, NULL, + set_write_memory_registers_permission, NULL, &setlist, &showlist); add_setshow_boolean_cmd ("may-write-memory", class_support, @@ -4587,7 +4587,7 @@ Set permission to write into target memory."), _("\ Show permission to write into target memory."), _("\ When this permission is on, GDB may write into the target's memory.\n\ Otherwise, any sort of write attempt will result in an error."), - set_write_memory_permission, NULL, + set_write_memory_registers_permission, NULL, &setlist, &showlist); add_setshow_boolean_cmd ("may-insert-breakpoints", class_support, |