[PATCH 2/7] gdb: don't handle old == nullptr in add_alias_cmd

Tom Tromey tom@tromey.com
Sun May 16 13:37:53 GMT 2021


>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> I don't think this can ever happen, that we add an alias command and
Simon> pass a nullptr old (target) command.  Remove the "if" handling this,
Simon> replace with an assert.

I am not sure this can't happen due to user input.

This overload:

    struct cmd_list_element *
    add_alias_cmd (const char *name, const char *oldname,

does:

  old = lookup_cmd (&tmp, *list, "", NULL, 1, 1);

  return add_alias_cmd (name, old, theclass, abbrev_flag, list);

But when allow_unknown==1, I think lookup_cmd can return null.

Maybe that call ought to be changed to pass 0.  I am not really sure.

Tom


More information about the Gdb-patches mailing list