Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 583 Bytes

1.hao_to_debug_nginx_useing_gdb.md

File metadata and controls

44 lines (36 loc) · 583 Bytes

使用GDB调试Nginx

  • 运行gdb
$ sudo gdb -q -tui
  • 启动nginx(若已经启动则可以忽略)
#和平时启动nginx一样,在前面增加shell表示用shell运行
(gdb) shell nginx
  • attach Nginx worker进程
#找到 Nginx worker进程的进程号
(gdb) shell pidof nginx
(gdb) attach pid
  • 打断点
(gdb) b function_name
  • 开始执行
(gdb) c
  • 单步调试
(gdb) n
  • 单步跟踪进步调试
(gdb) s
  • 删除断点
(gdb) d