public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFAv2 0/4] More flexible user-defined commands prefixing and naming.
@ 2019-11-26 23:34 Philippe Waroquiers
  2019-11-26 23:34 ` [RFAv2 2/4] Test define-prefix Philippe Waroquiers
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Philippe Waroquiers @ 2019-11-26 23:34 UTC (permalink / raw)
  To: gdb-patches

More flexible user-defined commands prefixing and naming.

This patch series improves the way a user can define user commands
using CLI sequences of commands.

Currently, a user can define a command after an existing command prefix
e.g.  define target mycommand
but cannot define a prefix to define command such as:
      define mytargetprefix mycommand.

This patch series adds the command 'define-prefix to allow
user commands to be prefix commands.

Also, this patch series adds . as an allowed character for user
defined commands.
This can e.g. be used to define a set of Valgrind specific user command
corresponding to the Valgrind monitor commands (such as check_memory,
v.info, v.set, ...).

This then allows to use GDB completion and expression evaluation
for sending monitor commands e.g. to Valgrind;

For example, for the Valgrind monitor 'check_memory' command:
  check_memory [addressable|defined] <addr> [<len>]
        check that <len> (or 1) bytes at <addr> have the given accessibility
            and outputs a description of <addr>
we can now define some new GDB commands such as:
(gdb) define-prefix Vmonitor
(gdb) define-prefix Vmonitor check_memory
(gdb) define Vmonitor check_memory addressable
eval "monitor check_memory addressable %#lx %d", $arg0, $arg1
end
(gdb) define Vmonitor check_memory defined
eval "monitor check_memory defined %#lx %d", $arg0, $arg1
end
(gdb)

Compared to the 'raw' monitor command, the new GDB commands provide completion
and evaluation of expressions.


This is the second version of the patch series.
Compared to the first version, this handles the comments of Simon.
2 changes worth mentionning here:
  * The command name was changed to define-prefix.
  * In case the user redefines a command that is also a prefix command,
    the confirmation message is now:
       (gdb) define-prefix xxxx
       (gdb) define xxxx
       Keeping subcommands of prefix command "xxxx".
       Redefine command "xxxx"? (y or n) 
    This reminds the user that the subcommands of the prefix command xxxx
    are kept even when xxxx is redefined.

The doc was slightly changed according to the changes above.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-27 21:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 23:34 [RFAv2 0/4] More flexible user-defined commands prefixing and naming Philippe Waroquiers
2019-11-26 23:34 ` [RFAv2 2/4] Test define-prefix Philippe Waroquiers
2019-11-27 21:43   ` Simon Marchi
2019-11-26 23:34 ` [RFAv2 1/4] Implement user defined prefix Philippe Waroquiers
2019-11-27 21:37   ` Simon Marchi
2019-11-26 23:34 ` [RFAv2 4/4] Document define-prefix command and the use of . in command names Philippe Waroquiers
2019-11-27  5:21   ` Eli Zaretskii
2019-11-26 23:34 ` [RFAv2 3/4] Allow . character as part of " Philippe Waroquiers
2019-11-27 21:44   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).