Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swoole/yasd
Yet Another Swoole Debugger
https://github.com/swoole/yasd
php php-fpm swoole swoole-debugger
Last synced: 2 months ago
JSON representation
Yet Another Swoole Debugger
- Host: GitHub
- URL: https://github.com/swoole/yasd
- Owner: swoole
- License: apache-2.0
- Created: 2020-12-02T10:06:54.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-24T01:38:26.000Z (almost 2 years ago)
- Last Synced: 2024-08-03T20:05:29.183Z (6 months ago)
- Topics: php, php-fpm, swoole, swoole-debugger
- Language: PHP
- Homepage: https://huanghantao.github.io/yasd-wiki/
- Size: 326 KB
- Stars: 356
- Watchers: 11
- Forks: 35
- Open Issues: 10
-
Metadata Files:
- Readme: README-CN.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swoole - yasd - Yet Another Swoole Debugger, developed by [codinghuang](https://github.com/huanghantao) from the Swoole team. It's no longer actively maintained, and only works with lower versions of Swoole (Swoole < 5.0) and PHP (PHP <= 8.0). Please use _Xdebug_ instead for latest versions of Swoole and PHP. (Debugging and Profiling)
README
[English](./README.md) | 中文
# yasd
另一个 Swoole 调试器。[文档](https://huanghantao.github.io/yasd-wiki/)
## 如何使用它
**注意:如果你使用Swoole\Server,请把`worker_num`设置为1,否则断点可能不会生效。**
### 安装
你需要先安装`boost`库。
macOS:
```bash
brew install boost
```Ubuntu:
```bash
apt-get install libboost-all-dev
```CentOS:
```bash
yum install boost boost-devel
``````bash
phpize --clean && \
phpize && \
./configure && \
make clean && \
make && \
make install
```设置 php.ini 文件:
```ini
zend_extension=yasd
```查看扩展信息:
```bash
php --ri yasd
```### IDE 模式调试
```ini
zend_extension=yasd
yasd.debug_mode=remote
yasd.remote_host=127.0.0.1
yasd.remote_port=9000
```
### cmd 模式调试```ini
zend_extension=yasd
yasd.debug_mode=cmd
```所有命令都支持优先级模糊匹配。
如`li`、`lis`、`list`都等于`l`,查看源码
### 开始调试
```bash
php -e test.php
```### 查看源码 list
```bash
l
```#### 设置断点
```bash
b 文件的绝对路径 需要断点的行号
```默认会将断点信息保存在缓存文件 `.breakpoints_file.log` 中;
你也可以通过修改 php.ini 指定此文件名,如:
```ini
yasd.breakpoints_file=yasd.log
```如果缓存文件存在,当启动调试时,文件中的断点信息会被自动加载;
#### 删除断点 delete
```bash
d 文件的绝对路径 断点所在的行号
```如果设置或者删除断点时,不指定文件绝对路径,默认是当前停留的文件。
#### 监视点 watch
我们可以监控变量变化或条件,例如:
```cpp
watch a
``````cpp
watch a > 10
``````cpp
watch name == swoole
```#### 运行 run
```bash
r
```#### 下一步 step over
```bash
n
```遇到函数的时候,不会进入函数内部
#### 下一步 step into
```bash
s
```遇到函数的时候,会进入函数内部
#### 跳出当前函数 finish
```bash
f
```#### 查看调用栈
```bash
bt
```#### 查看所有断点信息 info
```bash
i
```#### 继续运行 continue
```bash
c
```#### 退出 quit
```bash
q
```#### 打印变量 print
```bash
p
```变量名字不需要带`$`,例如:
```bash
p a
p this
p this->prop
```#### 查看当前所在的协程 level
```bash
le
```