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/python | |
parent | ac2d77c6a102ca785aae565aec93a3478a9f4544 (diff) | |
download | binutils-0f8e2034128e4a73e02cb8311eeeea7e886a5985.zip binutils-0f8e2034128e4a73e02cb8311eeeea7e886a5985.tar.gz binutils-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/python')
-rw-r--r-- | gdb/python/py-cmd.c | 6 | ||||
-rw-r--r-- | gdb/python/py-param.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 4f01fc0..0467ebd 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -103,7 +103,7 @@ static void cmdpy_function (struct cmd_list_element *command, const char *args, int from_tty) { - cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command); + cmdpy_object *obj = (cmdpy_object *) command->context (); gdbpy_enter enter_py (get_current_arch (), current_language); @@ -172,7 +172,7 @@ static gdbpy_ref<> cmdpy_completer_helper (struct cmd_list_element *command, const char *text, const char *word) { - cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command); + cmdpy_object *obj = (cmdpy_object *) command->context (); if (obj == NULL) error (_("Invalid invocation of Python command object.")); @@ -532,7 +532,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw) cmd->name_allocated = 1; obj->command = cmd; - set_cmd_context (cmd, self_ref.release ()); + cmd->set_context (self_ref.release ()); set_cmd_completer (cmd, ((completetype == -1) ? cmdpy_completer : completers[completetype].completer)); if (completetype == -1) diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c index d0a4850..f9dcb07 100644 --- a/gdb/python/py-param.c +++ b/gdb/python/py-param.c @@ -376,7 +376,7 @@ static void get_set_value (const char *args, int from_tty, struct cmd_list_element *c) { - PyObject *obj = (PyObject *) get_cmd_context (c); + PyObject *obj = (PyObject *) c->context (); gdb::unique_xmalloc_ptr<char> set_doc_string; gdbpy_enter enter_py (get_current_arch (), current_language); @@ -411,7 +411,7 @@ get_show_value (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - PyObject *obj = (PyObject *) get_cmd_context (c); + PyObject *obj = (PyObject *) c->context (); gdb::unique_xmalloc_ptr<char> show_doc_string; gdbpy_enter enter_py (get_current_arch (), current_language); @@ -569,8 +569,8 @@ add_setshow_generic (int parmclass, enum command_class cmdclass, } /* Register Python objects in both commands' context. */ - set_cmd_context (commands.set, self); - set_cmd_context (commands.show, self); + commands.set->set_context (self); + commands.show->set_context (self); /* We (unfortunately) currently leak the command name. */ cmd_name.release (); |