Cast to result of whatis expression

Tom Tromey tromey@redhat.com
Fri Sep 10 19:57:00 GMT 2010


Kenneth> Thanks Tom.  Unfortunately, this is for a bunch of developers
Kenneth> and I can't make everyone upgrade to GDB 7.2.  That said, when
Kenneth> I was researching how to do this, the Python stuff looked uber
Kenneth> sexy (and uber practical).

Yeah.  Try harder to upgrade!

Kenneth> I played around with sending the result of "whatis foo" to a shell
Kenneth> command, but couldn't figure out how to actually pass an
Kenneth> argument to the inferior shell with gdb.

The way to do complicated scripting in pre-python gdb is horrible:

1. Use set logging to write to a temporary file.
2. Run a gdb command that generates the output you need.
3. Use "shell" (and the scripting of your choice: sed, awk, perl...)
   to rewrite the temp file to a second temp file that is in
   gdb CLI syntax.
4. "source" the second temp file

Kenneth> I just need to manually copy and paste it myself as an argument
Kenneth> to pvector.  Since I run gdb in emacs, this is pretty easy.

Of course, you could hack gud-mode to do this automatically :-)

Tom



More information about the Gdb mailing list