aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-06-25 21:35:40 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-06-25 21:35:40 -0400
commit0f8e2034128e4a73e02cb8311eeeea7e886a5985 (patch)
tree609b9baf7a5f167daa28b0341743aa650677f28a /gdb/target.c
parentac2d77c6a102ca785aae565aec93a3478a9f4544 (diff)
downloadgdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.zip
gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.tar.gz
gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.tar.bz2
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
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 6babfc5..767685f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -52,6 +52,7 @@
#include <unordered_map>
#include "target-connection.h"
#include "valprint.h"
+#include "cli/cli-decode.h"
static void generic_tls_error (void) ATTRIBUTE_NORETURN;
@@ -837,7 +838,7 @@ target_log_command (const char *p)
static void
open_target (const char *args, int from_tty, struct cmd_list_element *command)
{
- auto *ti = static_cast<target_info *> (get_cmd_context (command));
+ auto *ti = static_cast<target_info *> (command->context ());
target_open_ftype *func = target_factories[ti];
if (targetdebug)
@@ -874,7 +875,7 @@ information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name."),
&targetlist, 0, &cmdlist);
c = add_cmd (t.shortname, no_class, t.doc, &targetlist);
- set_cmd_context (c, (void *) &t);
+ c->set_context ((void *) &t);
set_cmd_sfunc (c, open_target);
if (completer != NULL)
set_cmd_completer (c, completer);
@@ -892,7 +893,7 @@ add_deprecated_target_alias (const target_info &tinfo, const char *alias)
see PR cli/15104. */
c = add_cmd (alias, no_class, tinfo.doc, &targetlist);
set_cmd_sfunc (c, open_target);
- set_cmd_context (c, (void *) &tinfo);
+ c->set_context ((void *) &tinfo);
alt = xstrprintf ("target %s", tinfo.shortname);
deprecate_cmd (c, alt);
}