How to list struct information in 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 type开发者_StackOverflow社区def 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?
Try ptype ngx_http_request_t
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.
You can print the value of the variable declared with that type:
ngx_http_request_t foo;
(gdb) print foo
精彩评论