lldb support for variable length arrays?
lldb support for variable length arrays?
- Subject: lldb support for variable length arrays?
- From: Jean-Denis MUYS <email@hidden>
- Date: Tue, 07 Feb 2012 15:50:09 +0000
- Thread-topic: lldb support for variable length arrays?
Hello,
I spent some time scratching my head yesterday trying to debug some code where the debugger stubbornly refused to acknowledge the existence of a local variable.
It turns out that neither gdb nor lldb seem to support VLAs (Variable Length Arrays). Am I correct? Is there some workaround beside stopping using VLAs?
Here is a contrived example:
- (void) testVLAwithSize:(int) s
{
int vla[s];
for (int i = 0; i < s; i++) {
vla[i] = i*i;
}
for (int i = 0; i < s; i++) {
NSLog(@"The square of %d is %d", i, vla[i]);
}
}
call this method with any int value, put a breakpoint in it, and the debugger keeps claiming that vla is an undefined symbol:
- it doesn't appear in the list of local variables
- "p vla" (or any variation) yields "use of undeclared identifier 'vla'"
Yet the code works (of course).
I knew about some limitations of gdb regarding variable length arrays, and I don't expect Apple to fix gdb at this point. I didn't expect lldb to fail too.
Sigh,
Jean-Denis
PS: tested in an iOS app.
_______________________________________________
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