Suppose I create a gdb user-defined command like this:
define pfoo
call foo_printer($arg0)
end
where foo_printer
takes a pointer argument. Then if I have a pointer variable pf
I can do:
pfoo pf
But if I have a non-pointer variable f
, I need to remember to provide &
:
pfoo &f
Is there a way to define the command to work with either pointer or non-pointer argument? Ie, so both of these would work:
pfoo pf
pfoo f
As a novice to the GDB Python API, this is what I came up with:
(And then source that file in
.gdbinit
.)Please do let me know if this might be improved.