nginx源码还是仔细读吧,使用gdb长期跟踪,笔记放在这
[code="java"]
# ps -ef|grep nginx
root 20738 1 0 Apr29 ? 00:00:00 nginx: master process ./nginx
nobody 20739 20738 0 Apr29 ? 00:00:00 nginx: worker process
gdb
attach 20738 主
l
bt
#0 0x00803416 in __kernel_vsyscall ()
#1 0x4c74dd47 in do_sigsuspend (set=0xbfaa5fe8) at ../sysdeps/unix/sysv/linux/sigsuspend.c:63
#2 __GI___sigsuspend (set=0xbfaa5fe8) at ../sysdeps/unix/sysv/linux/sigsuspend.c:74
#3 0x0806e887 in ngx_master_process_cycle ()
#4 0x0804a76d in main ()
# cd src/
# ls
core event http mail misc os
# grep -R "ngx_master_process_cycle" *
core/nginx.c: ngx_master_process_cycle(cycle);
os/unix/ngx_process_cycle.c:ngx_master_process_cycle(ngx_cycle_t *cycle)
os/unix/ngx_process_cycle.h:void ngx_master_process_cycle(ngx_cycle_t *cycle);
#
root@localhost src]# grep -nR "main(" *
core/nginx.c:200:main(int argc, char *const *argv)
[/code]
vim 配置
ctags -R -f ~/nginxtags /root/nginx-1.3.0/ /usr/include/ /usr/src
gdb参考http://oss.org.cn/ossdocs/gnu/linux/gdb.html
[code="java"]
# ps -ef|grep nginx
root 20738 1 0 Apr29 ? 00:00:00 nginx: master process ./nginx
nobody 20739 20738 0 Apr29 ? 00:00:00 nginx: worker process
gdb
attach 20738 主
l
bt
#0 0x00803416 in __kernel_vsyscall ()
#1 0x4c74dd47 in do_sigsuspend (set=0xbfaa5fe8) at ../sysdeps/unix/sysv/linux/sigsuspend.c:63
#2 __GI___sigsuspend (set=0xbfaa5fe8) at ../sysdeps/unix/sysv/linux/sigsuspend.c:74
#3 0x0806e887 in ngx_master_process_cycle ()
#4 0x0804a76d in main ()
# cd src/
# ls
core event http mail misc os
# grep -R "ngx_master_process_cycle" *
core/nginx.c: ngx_master_process_cycle(cycle);
os/unix/ngx_process_cycle.c:ngx_master_process_cycle(ngx_cycle_t *cycle)
os/unix/ngx_process_cycle.h:void ngx_master_process_cycle(ngx_cycle_t *cycle);
#
root@localhost src]# grep -nR "main(" *
core/nginx.c:200:main(int argc, char *const *argv)
[/code]
vim 配置
ctags -R -f ~/nginxtags /root/nginx-1.3.0/ /usr/include/ /usr/src
gdb参考http://oss.org.cn/ossdocs/gnu/linux/gdb.html