From 3947f654eabb1b6ccf8aad11ece46dc4b027f0f0 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 27 May 2021 13:59:01 -0400 Subject: 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 --- gdb/regcache.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gdb/regcache.c') diff --git a/gdb/regcache.c b/gdb/regcache.c index 51e9eff..2d50f3e 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -2092,10 +2092,11 @@ _initialize_regcache () gdb::observers::thread_ptid_changed.attach (regcache_thread_ptid_changed, "regcache"); - add_cmd ("register-cache", class_maintenance, reg_flush_command, - _("Force gdb to flush its register and frame cache."), - &maintenanceflushlist); - c = add_com_alias ("flushregs", "maintenance flush register-cache", + cmd_list_element *maintenance_flush_register_cache_cmd + = add_cmd ("register-cache", class_maintenance, reg_flush_command, + _("Force gdb to flush its register and frame cache."), + &maintenanceflushlist); + c = add_com_alias ("flushregs", maintenance_flush_register_cache_cmd, class_maintenance, 0); deprecate_cmd (c, "maintenance flush register-cache"); -- cgit v1.1