zoukankan      html  css  js  c++  java
  • gdb调试SAPI方式的php

     一.修改php-fpm.conf文件

    /usr/local/php/etc/php-fpm.conf

    pm.max_children = 1 #只产生一个进程,便于追踪

    二.得到进行服务的进程号

    [root@default-tpl etc]# ps aux|grep php-fpm
    root 15212 0.0 0.2 190148 3316 ? Ss 17:39 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
    nobody 15224 0.0 0.3 190672 4228 ? S 17:40 0:00 php-fpm: pool www
    root 15322 0.0 0.0 103252 804 pts/0 S+ 17:58 0:00 grep php-fpm

    15212  master process 是监控进程,不用管它

    15224  work process 工作进程,使用它

    #gdb -p 15224  

    (gdb) b /home/php-5.3.25/ext/standard/url.c:566 //主要调用php内核对query_string参数进行decode处理
    Breakpoint 1 at 0x722ec4: file /home/php-5.3.25/ext/standard/url.c, line 566.
    (gdb) c
    Continuing.

    这时再开一个终端,

    执行 curl 'http://10.10.9.154:9002/test.php?age=12345'

    之前的终端,使用s命令,进入函数,进行调试

    (gdb) b /home/php-5.3.25/ext/standard/url.c:566
    Breakpoint 1 at 0x722ec4: file /home/php-5.3.25/ext/standard/url.c, line 566.
    (gdb) c
    Continuing.

    Breakpoint 1, php_url_decode (str=0x2e3be18 "age", len=3) at /home/php-5.3.25/ext/standard/url.c:568
    568 char *dest = str;
    (gdb) s
    569 char *data = str;

  • 相关阅读:
    soa
    最短路径分词
    Collector
    solr params.json
    oracle第一章
    记一次web项目总结
    java.util 类 TreeSet<E>
    自定义jstl标签库
    java二维数组简单初步理解
    Java中Array的常用方法
  • 原文地址:https://www.cnblogs.com/taek/p/4984297.html
Copyright © 2011-2022 走看看