nginx 网络连接

gdb调试nginx

attach 工作进程号

ab -c 1 -n 1 127.0.0.1:80/

加好断点:

b ngx_http_wait_request_handler

b ngx_event_accept

(gdb) info break
Num     Type           Disp Enb Address            What
6       breakpoint     keep y   0x000000000041cffc in ngx_event_accept at src/event/ngx_event_accept.c:62
        breakpoint already hit 12 times
7       breakpoint     keep y   0x0000000000434ed9 in ngx_http_wait_request_handler at src/http/ngx_http_request.c:378
 

建立连接:

#0  ngx_event_accept (ev=0xe49230) at src/event/ngx_event_accept.c:62
#1  0x0000000000425b4e in ngx_epoll_process_events (cycle=0xe2a4e0, timer=, flags=) at src/event/modules/ngx_epoll_module.c:827
#2  0x000000000041c7aa in ngx_process_events_and_timers (cycle=cycle@entry=0xe2a4e0) at src/event/ngx_event.c:247
#3  0x0000000000423694 in ngx_worker_process_cycle (cycle=cycle@entry=0xe2a4e0, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:767
#4  0x0000000000421f03 in ngx_spawn_process (cycle=cycle@entry=0xe2a4e0, proc=proc@entry=0x4235a0 , data=data@entry=0x0, name=name@entry=0x47be86 "worker process",
    respawn=respawn@entry=-3) at src/os/unix/ngx_process.c:198
#5  0x00000000004237f8 in ngx_start_worker_processes (cycle=cycle@entry=0xe2a4e0, n=1, type=type@entry=-3) at src/os/unix/ngx_process_cycle.c:357
#6  0x00000000004242e8 in ngx_master_process_cycle (cycle=cycle@entry=0xe2a4e0) at src/os/unix/ngx_process_cycle.c:129
#7  0x00000000004043a9 in main (argc=, argv=) at src/core/nginx.c:419
 

接受数据:

(gdb) bt
#0  ngx_http_mytest_module_handler (r=0x716550) at /home/lili/nginx-1.13.7/nginx-test-mp-module/nginx_test_memory_module.c:92
#1  0x000000000043c035 in ngx_http_core_content_phase (r=0x716550, ph=) at src/http/ngx_http_core_module.c:1162
#2  0x000000000043707e in ngx_http_core_run_phases (r=r@entry=0x716550) at src/http/ngx_http_core_module.c:851
#3  0x000000000043718d in ngx_http_handler (r=r@entry=0x716550) at src/http/ngx_http_core_module.c:834
#4  0x000000000043eb57 in ngx_http_process_request (r=r@entry=0x716550) at src/http/ngx_http_request.c:1948
#5  0x0000000000440d4c in ngx_http_process_request_headers (rev=rev@entry=0x72e790) at src/http/ngx_http_request.c:1375
#6  0x000000000044100c in ngx_http_process_request_line (rev=rev@entry=0x72e790) at src/http/ngx_http_request.c:1048
#7  0x0000000000441726 in ngx_http_wait_request_handler (rev=0x72e790) at src/http/ngx_http_request.c:506
#8  0x0000000000433ee4 in ngx_epoll_process_events (cycle=, timer=, flags=) at src/event/modules/ngx_epoll_module.c:902
#9  0x000000000042b5b1 in ngx_process_events_and_timers (cycle=cycle@entry=0x70b4e0) at src/event/ngx_event.c:242
#10 0x0000000000431e4c in ngx_worker_process_cycle (cycle=cycle@entry=0x70b4e0, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:749
#11 0x00000000004308cb in ngx_spawn_process (cycle=cycle@entry=0x70b4e0, proc=proc@entry=0x431ddb , data=data@entry=0x0, name=name@entry=0x4ac4bf "worker process",
    respawn=respawn@entry=-3) at src/os/unix/ngx_process.c:198
#12 0x0000000000431fbc in ngx_start_worker_processes (cycle=cycle@entry=0x70b4e0, n=1, type=type@entry=-3) at src/os/unix/ngx_process_cycle.c:358
#13 0x0000000000432890 in ngx_master_process_cycle (cycle=cycle@entry=0x70b4e0) at src/os/unix/ngx_process_cycle.c:130
#14 0x000000000040dde6 in main (argc=, argv=) at src/core/nginx.c:381
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值