From d8a001f57016eff05977e9699c7aabdf4302c71b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 1 Jun 2023 11:54:17 -0600 Subject: 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 --- gdb/target.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gdb/target.c') 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, -- cgit v1.1