openresty debugging

luaIde debugging openresty

Debugging video
extraction code: o3rk

1. Create a project if the project already exists ignored

5576301-5b5c16d948bcd662.png
image.png

2. Create a project src directory

(src目录可是任意名字 示例中将src放入根目录中,您也可以放到其他目录,src目录为lua脚本根目录)
如果已存在项目忽略
5576301-dca678f3fb4944a7.png
image.png

3. Configuration Items

5576301-d1020353ea302c06.png
image.png

The first three steps can be ignored according to their own projects can be set.

Example 4. Open project files project files in the folder to folder vscode openresty_test

5. Open a lua file to start luaide plug (not demo lua file, create a file test.lua)

6. Follow the prompts to copy the debug file to the src directory

选择LuaDebugOpenrestyJit  后缀选择.lua 
由于luaide支持多种lua框架的调试所以会有很多不同的后缀名,openresty 选择.lua即可
这一步操作后 LuaDebugOpenrestyJit.lua 拷贝到src 下
5576301-4456533346eae0c5.png
first step

5576301-59388f57fbbb8864.png
The second step

5576301-bc2875232c12fca1.png
Select the directory to add debug files

5576301-a5457d628d46c5f0.png
openresty

5576301-a2025d9c643082d2.png

5576301-dd4e9f1692432e46.png

7. Click vscode luaide the left button to select [Open luaide latest debug folder where the file]

5576301-3eab26e2d748ce1d.png

5576301-c2859c21ce6d017a.png
Copy files
linux 找到socketLib\OpenResty\linux目录下的 socket.so 拷贝到openresty_test(项目根目录)
mac 找到socketLib\OpenResty\mac目录下的 socket.so 拷贝到openresty_test(项目根目录)
windows 找到socketLib\OpenResty\windows目录下的 socket.so 拷贝到openresty_test\lualib(项目根目录\lualib)

8. Set Script root directory luaide Settings selected configuration (as set Chinese)

搜索luaide.scriptRoots 并进行设置 然后重启vscode
这里注意vscode 的设置配置分为
1.用户设置
2.工作空间设置 示例中添加到了 工作空间设置  设置后重启vscode  f1 reloadwindow
3.文件夹设置
修改配置后重启vscode  f1 reload window
5576301-98fc7ff4810974e7.png
Set the root directory script

9. Add debugging code to start debugging

5576301-86c30a59ad0ffa49.png
image.png

10. Add debug configuration

5576301-8fd50e45102d54ba.png
Adding debug configuration

5576301-96bdd4bdfd3945e0.png
Adding debug lua

5576301-bbb75daf3f2c4af0.png
Select Debug mode

5576301-8be2b322b6121be1.png
Start Debugging

11. Start Debugging -p nginx pwd/ -c conf / nginx.conf (start the debugger to start their own projects according to their own situation. Here are just demo)

12. Access page

5576301-5551ffc2b310a879.png
image.png

Debug Demo end!

Reproduced in: https: //www.jianshu.com/p/070870d43368

Guess you like

Origin blog.csdn.net/weixin_33716557/article/details/91211987