Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

gdb

People also ask

How to use gdb to find core dump?

You just need a binary (with debugging symbols included) that is identical to the one that generated the core dump file. Then you can run gdb path/to/the/binary path/to/the/core/dump/file to debug it. When it starts up, you can use bt (for backtrace) to get a stack trace from the time of the crash.

What does gdb print do?

The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect . It evaluates and prints the value of an expression of the language your program is written in (see section Using GDB with Different Languages).

Which gdb command is used to determine the variable in C?

gdb: show typeinfo of some data.


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

print sizeof(var)
print sizeof(Type)