How do I show what fields a struct has in GDB?
You can use the GDB command ptype
to print out the definition of a struct or class.
Additionally, use ptype /o
to print offsets and sizes of all fields in a struct (like pahole).
If you have debugging symbols built in, you should just be able to print the value: print variable
or print *variable
if it's a pointer to a struct.