【发布时间】:2019-09-18 04:45:53
【问题描述】:
我正在尝试通过控制台使用 GDB 调试 php 脚本,但我无法设置断点。这就是我所做的。 我创建了一个包含以下内容的脚本:
<?php
echo "1";
echo "1";
echo "1";
echo "1";
echo "1";
echo "1";
echo "1";
这是我调试它的诱惑
# gdb php -d CANCELLAMI.php
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
warning: /root/CANCELLAMI.php is not a directory.
Reading symbols from /usr/bin/php...(no debugging symbols found)...done.
现在我在 gdb 中,我在第 2 行放置了一个断点。
(gdb) break CANCELLAMI.php:2
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (CANCELLAMI.php:2) pending.
但如果我运行 CANCELLAMI 脚本
(gdb) run CANCELLAMI.php
Starting program: /usr/bin/php CANCELLAMI.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
11111111[Inferior 1 (process 30216) exited normally]
整个脚本被执行。
【问题讨论】: