overloading 'print' command.
Paul Pluzhnikov
ppluzhnikov@google.com
Thu May 14 23:17:00 GMT 2009
2009/5/14 Paweł Sikora <pluto@agmk.net>:
> I'd like to ask about overloading gdb's 'print' command.
> e.g. I've defined a macro 'ps' for printing std::string:
>
> define ps
> p $arg0.c_str()
> end
>
> Now, I'd like to avoid calling 'ps' and just use the 'p' command
> in top-macros for printing more complex data structures.
> Is it possible in gdb to register some hooks for type-based
> printing?
Support for doing *exactly* this is coming to mainline GDB, but you can
get it now from the archer-tromey-python branch:
http://sourceware.org/gdb/wiki/PythonGdb
It is significantly more powerful than what you can do with simple 'define'.
Cheers,
--
Paul Pluzhnikov
More information about the Gdb
mailing list