日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux下 如何调试php,linux下使用gdb对php源码调试

發(fā)布時間:2023/12/10 linux 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下 如何调试php,linux下使用gdb对php源码调试 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

title: linux下使用gdb對php源碼調試

date: 2018-02-11 17:59:08

tags:

---

linux下使用gdb進行php調試

調試了一些php的漏洞,記錄一下大概的過程

安裝編譯php

sudo apt-get install -y autoconf libtool re2c libxml2-dev openssl libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng12-dev libfreetype6-dev libldap2-dev libmcrypt-dev libmysqlclient-dev libxslt1-dev libxt-dev libpcre3-dev libxpm-dev libt1-dev libgmp-dev libpspell-dev librecode-dev libreadline6-dev bison libtidy-dev

sudo ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/

sudo ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/

sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

./buildconf

./configure --enable-opcache --enable-fpm --enable-pdo --enable-sockets --enable-exif --enable-soap --enable-ftp --enable-wddx --enable-pcntl --enable-soap --enable-bcmath --enable-mbstring --enable-dba --enable-gd-native-ttf --enable-gd-jis-conv --enable-zip --enable-calendar --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-mysqli --with-pdo-mysql --with-pdo-sqlite --with-iconv --with-gmp --with-pspell --with-gettext --with-xmlrpc --with-openssl --with-mhash --with-mcrypt --with-xsl --with-curl --with-pcre-regex --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr --with-recode=/usr --with-ldap --with-pear --with-readline --with-fpm-user=bigric3 --with-fpm-group=bigric3

make

sudo make install

驗證安裝:

leej@ubuntu:~$ php -v

PHP 7.0.0 (cli) (built: Jan 29 2018 19:58:16) ( NTS )

Copyright (c) 1997-2015 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

gdb的調試方法

1.設置命令行參數(shù):

2.顯示代碼:list 簡寫l 可以指定行數(shù)(list 5,10)

3.layout:框框圈起來看代碼

4.打印變量:print 簡寫p 加變量(print i)/info reg打印寄存器/

5.設置斷點:b 行數(shù)或函數(shù)名

6.查看斷點:info b

7.刪除斷點:d 斷點號(info中的num)

8.運行:run 簡寫r

9.單步調試step over:n(ext)

10.單步調試step in:s(tep)

11.運行到斷點處:c(ontinue)

具體參考:參考一,參考二

確定上層php函數(shù)名在底層調用函數(shù)

leej@ubuntu:~/php/php-7.0.0$ nm sapi/cli/php|grep imagecreatefromgif

0000000001106fc0 d arginfo_imagecreatefromgif

00000000005b50b0 t zif_imagecreatefromgif

開始調試

略...

主要記錄環(huán)境搭建,具體調試不同的cve,這部分自由發(fā)揮吧

總結

以上是生活随笔為你收集整理的linux下 如何调试php,linux下使用gdb对php源码调试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。