[RFAv3 1/4] Implement user defined prefix.
Simon Marchi
simark@simark.ca
Sat Nov 30 04:09:00 GMT 2019
On 2019-11-28 3:08 p.m., Philippe Waroquiers wrote:
> diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
> index 06cdcd6bfe..066a596fdc 100644
> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -29,6 +29,7 @@
> #include "cli/cli-cmds.h"
> #include "cli/cli-decode.h"
> #include "cli/cli-script.h"
> +#include "cli/cli-style.h"
>
> #include "extension.h"
> #include "interps.h"
> @@ -1395,7 +1396,17 @@ do_define_command (const char *comname, int from_tty,
> int q;
>
> if (c->theclass == class_user || c->theclass == class_alias)
> - q = query (_("Redefine command \"%s\"? "), c->name);
> + {
> + /* if C is a prefix command that was previously defined,
> + tell the user its subcommands will be kept, and ask
> + if ok to redefine the command. */
> + if (c->prefixlist != nullptr)
> + q = c->user_commands.get () == nullptr
> + || query (_("Keeping subcommands of prefix command \"%s\".\n"
> + "Redefine command \"%s\"? "), c->name, c->name);
Just a nit here before you push, format the multi-line expression line like this, with
a parenthesis:
q = (c->user_commands.get () == nullptr
|| query (_("Keeping subcommands of prefix command \"%s\".\n"
"Redefine command \"%s\"? "), c->name, c->name));
Simon
More information about the Gdb-patches
mailing list