linux下 如何调试php,linux下使用gdb对php源码调试
title: linux下使用gdb對(duì)php源碼調(diào)試
date: 2018-02-11 17:59:08
tags:
---
linux下使用gdb進(jìn)行php調(diào)試
調(diào)試了一些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
驗(yàn)證安裝:
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的調(diào)試方法
1.設(shè)置命令行參數(shù):
2.顯示代碼:list 簡寫l 可以指定行數(shù)(list 5,10)
3.layout:框框圈起來看代碼
4.打印變量:print 簡寫p 加變量(print i)/info reg打印寄存器/
5.設(shè)置斷點(diǎn):b 行數(shù)或函數(shù)名
6.查看斷點(diǎn):info b
7.刪除斷點(diǎn):d 斷點(diǎn)號(hào)(info中的num)
8.運(yùn)行:run 簡寫r
9.單步調(diào)試step over:n(ext)
10.單步調(diào)試step in:s(tep)
11.運(yùn)行到斷點(diǎn)處:c(ontinue)
具體參考:參考一,參考二
確定上層php函數(shù)名在底層調(diào)用函數(shù)
leej@ubuntu:~/php/php-7.0.0$ nm sapi/cli/php|grep imagecreatefromgif
0000000001106fc0 d arginfo_imagecreatefromgif
00000000005b50b0 t zif_imagecreatefromgif
開始調(diào)試
略...
主要記錄環(huán)境搭建,具體調(diào)試不同的cve,這部分自由發(fā)揮吧
總結(jié)
以上是生活随笔為你收集整理的linux下 如何调试php,linux下使用gdb对php源码调试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 广发信用卡怎么修改账单接收邮箱
- 下一篇: 计算机分数的简便运算,分数的简便运算和分