[TODO 不好用] gdb使用调用栈作为断点条件的方法

(gdb) bt
#0  ngx_ssl_engine_qat_heuristic_poll (log=0x55a4ee0d3670) at modules/nginx_qat_module/ngx_ssl_engine_qat_module.c:694
#1  0x000055a4eba43791 in ngx_ssl_async_process_fds (c=0x7f2e19705db8) at src/event/ngx_event_openssl.c:1675
#2  0x000055a4eba47817 in ngx_ssl_shutdown (c=0x7f2e19705db8) at src/event/ngx_event_openssl.c:3169
#3  0x000055a4eba6b267 in ngx_http_close_connection (c=0x7f2e19705db8) at src/http/ngx_http_request.c:4096
#4  0x000055a4eba6a131 in ngx_http_keepalive_handler (rev=0x7f2e13053098) at src/http/ngx_http_request.c:3578
#5  0x000055a4eba28d05 in ngx_event_expire_timers () at src/event/ngx_event_timer.c:94
#6  0x000055a4eba260c5 in ngx_process_events_and_timers (cycle=0x55a4ed9fc610) at src/event/ngx_event.c:266
#7  0x000055a4eba395f0 in ngx_worker_process_cycle (cycle=0x55a4ed9fc610, data=0x0) at src/os/unix/ngx_process_cycle.c:769
#8  0x000055a4eba353bb in ngx_spawn_process (cycle=0x55a4ed9fc610, proc=0x55a4eba394aa <ngx_worker_process_cycle>, data=0x0, name=0x55a4ebb84103 "worker process", respawn=1) at src/os/unix/ngx_process.c:199
#9  0x000055a4eba38fa5 in ngx_reap_children (cycle=0x55a4ed9fc610) at src/os/unix/ngx_process_cycle.c:633
#10 0x000055a4eba37873 in ngx_master_process_cycle (cycle=0x55a4ed9fc610) at src/os/unix/ngx_process_cycle.c:177
#11 0x000055a4eb9ec700 in main (argc=3, argv=0x7ffd31c76538) at src/core/nginx.c:389

这样断:

(gdb) 
719             else
720                 threshold = qat_engine_heuristic_poll_sym_threshold;
721
722             if (*num_asym_requests_in_flight + *num_kdf_requests_in_flight
723                 + *num_cipher_requests_in_flight + *num_asym_mb_items_in_queue
724                 + *num_kdf_mb_items_in_queue + *num_sym_mb_items_in_queue
725                 >= threshold) {
726                 qat_engine_poll(log);
727                 num_heuristic_poll ++;
728             }
(gdb) b 722 if $_caller_is("ngx_ssl_async_process_fds")
Breakpoint 2 at 0x7f2e3976477b: file modules/nginx_qat_module/ngx_ssl_engine_qat_module.c, line 722.
(gdb) 

参考: https://stackoverflow.com/questions/5336403/is-there-any-way-to-set-a-breakpoint-in-gdb-that-is-conditional-on-the-call-stac

原文地址:https://www.cnblogs.com/hugetong/p/14913599.html