如何显示结构在 GDB 中具有哪些字段? [英] How do I show what fields a struct has in GDB?

查看:10
本文介绍了如何显示结构在 GDB 中具有哪些字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 GDB(调试器)会话中发现了一个结构(称为 ngx_http_variable_value_t),我想打印它在控制台中的字段.

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.

这可能吗?

推荐答案

您可以使用 GDB 命令 ptype 打印出结构或类的定义.

You can use the GDB command ptype to print out the definition of a struct or class.

此外,使用 ptype/o 打印结构中所有字段的偏移量和大小(如 pahole).

Additionally, use ptype /o to print offsets and sizes of all fields in a struct (like pahole).

这篇关于如何显示结构在 GDB 中具有哪些字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆