[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
better "pr" with gdb-6.4
From: |
Dan Nicolaescu |
Subject: |
better "pr" with gdb-6.4 |
Date: |
Sun, 05 Feb 2006 10:40:24 -0800 |
Using "pr" when debugging is a bit inconvenient because one has to do:
p VARIABLE
pr
Instead it would be nicer to just do:
pr VARIABLE
Well, with gdb-6.4 this is possible, thanks to a new variable ($argc)
that holds the number of arguments passed to a command. "pr" can now
be written like this to support both versions shown above:
define pr
if ($argc == 0)
set debug_print ($)
elif ($argc == 1)
set debug_print ($arg0)
end
end
Processing even more arguments can be done by adding more "elif"
elif ($argc == 2)
set debug_print ($arg0)
set debug_print ($arg1)
Unfortunately AFAIK it is not possible to do it in a simpler way
(there's no equivalent of Bourne shell's "shift" and the positional
arguments cannot be accessed through a variable that can be
incremented in a loop).
I don't know enough about autoconf to integrate the above in the build
system, but maybe some of you might be useful as a local hack until
properly integrated in emacs....
--dan
- better "pr" with gdb-6.4,
Dan Nicolaescu <=