From 0f8e2034128e4a73e02cb8311eeeea7e886a5985 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 25 Jun 2021 21:35:40 -0400 Subject: 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) : New. : Rename to... : ... 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 --- gdb/target.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gdb/target.c') 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 #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 (get_cmd_context (command)); + auto *ti = static_cast (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); } -- cgit v1.1