How to watch complex objects in gdb?

Is there an easy way to write scripts or codes of some kind to use to view complex objects inside GDB? One thing I can think of is to have special functions in the code for this purpose and directly call them through call debugViewer(object). Is there a better way to do this?

How would you do otherwise using a visual debugger like the one in Qt Creator?

+3
source share
2 answers

I use the DDD GUI for GDB, which is specifically designed to display what you might call "complex objects." However, having said that, it is often better for me to code the dbg () method in anything other than trivial classes / structures, and the advantage is that the dbg () method can not only print the contents of the object to stdout, but it can also check the integrity custom objects, including checking that owned / related objects are in expected states, etc., and may obscure information that it knows is valid, but is usually not useful for debugging unless you pass it a "verbose "flag (or have a separate function for details). To simplify the method call from the GDB command line, I wrote methods other than thosewhich take a pointer to the intended dbg () object, as you suggested in your post.

, , , - , std::string, std:: list std:: map ( " " ), - , -, , , . , () , ( ) , / (.. , , "next- > prev" 'this' "prev- > next" 'this' ..), - ( DAG), .... / DAG , . , , .

, , , , .

+3

"Insight", gdb, :

GDB GUI Insight

0

All Articles