Xcode debugger and variable watch

Discussion in 'Mac Programming' started by magneto2007, Apr 17, 2008.

  1. magneto2007 macrumors newbie

    Sep 25, 2007

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

  2. magneto2007 thread starter macrumors newbie

    Sep 25, 2007
  3. lee1210 macrumors 68040


    Jan 10, 2005
    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
    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


Share This Page