Suppose defined: int a[100]
Type print a
then gdb will automatically display it as an array:1, 2, 3, 4...
. However, if a
is passed to a function as a parameter, then gdb will treat it as a normal int pointer, type print a
will display:(int *)0x7fffffffdaa0
. What should I do if I want to view a
as an array?
See here. In short you should do:
p *array@len