1、b 设置断点
usage 1: b 函数名
usage 2: b 文件名:行号
2、rb 函数名关键字 : 所有带有这个关键字的函数名都设置为断点
(gdb) rb dkauth
Breakpoint 7 at 0x34187ae0: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 58.
void dkauth_extra_deinitialization();
Breakpoint 8 at 0x34187aae: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 50.
void dkauth_extra_initialization();
Breakpoint 9 at 0x34187fd6: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 455.
void notify_srv_ct_key_dkauth_notifyfromdkauth_buffer_available(const sm_comp_inst_id_t);
Breakpoint 10 at 0x34187fd4: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 443.
void process_msg_on_request_srv_ct_key_dkauth_adddigitalkeycert(req_msg_srv_ct_key_dkauth_adddigitalkeycert_t *, reply_msg_srv_ct_key_dkauth_adddigitalkeycert_t *);
Breakpoint 11 at 0x34187fc6: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 407.
void process_msg_on_request_srv_ct_key_dkauth_adddk(req_msg_srv_ct_key_dkauth_adddk_t *, reply_msg_srv_ct_key_dkauth_adddk_t *);
Breakpoint 12 at 0x34187f92: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 388.
void process_msg_on_request_srv_ct_key_dkauth_clearallsessions(req_msg_srv_ct_key_dkauth_clearallsessions_t *, reply_msg_srv_ct_key_dkauth_clearallsessions_t *);
Breakpoint 13 at 0x34187f60: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 378.
void process_msg_on_request_srv_ct_key_dkauth_clearsessionbyid(req_msg_srv_ct_key_dkauth_clearsessionbyid_t *, reply_msg_srv_ct_key_dkauth_clearsessionbyid_t *);
Breakpoint 14 at 0x34187b08: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 65.
void process_msg_on_request_srv_ct_key_dkauth_createsession(req_msg_srv_ct_key_dkauth_createsession_t *, reply_msg_srv_ct_key_dkauth_createsession_t *);
Breakpoint 15 at 0x34187fcc: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 422.
void process_msg_on_request_srv_ct_key_dkauth_findkeys(req_msg_srv_ct_key_dkauth_findkeys_t *, reply_msg_srv_ct_key_dkauth_findkeys_t *);
Breakpoint 16 at 0x34187f2e: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 368.
void process_msg_on_request_srv_ct_key_dkauth_findsessionbyid(req_msg_srv_ct_key_dkauth_findsessionbyid_t *, reply_msg_srv_ct_key_dkauth_findsessionbyid_t *);
Breakpoint 17 at 0x34187fc2: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 396.
void process_msg_on_request_srv_ct_key_dkauth_findsessionwithtoppriority(req_msg_srv_ct_key_dkauth_findsessionwithtoppriority_t *, reply_msg_srv_ct_key_dkauth_findsessionwithtoppriority_t *);
Breakpoint 18 at 0x34187e20: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 269.
void process_msg_on_request_srv_ct_key_dkauth_getchallengereq(req_msg_srv_ct_key_dkauth_getchallengereq_t *, reply_msg_srv_ct_key_dkauth_getchallengereq_t *);
Breakpoint 19 at 0x34187f2a: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 361.
void process_msg_on_request_srv_ct_key_dkauth_getcommandreq(req_msg_srv_ct_key_dkauth_getcommandreq_t *, reply_msg_srv_ct_key_dkauth_getcommandreq_t *);
Breakpoint 20 at 0x34187fd0: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 432.
void process_msg_on_request_srv_ct_key_dkauth_getdkblacklist(req_msg_srv_ct_key_dkauth_getdkblacklist_t *, reply_msg_srv_ct_key_dkauth_getdkblacklist_t *);
Breakpoint 21 at 0x34187fce: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 427.
void process_msg_on_request_srv_ct_key_dkauth_getdkwhitelist(req_msg_srv_ct_key_dkauth_getdkwhitelist_t *, reply_msg_srv_ct_key_dkauth_getdkwhitelist_t *);
Breakpoint 22 at 0x34187b8a: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth.c, line 106.
void process_msg_on_request_srv_ct_key_dkauth_getexchangedkcertreq(req_msg_srv_ct_key_dkauth_getexchangedkcertreq_t *, reply_msg_srv_ct_key_dkauth_getexchangedkcertreq_t *);
3、条件断点
(gdb) b dkauth_mgr.c:139 if lop==1
Breakpoint 5 at 0x3418b584: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth_mgr.c, line 139.
或者
(gdb) b dkauth_mgr.c:61 if g_dkAuthMgr.keySessionMgr.keyAuthSession[0].authSession.dk_key_id[0]=='K'
4 、临时断点: tb
(gdb) tb dkauth_mgr.c:149
Temporary breakpoint 9 at 0x3418b7ae: file /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth_mgr.c, line 149.
5、查看某个断点的信息: info b 断点号
(gdb) info b 11
Num Type Disp Enb Address What
11 breakpoint keep y 0x3418b55c in load_vehicle_info at /home/jintao/cvf/apps/cvf/services/dkauth/src/dkauth_mgr.c:134
breakpoint already hit 1 time
6、禁用/使能某个断点 : disable 断点号 enable 断点号
7、删除所有断点: delete
8、info locals :打印本函数的局部变量
(gdb) info locals
errnu = 0
lop = <optimized out>