gdb: how does it know the variable type and size?
问题 I'm trying to figure this out as I'm trying to do the same thing (hopefully) with a home grown script: Example C code: typedef struct _B { A aa; double b; char c[LEN]; int d; char *a_ptr[10]; } B; B this_b; If I compile this with gcc -g and gdb a.out afterwards, gdb knows exactly what and where a_ptr is: (gdb) p &(this_b.a_ptr) $1 = (char *(*)[10]) 0x804a084 how does it do that? And can I do the same thing (knowing it's address and type) through other utilities? 回答1: When you build with the