c - gdb cannot print the contents of array -


i try print contents of array this, , it's successful:

p/x t->arr $1 = {0x63, 0x61, 0x74, 0x31, 0x2e, 0x6a, 0x70, 0x67, 0x0 <repeats 248 times>} 

however, when try different way this:

(gdb) p &t->arr $2 = (char (*)[256]) 0x60c4d0  p/100x *0x60c4d0 item count other 1 meaningless in "print" command. 

t->arr defined arr[256] in struct. do wrong?

in gdb, can cast literal pointer value whatever type think appropriate. so, if want treat address pointer array, can cast such, , print that.

(gdb) p argv $1 = (char **) 0x7fffffffe898 (gdb) p *(char *(*)[2])0x7fffffffe898 $2 = {0x7fffffffeae1 "/tmp/a.out", 0x0} 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -