-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathattach.lua
More file actions
40 lines (36 loc) · 875 Bytes
/
attach.lua
File metadata and controls
40 lines (36 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
local path, pid, version = ...
if _VERSION == nil
or type == nil
or assert == nil
or tostring == nil
or error == nil
or dofile == nil
or io == nil
or os == nil
or debug == nil
or package == nil
or string == nil
then
return "wait initialized"
end
local is_luajit = tostring(assert):match('builtin') ~= nil
if is_luajit and jit == nil then
return "wait initialized"
end
if version == "" then
version = nil
end
local function dofile(filename, ...)
local load = _VERSION == "Lua 5.1" and loadstring or load
local f = assert(io.open(filename))
local str = f:read "*a"
f:close()
return assert(load(str, "=(debugger.lua)"))(...)
end
local dbg = dofile(path.."/script/debugger.lua", path)
dbg:start {
address = ("@%s/tmp/pid_%s"):format(path, pid),
version = version,
}
dbg:event "wait"
return "ok"