Re: Variable array size declaration and the debugger
Re: Variable array size declaration and the debugger
- Subject: Re: Variable array size declaration and the debugger
- From: Jim Ingham <email@hidden>
- Date: Thu, 25 Oct 2007 18:37:59 -0700
IIRC, in stabs there isn't a debug record for variable sized arrays,
which is why you don't see them. With DWARF, we are actually told
about the array, but there's nothing that tells us what its size is.
So it will show up as a zero-length array. You can use gdb's "@"
notation to print it, either in the console or in an expression window
if you know what it's size is. So, for instance if you have:
int myList[num];
then do:
(gdb) print *myList@num
Or you can put that in the expressions window. Of course, there's no
guarantee that somebody won't change the value of num after the list
is declared, so this may or may not work correctly depending on where
you stop in your code... Making this work generically is not
straightforward, which probably is why there's nothing in the DWARF
standard to tell us how to deal with variable length arrays.
Jim
On Oct 25, 2007, at 5:49 PM, Nigel Redmon wrote:
When I declare an array with a variable size (e.g, "int
myList[num];", where "num" is not known until run time), it doesn't
appear in the local variables while debugging--I can't find it
anywhere. Is this just a short-coming of the debugger? The code runs
fine--I just can't examine the array directly in the debugger.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden