Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell gdb how long my zero-length array is?

Slightly oxymoronic title! Bonus points for Xcode answer but it's a gdb question.

If I have a standard, statically sized array gdb will print all its elements [and Xcode will let me browse through it] but if I have a zero length array, it won't, because it doesn't know. Obviously I can print the array indexes one by one, but I'd like a dump of the whole thing.

How do I tell gdb how much space I have allocated for the array to allow it to print the array (or to allow Xcode to view the array). Is it even possible?

like image 318
Joe Avatar asked Feb 13 '11 00:02

Joe


1 Answers

http://www.chemie.fu-berlin.de/chemnet/use/info/gdb/gdb_9.html#SEC54

Discusses "Artificial arrays"

It is often useful to print out several successive objects of the same type in memory;...

like image 177
Anycorn Avatar answered Oct 20 '22 01:10

Anycorn