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] bu开发者_高级运维t 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?
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;...
If s->a
has type char [0]
(which is a gcc extension), but you know it is really an array of 100, you can use casts in gdb
to print it:
(gdb) print *(char (*)[100])&s->a
See 10.4 Artificial Arrays
:
(gdb) p *argv@argc
精彩评论