• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
lldb support for variable length arrays?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: iOS allows ivars in class extension but Mac OS doesn't?!
  • Next by Date: Re: def OT, but big problem
  • Previous by thread: Re: Xcode and Mapnik
  • Next by thread: Does Xcode/Mac come with a PNG util?
  • Index(es):
    • Date
    • Thread