I would like to output the contents of a C ++ object (e.g. a circular buffer implementation) to a logging string. I planned to do this manually, but then I noticed that the running print object on my object in the GDB debugger gave me fine formatted output, for example:
(gdb) print audioDebugMessageQueue $1 = { writePointer = 1, readPointer = 0, keys = {{ samples = {0.155292124, 0.106764726}, timeStamp = 1322767911, numFrames = 1024 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }, { samples = {0, 0}, timeStamp = 0, numFrames = 0 }} }
If GDB can access a pretty dump of my object, I guess I probably can too. But how? By the way, I'm on iOS.