gdb: add context getter/setter to cmd_list_element

Straightforward replacement of get_cmd_context / set_cmd_context with
cmd_list_element methods.

gdb/ChangeLog:

	* cli/cli-decode.h (struct cmd_list_element) <set_context,
	context>: New.
	<context>: Rename to...
	<m_context>: ... this.
	* cli/cli-decode.c (set_cmd_context, get_cmd_context): Remove.
	* command.h (set_cmd_context, get_cmd_context): Remove, use
	cmd_list_element::set_context and cmd_list_element::context
	everywhere instead.

Change-Id: I5016b0079014e3f17d1aa449ada7954473bf2b5d
This commit is contained in:
Simon Marchi
2021-06-25 21:35:40 -04:00
parent ac2d77c6a1
commit 0f8e203412
17 changed files with 69 additions and 62 deletions

View File

@@ -333,7 +333,7 @@ struct dump_context
static void
call_dump_func (struct cmd_list_element *c, const char *args, int from_tty)
{
struct dump_context *d = (struct dump_context *) get_cmd_context (c);
struct dump_context *d = (struct dump_context *) c->context ();
d->func (args, d->mode);
}
@@ -352,7 +352,7 @@ add_dump_command (const char *name,
d = XNEW (struct dump_context);
d->func = func;
d->mode = FOPEN_WB;
set_cmd_context (c, d);
c->set_context (d);
c->func = call_dump_func;
c = add_cmd (name, all_commands, descr, &append_cmdlist);
@@ -360,7 +360,7 @@ add_dump_command (const char *name,
d = XNEW (struct dump_context);
d->func = func;
d->mode = FOPEN_AB;
set_cmd_context (c, d);
c->set_context (d);
c->func = call_dump_func;
/* Replace "Dump " at start of docstring with "Append " (borrowed