remote debugger

This commit is contained in:
Cloud Wu
2015-02-09 23:40:54 +08:00
parent 62e70ef755
commit 498f634ac5
8 changed files with 759 additions and 6 deletions

28
service/debug_agent.lua Normal file
View 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)