Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

magneto2007

macrumors newbie
Original poster
Sep 25, 2007
6
0
Hi,

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 :)

Thanks
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
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
or
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
or
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

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.