I'm in the process of trying to track down an error in how my object graph is being updated, and would like to be able to visualize the current state of the graph at all times. The debugger in XCode allows me to either a) view the current state of the variables of my structs using the default format or b) create a custom formatter that only displays text. I would rather use GraphViz to display a graphical rendering of what my object graph is like as I'm stepping thru my code, but this requires knowledge of the current state of the machine at each step. This is EXACTLY what GDB (and therefore XCode) are doing every single step of the way. So my question is, how do I query XCode for all the relevant information? Am I even able to this? In my idealized view of the world, XCode would have a CoreData data store defined that is updated every time I step the debugger, which would allow me to implement a KVO based plugin that called GraphViz to present a view of the current state of my object graph. I don't see that though... and I'm all ears for suggestions! My current process is to use LOTS of printf() statements to a log file, and then postprocess the file into something that GraphViz can handle.
Why not link in some sort of socket library and send update commands via
IPC? You could even have a CoreData application which acts as a server
and listens to update commands. This would work even when you
are in debug mode.
Regards,
Alexander
I think I see what you're saying, and you're right, that would work. The reason I was hoping to write something that plugs into XCode is that my current system requires me to make changes to my code. This is problematic for two reasons:
1) I'm not seeing what my code is doing, I'm seeing what my code + my update function is doing. This is problematic because if my update function has a bug in it, then I need to debug that as well. In addition, it may change the state of the machine in a manner that is different than what would happen if the update code isn't there (currently, I use macros everywhere, which I define as nothing when I don't want them)
2) I have to manually go through and instrument my code everywhere I see a variable update. If I miss a single location, then what I see, and what I think I see are two different things.
For these reasons, I'd rather use something provided by XCode. I know that the XCode team have a much better understanding of instrumenting code than I do, and could provide a much cleaner interface. Also, if I ran into bugs, I would have a greater level of trust that it was a real problem, and not a potential problem in my debug code. In short, I have reasons for wishing to use XCode as my data source.