[Spice-devel] Debugging helper functions

Christophe de Dinechin dinechin at redhat.com
Mon Jun 12 12:10:31 UTC 2017


The topic of debugging popped up in the thread about logging. There is one thing I did not find in Spice, which I think would be helpful, namely debugging helper functions.

Here is an example of what I have in mind: https://github.com/c3d/XL-programming-language/blob/master/xlr/renderer.cpp#L828. These are functions that are designed primarily for use from within a debugger. The example linked above, from a compiler, do things like rendering a parse-tree pointer into the corresponding source code. The corresponding operation is quite complex (and occupies a good deal of file renderer.cpp), and is shared with “regular” operations like error messages. So the debug functions themselves are mostly wrappers intended to make it convenient and safe to use the facility from within a debugger (in the example, for example, there are a few pointer validity checks to avoid crashing the debug session if given a bad pointer)

In Spice, if I want to see what a given network packet contains, I would like, from gdb, to be able to do “p spice_debug_packet(ptr)” and see a nicely rendered output of how spice would decode that packet. Do we presently have such debug helper functions? If not, I’ll keep that in mind for future changes. If they already exist, or if you keep them in some private branch, would you be kind enough to share?


Thanks
Christophe



More information about the Spice-devel mailing list