View Full Version : Xcode debugger and variable watch

Apr 17, 2008, 09:43 AM

I am using xcode to compile and debug my software. It's really comfortable to see variables with their contents in the debugger window, but;

let's say that I have a pointer double * P that points to an array of n doubles.

In the debugger window, when I click the small triangle next to P, I can only see the first item of this array, is there a easy/fast way to see the whole array.

In fact I wonder if there is a graphical way to do " (gdb) p P@n "

I have structures in arrays in structures with long names, so writing by hand in gdb console makes me lose time. It'll be very cool if I can do this with one click :-)


May 9, 2008, 03:51 PM
nobody use xcode for debugging??

May 9, 2008, 05:05 PM
I am not at my Mac and haven't used xcode for too much debugging, but have used GDB quite a bit. The way I would print a whole slew of things at contiguous positions in memory would be:
x/100fg P
p P

The second may only show you a few items if the array is very long. With the first you see 100 items, but you can increase that. The f means floating point, the g means "giant" for 8 bytes. At the gdb prompt you can type:
help x
help p

To get help with formatting the commands. You can use display/d to show values at every break point if that's what you want:
display/100fg P