How do I show what fields a struct has in GDB?

前端 未结 7 1553
不知归路
不知归路 2020-12-22 23:31

I came upon a struct (called ngx_http_variable_value_t) in my GDB (debugger) session and I would like to print what fields it has in the console.

Is tha

7条回答
  •  被撕碎了的回忆
    2020-12-23 00:19

    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).

提交回复
热议问题