Can GDB print the size of structures from a core dump of a C program?

后端 未结 2 705
后悔当初
后悔当初 2021-01-07 17:29

I\'m using GDB to analyze a core dump of a C program. Is it possible to print the size of a struct in the program?

2条回答
  •  暖寄归人
    2021-01-07 18:00

    These should all work in GDB (assuming you compiled with -g):

    print sizeof(var)
    print sizeof(Type)
    

提交回复
热议问题