This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 0/4] More flexible user-defined commands prefixing and naming.
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: gdb-patches at sourceware dot org
- Date: Sun, 29 Sep 2019 22:54:23 +0200
- Subject: [RFA 0/4] 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 'prefix-define' 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.
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) prefix-define Vmonitor
(gdb) prefix-define 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.