3 ms·
The DDD debugger has(had ? Not sure it's maintained anymore) pretty useful visualization of data - e.g. like https://bcaptain.files.wordpress.com/2013/06/ddd.pn
by noselasd 10y ago
The DDD debugger has(had ? Not sure it's maintained anymore) pretty useful visualization of data - e.g. like https://bcaptain.files.wordpress.com/2013/06/ddd.png https://bcaptain.files.wordpress.com/2013/06/ddd.png
- realharo 10y agoThat's a good start, I'll try that out when I have some time. This specific screenshot however - a linked list - shows a situation where you most likely don't care about the exact structure like this - you only care that it's a list of elements, so most debuggers would show it to you like that - just as a list. The specific raw structure only obscures the parts you care about. Visual Studio allows describing your custom data structures like this using XML files (https://msdn.microsoft.com/en-us/library/jj620914.aspx https://msdn.microsoft.com/en-us/library/jj620914.aspx), or even custom graphical controls (https://code.msdn.microsoft.com/windowsdesktop/Writing-graphical-debugger-a17e3d75 https://code.msdn.microsoft.com/windowsdesktop/Writing-graph...) and gdb allows you to write a pretty-printer in Python (using an API which I can't find any documentation for :/ ), but it's all kinda clunky and still doesn't deal well with large amounts of data. My ideal tool would be something that combines both of these things - you have - An object graph that you can zoom in/out of that shows raw objects (just like in that DDD screenshot). - An easy way to describe a custom view for your own objects (you can also switch to the raw view for an object, or switch between different defined views, etc.). Just like VS/gdb/lldb allow you to do, but a lot easier and more powerful. You could for example view a specific dictionary that contains complex objects in a tabbed interface, where the keys are tab titles, etc. - A way to live edit these custom views - so that you can rapidly create them without restarting the debugger and restoring the state many times (Visual Studio supports this for the .natvis files). - A powerful searching/filtering/transformation mechanism (e.g. for every object that satisfies this condition, show only this property and sort by that, etc.). - Some way to save these configured views + filters + transformations, etc.
- Pete_D 10y agogdb'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.
- db48x 10y agoYou would care about the pointers in that linked list if one of them had gone awry.