mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
remote debugger
This commit is contained in:
28
service/debug_agent.lua
Normal file
28
service/debug_agent.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local skynet = require "skynet"
|
||||
local debugchannel = require "debugchannel"
|
||||
|
||||
local CMD = {}
|
||||
|
||||
local channel
|
||||
|
||||
function CMD.start(address, fd)
|
||||
assert(channel == nil, "start more than once")
|
||||
skynet.error(string.format("Attach to :%08x", address))
|
||||
local handle
|
||||
channel, handle = debugchannel.create()
|
||||
skynet.call(address, "debug", "REMOTEDEBUG", fd, handle)
|
||||
-- todo hook
|
||||
skynet.ret(skynet.pack(nil))
|
||||
skynet.exit()
|
||||
end
|
||||
|
||||
function CMD.cmd(cmdline)
|
||||
channel:write(cmdline)
|
||||
end
|
||||
|
||||
skynet.start(function()
|
||||
skynet.dispatch("lua", function(_,_,cmd,...)
|
||||
local f = CMD[cmd]
|
||||
f(...)
|
||||
end)
|
||||
end)
|
||||
Reference in New Issue
Block a user