Xcode debugger and variable watch

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

  1. macrumors newbie

    Joined:
    Sep 25, 2007
    #1
    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
     
  2. thread starter macrumors newbie

    Joined:
    Sep 25, 2007
    #2
    nobody use xcode for debugging??
     
  3. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    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
     

Share This Page