nginx - how can I combine two different gdb commands “info symbol” and “ptype” into single one? -
in other words,is there command can find symbol @ address meanwhile use ptype show symbol‘s detail info ? or if there not, how can write user-define command meet needs ?
for example, can firstly data struct‘s name (ngx_errlog_module_ctx) in address use “info symbol” command, use ptype show data struct’s detail info this:
(gdb) info symbol 0x80b4568 ngx_errlog_module_ctx in section .data of /usr/local/nginx/sbin/nginx (gdb) ptype ngx_errlog_module_ctx type = struct { ngx_str_t name; void *(*create_conf)(ngx_cycle_t *); char *(*init_conf)(ngx_cycle_t *, void *); }
but now, how can write user-difined command (ptype_with_address) can use :
ptype_with_address 0x80b4568 ngx_errlog_module_ctx in section .data of /usr/local/nginx/sbin/nginx type = struct { ngx_str_t name; void *(*create_conf)(ngx_cycle_t *); char *(*init_conf)(ngx_cycle_t *, void *); }
i want because research nginx’s code,i want write user-defined command show ngx_modules's detail info, include each module's ctx member variable.
can write user-define command meet need
if have reasonably recent version of gdb, should able use built-in python interpreter achieve goal.
unfortunately, doesn't can gdb.symbol
address, need symbol name. in other words, doesn't info symbol
exposed python interpreter in gdb.
i suggest filing feature request in bugzilla extend gdb.lookup_global_symbol
accept address.
googling "gdb python info symbol" revealed thread, in tom tromey (gdb developer) asked file bugzilla issue, , suggested workaround.
Comments
Post a Comment