views:

1555

answers:

2

Let's say I have an array in C++:

double* velocity = new double[100];

Using the GDB command line, I can view this array with the command:

> print *velocity @ 100

and it will print a nicely-formatted list of all the double values inside the array.

However, when using the Xcode debugger, the most it will do is treat this as a pointer to a single double value, and display velocity[0] in the variable list.

This makes it a real PITA to debug programs that contain large dynamically allocated array. There has got to be some way to tell Xcode "This is a pointer to an array of length 100", and have it display the thing as such. Anyone know what it is?

A: 

No unfortunately the GUI is limited and you will need to blend in a good mix of GDB magic to get things done.

St3fan
+3  A: 

You can use gdb syntax as expressions:

  1. Use Run/Show/Expressions... menu to show the expressions window
  2. Enter '*velocity @ 100' at the bottom of the window (Expression:)
mfazekas