summaryrefslogtreecommitdiff
path: root/server/debugger.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-06-05 11:15:49 +0800
committersumneko <sumneko@hotmail.com>2019-06-05 11:15:49 +0800
commitda83f37c216757814935f4deb313c9f066880996 (patch)
treec8828ddb57d63df9f8b5000c172e46ea376f02f6 /server/debugger.lua
parent0148fa046059f8963fc2f2aec47979ce27914eaf (diff)
downloadlua-language-server-da83f37c216757814935f4deb313c9f066880996.zip
启动调试器
Diffstat (limited to 'server/debugger.lua')
-rw-r--r--server/debugger.lua20
1 files changed, 12 insertions, 8 deletions
diff --git a/server/debugger.lua b/server/debugger.lua
index c14cfaea..76266313 100644
--- a/server/debugger.lua
+++ b/server/debugger.lua
@@ -34,18 +34,22 @@ table.sort(luaDebugs, function (a, b)
end)
local debugPath = extensionPath / luaDebugs[1]
-local cpath = "runtime/win64/lua54/?.dll"
-local path = "script/?.lua"
+local cpath = "/runtime/win64/lua54/?.dll"
+local path = "/script/?.lua"
-package.cpath = package.cpath .. ';' .. (debugPath / cpath):string()
+package.cpath = package.cpath .. ';' .. debugPath:string() .. cpath
local function tryDebugger()
local rdebug = require "remotedebug"
- local entry = package.searchpath('start_debug', (debugPath / path):string())
- local dbg = loadfile(entry)(rdebug, debugPath:string() .. '/', path, cpath)
- local port = "11411"
- dbg:start("listen:127.0.0.1:" .. port, true)
- log.debug('Debugger startup, listen port:', port)
+ local entry = package.searchpath('start_debug', debugPath:string() .. path)
+ local root = debugPath:string()
+ local pid = "11411"
+ local addr = ("@%s/runtime/tmp/pid_%s.tmp"):format(root, pid)
+ local dbg = loadfile(entry)(rdebug, root, path, cpath)
+ debug.getregistry()["lua-debug"] = dbg
+ dbg:start(addr, true)
+ log.debug('Debugger startup, listen port:', pid)
+ log.debug('Args:', addr, rdebug, root, path, cpath)
end
xpcall(tryDebugger, log.debug)