diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-25 21:35:40 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-06-25 21:35:40 -0400 |
commit | 0f8e2034128e4a73e02cb8311eeeea7e886a5985 (patch) | |
tree | 609b9baf7a5f167daa28b0341743aa650677f28a /gdb/cli/cli-decode.h | |
parent | ac2d77c6a102ca785aae565aec93a3478a9f4544 (diff) | |
download | fsf-binutils-gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.zip fsf-binutils-gdb-0f8e2034128e4a73e02cb8311eeeea7e886a5985.tar.gz fsf-binutils-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/cli/cli-decode.h')
-rw-r--r-- | gdb/cli/cli-decode.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 9328659..1692a6e 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -93,6 +93,12 @@ struct cmd_list_element bool is_command_class_help () const { return this->func == nullptr; } + void set_context (void *context) + { m_context = context; } + + void *context () const + { return m_context; } + /* Points to next command in this list. */ struct cmd_list_element *next = nullptr; @@ -173,9 +179,6 @@ struct cmd_list_element } function; - /* Local state (context) for this command. This can be anything. */ - void *context = nullptr; - /* Documentation of this command (or help topic). First line is brief documentation; remaining lines form, with it, the full documentation. First line should end with a period. @@ -256,6 +259,10 @@ struct cmd_list_element when this command is being executed. It will be set back to false when the command has been executed. */ int *suppress_notification = nullptr; + +private: + /* Local state (context) for this command. This can be anything. */ + void *m_context = nullptr; }; /* Functions that implement commands about CLI commands. */ |