aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-05-27 13:59:01 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-05-27 14:00:07 -0400
commit3947f654eabb1b6ccf8aad11ece46dc4b027f0f0 (patch)
treece1f687f4929daf2ce5aa10741c244cb1ab6e7ab /gdb/thread.c
parent7bd22f56a3cf47c6743f7f7989a6fa07f935d31b (diff)
downloadgdb-3947f654eabb1b6ccf8aad11ece46dc4b027f0f0.zip
gdb-3947f654eabb1b6ccf8aad11ece46dc4b027f0f0.tar.gz
gdb-3947f654eabb1b6ccf8aad11ece46dc4b027f0f0.tar.bz2
gdb: make add_com_alias accept target as a cmd_list_element
The alias creation functions currently accept a name to specify the target command. They pass this to add_alias_cmd, which needs to lookup the target command by name. Given that: - We don't support creating an alias for a command before that command exists. - We always use add_info_alias just after creating that target command, and therefore have access to the target command's cmd_list_element. ... change add_com_alias to accept the target command as a cmd_list_element (other functions are done in subsequent patches). This ensures we don't create the alias before the target command, because you need to get the cmd_list_element from somewhere when you call the alias creation function. And it avoids an unecessary command lookup. So it seems better to me in every aspect. gdb/ChangeLog: * command.h (add_com_alias): Accept target as cmd_list_element. Update callers. Change-Id: I24bed7da57221cc77606034de3023fedac015150
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 4005101..f850f05 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -2133,10 +2133,13 @@ Options:\n\
c = add_info ("threads", info_threads_command, info_threads_help.c_str ());
set_cmd_completer_handle_brkchars (c, info_threads_command_completer);
- add_prefix_cmd ("thread", class_run, thread_command, _("\
+ cmd_list_element *thread_cmd
+ = add_prefix_cmd ("thread", class_run, thread_command, _("\
Use this command to switch between threads.\n\
The new thread ID must be currently known."),
- &thread_cmd_list, 1, &cmdlist);
+ &thread_cmd_list, 1, &cmdlist);
+
+ add_com_alias ("t", thread_cmd, class_run, 1);
#define THREAD_APPLY_OPTION_HELP "\
Prints per-inferior thread number and target system's thread id\n\
@@ -2203,8 +2206,6 @@ Usage: thread find REGEXP\n\
Will display thread ids whose name, target ID, or extra info matches REGEXP."),
&thread_cmd_list);
- add_com_alias ("t", "thread", class_run, 1);
-
add_setshow_boolean_cmd ("thread-events", no_class,
&print_thread_events, _("\
Set printing of thread events (such as thread start and exit)."), _("\