1、
whatis 变量名:查看变量类型 或者函数名
(gdb) whatis errnu
type = dk_auth_errnum
(gdb) whatis cert
type = char [233]
(gdb) whatis process_dkauth_cert_mgr_add_dk_evt
type = dk_auth_errnum (req_msg_srv_ct_key_dkauth_adddk_t *, reply_msg_srv_ct_key_dkauth_adddk_t *)
2、
ptype 变量名或者函数名
(gdb) ptype errnu
type = unsigned short
(gdb) ptype dk_ecc_cert_key
type = struct _SCerInformation {
uint8_t uCerSerialNum[40];
uint8_t uSerialLen;
uint8_t uKeyInformation[256];
uint8_t uCertSubject[256];
uint32_t uKeyLen;
}
(gdb)
type = struct _SCerInformation {
uint8_t uCerSerialNum[40];
uint8_t uSerialLen;
uint8_t uKeyInformation[256];
uint8_t uCertSubject[256];
uint32_t uKeyLen;
}
(gdb) ptype process_dkauth_cert_mgr_add_dk_evt
type = unsigned short (req_msg_srv_ct_key_dkauth_adddk_t *, reply_msg_srv_ct_key_dkauth_adddk_t *)
3、
ptype /o 结构体变量名:查看结构体成员的大小和偏移量
(gdb) ptype /o dk_ecc_cert_key
type = struct _SCerInformation {
/* 0 | 40 */ uint8_t uCerSerialNum[40];
/* 40 | 1 */ uint8_t uSerialLen;
/* 41 | 256 */ uint8_t uKeyInformation[256];
/* 297 | 256 */ uint8_t uCertSubject[256];
/* XXX 3-byte hole */
/* 556 | 4 */ uint32_t uKeyLen;
/* total size (bytes): 560 */
}
(gdb)
4、
info variables 变量名关键字 : 会找到所有包含变量名关键字定义的地方
(gdb) info variables g_certMgr
All variables matching regular expression "g_certMgr":
File /home/jintao/cvf-integration/apps/cvf/services/dkauth/src/dkauth_cert_mgr.c:
51: static sCertMgr_t g_certMgr;
(gdb)