Add "task" keyword to the "watch" command

Breakpoints in gdb can be made specific to an Ada task using the
"task" qualifier.  This patch applies this same idea to watchpoints.
This commit is contained in:
Tom Tromey
2021-08-30 13:58:48 -06:00
parent 36cb9e7e17
commit 8a18382f94
5 changed files with 175 additions and 1 deletions

View File

@@ -10557,6 +10557,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
the hardware watchpoint. */
bool use_mask = false;
CORE_ADDR mask = 0;
int task = 0;
/* Make sure that we actually have parameters to parse. */
if (arg != NULL && arg[0] != '\0')
@@ -10612,6 +10613,16 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
thread = thr->global_num;
}
else if (toklen == 4 && startswith (tok, "task"))
{
char *tmp;
task = strtol (value_start, &tmp, 0);
if (tmp == value_start)
error (_("Junk after task keyword."));
if (!valid_task_id (task))
error (_("Unknown task %d."), task);
}
else if (toklen == 4 && startswith (tok, "mask"))
{
/* We've found a "mask" token, which means the user wants to
@@ -10785,6 +10796,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
init_raw_breakpoint_without_location (w.get (), NULL, bp_type,
&watchpoint_breakpoint_ops);
w->thread = thread;
w->task = task;
w->disposition = disp_donttouch;
w->pspace = current_program_space;
w->exp = std::move (exp);