Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 17, 2008, 09:43 AM   #1
magneto2007
macrumors newbie
 
Join Date: Sep 2007
Xcode debugger and variable watch

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
magneto2007 is offline   0 Reply With Quote
Old May 9, 2008, 03:51 PM   #2
magneto2007
Thread Starter
macrumors newbie
 
Join Date: Sep 2007
nobody use xcode for debugging??
magneto2007 is offline   0 Reply With Quote
Old May 9, 2008, 05:05 PM   #3
lee1210
macrumors 68040
 
lee1210's Avatar
 
Join Date: Jan 2005
Location: 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

Last edited by lee1210; May 9, 2008 at 05:06 PM. Reason: your variable was uppercase, and i had written it in lowercase
lee1210 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Xcode 4 and non-C compilers mbarriault Mac Programming 3 Aug 6, 2011 06:51 PM
XCODE 4 & viewing global variables hajiman Mac Programming 2 Jul 21, 2011 04:31 PM
Objective-C/Xcode question on pointers and variables Sandy Santra Mac Programming 2 Apr 15, 2009 01:03 PM
Xcode debugger issue capn-slagg Mac Programming 1 Jun 6, 2007 04:47 PM
Xcode Debugger Question bobber205 Mac Programming 4 Feb 1, 2007 03:11 AM


All times are GMT -5. The time now is 10:57 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC