-
Notifications
You must be signed in to change notification settings - Fork 95
如何接入其他非lua的lua环境
fesily edited this page Apr 6, 2023
·
2 revisions
如果能修改兼容-e命令,在环境中执行指定lua代码段,请转到下面
可以在lua脚本中直接attach来连接调试器即可. 如果lua脚本中不支持加载动态库的,可以有使用以下方法:
导出lua符号表的比较简单,可以使用attach或者launch来挂载调试器
{
"name": "launch process",
"request": "launch",
"runtimeArgs": "${workspaceFolder}/main.lua",
"runtimeExecutable": "${workspaceFolder}/aa.exe",
"stopOnEntry": true,
"type": "lua",
"inject": "lldb", //根据平台使用lldb/gdb/hook,主要为了注入launch动态库来挂载调试器
"luaVersion": "5.1",
}
{
"name": "attach",
"processName": "lua", //或者使用processid
"request": "attach",
"stopOnEntry": true,
"type": "lua",
"inject": "lldb",
}
TODO:
以下以busted测试框架为例
{
"type": "lua",
"request": "launch",
"name": "Debug",
"program": "${workspaceFolder}/t/save-database.lua",
"luaexe": "resty",
"luaArch": "arm64",
"luaVersion": "jit",
"path": "${workspaceFolder}/?.lua",
"cpath": "${workspaceFolder}/?.so"
}
主要设置luaexe,luaArch,luaVersion三个参数即可.