Re: [SH] regs command

Joel Brobecker
2012-05-16T16:58:10Z

> Sounds good, and thusly implemented, OK to commit?

I have only skimmed the patch for now. Perhaps Kevin would like
to look at the purely sh-related changes. They look good to me,
but I don't know if you might have missed something.

> gdb/
> * sh-tdep.c (sh_show_regs): Remove variable.
> (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs)
> (sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs)
> (sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs)
> (sh_show_regs_command): Remove functions.
> (sh_gdbarch_init): Don't set sh_show_regs.
> (_initialize_sh_tdep): Make the `regs' command an deprecated alias to
> `info all-registers'.
> * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs)
> (sh64_show_regs): Remove functions.
> * sh64-tdep.h (sh64_show_regs): Remove function declaration.
> * NEWS: Document the deprecation.
> gdb/doc/
> * gdb.texinfo: Document the deprecation.

In the meantime, I have noticed something:

> _initialize_sh_tdep (void)
> {
> struct cmd_list_element *c;
> + extern void all_registers_info (char *, int);
>
> gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
>
> - add_com ("regs", class_vars, sh_show_regs_command, _("Print all registers"));
> -
> + c = add_com ("regs", class_vars, all_registers_info,
> + _("Print all registers"));
> + deprecate_cmd (c, "info all-registers");
> +

Can you use add_alias_cmd instead of add_com? The only think I am not
sure about is whether it is going to work with the deprecation mechanism.
The command system is kind of obscure to me (in the fact that it has so
many attributes), but a look at the code seems to indicate that it will.
And as a bonus, you'll inherit all the attributes of the "info all-reg"
command...

--
Joel