3 ms·
gdb's pretty printing API is documented in the texinfo manual, most usefully this page: http://sourceware.org/gdb/current/onlinedocs/gdb/Writing-a-Pretty_002dPr
by Pete_D 10y ago
gdb's pretty printing API is documented in the texinfo manual, most usefully this page: http://sourceware.org/gdb/current/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html http://sourceware.org/gdb/current/onlinedocs/gdb/Writing-a-P.... I use it a lot, and love it, but I haven't used VS's XML thing to compare. For looking up API documentation I usually drop into `python-interactive` from within gdb and do e.g. `help(gdb.printing)`.
Though, you're still limited to string representations that way. If I want to examine a really complex datatype, I'll sometimes write a gdb command to dump some kind of GraphViz output and run it through dot. Or come up with a json representation and explore it using jq or ad-hoc python filters.
Looking at your ideal tool checklist - I think it would be possible to build this on top of gdb. I wrote a prototype a while ago that would launch a HTTP server from the gdb prompt, and then you could control it via websockets. Never took it past recreating the prompt with an <input> tag, but someone who was better at front-end work could conceivably do all sorts of nifty data visualizations with it.
- realharo 10y agoAh, thanks, especially these two parts help a lot https://sourceware.org/gdb/current/onlinedocs/gdb/Values-From-Inferior.html#Values-From-Inferior https://sourceware.org/gdb/current/onlinedocs/gdb/Values-Fro... https://sourceware.org/gdb/current/onlinedocs/gdb/Types-In-Python.html#Types-In-Python https://sourceware.org/gdb/current/onlinedocs/gdb/Types-In-P... Not sure why I had so much trouble finding that back when I needed to change an existing printer.