如何在gdb中列出结构体信息?
我可以检查非结构类型,但是在检查结构时,总是得到“Function“struct”未定义。
”:
(gdb) l ngx_http_request_t
10
11 #include <ngx_config.h>
12 #include <ngx_core.h>
13
14
15 typedef struct ngx_http_request_s ngx_http_request_t;
16 typedef struct ngx_http_upstream_s ngx_http_upstream_t;
17 typedef struct ngx_http_cache_s ngx_http_cache_t;
18 typedef struct ngx_http_file_cache_s ngx_http_file_cache_t;
19 typedef struct ngx_http_log_ctx_s ngx_http_log_ctx_t;
(gdb) l struct ngx_http_request_s
Function "struct" not defined.
在gdb中可能吗?
I can check non-struct types,but when checking struct,always getting a "Function "struct" not defined.
":
(gdb) l ngx_http_request_t
10
11 #include <ngx_config.h>
12 #include <ngx_core.h>
13
14
15 typedef struct ngx_http_request_s ngx_http_request_t;
16 typedef struct ngx_http_upstream_s ngx_http_upstream_t;
17 typedef struct ngx_http_cache_s ngx_http_cache_t;
18 typedef struct ngx_http_file_cache_s ngx_http_file_cache_t;
19 typedef struct ngx_http_log_ctx_s ngx_http_log_ctx_t;
(gdb) l struct ngx_http_request_s
Function "struct" not defined.
Is it possible in gdb?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试 ptype ngx_http_request_t
Try
ptype ngx_http_request_t
l
通常与行号一起使用来查看特定的代码行,尽管它可以与函数名称一起使用。由于
struct
不是行号或函数名,因此您无法查看其定义。您期望什么类型的输出?
看起来您确实想要 struct 中的数据值,这意味着您必须首先创建该类型的结构。
l
is usually used with a line number to view a particular line of code, although it can be used with a function name.Because
struct
is not a line number or a function name, you can not view its definition.What type of output are you expecting?
It looks like you really want the values of the data in the
struct
, meaning you have to create a struct of that type first.您可以打印使用该类型声明的变量的值:
(gdb) print foo
You can print the value of the variable declared with that type:
(gdb) print foo