This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
varargs in TUI defined functions ?
- From: "Martin Oberhuber" <Martin dot Oberhuber at gmx dot at>
- To: gdb at sourceware dot org
- Date: Wed, 26 May 2010 10:31:19 +0200
- Subject: varargs in TUI defined functions ?
As a gdb commandline (text UI) user, I want to define a command that can take a variable number of arguments. I want to use this to create wrapper scripts for common operations. Example:
# Simplified "run" convenience function
define r
if (0 == $argc)
run -port default
else
run $arg*
end
end
This request is old, I found a reference in the mailing list archives from
2000: http://sourceware.org/ml/gdb/2000-q1/msg00019.html
But at the moment there seems to be still no solution according to latest
docs: http://sourceware.org/gdb/current/onlinedocs/gdb/Define.html#Define
At the moment, there is $argc and $arg0 ... $arg9, but what I'm missing
is a builtin convenience variable that holds the entire list of arguments.
Syntax could be any of
$argv (like in C main())
$args (like in C va_args)
$* (like in Shellscripts)
$arg* (mixture of $arg and *)
I have been told that somewhere out in the wild there is a patch providing the "$*" and "$#" convenience variables as a gdb extension, but could not find this anywhere. Could anybody point me at places to look at, or provide any background information?
--
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser