From fb71d19cf723f4f36a4c18fd5c55e7609ca6a60b Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 30 May 2010 22:47:56 +0000 Subject: added help command to debug shell --- src/debug_shell.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/debug_shell.lua b/src/debug_shell.lua index e8ba6ef..489395a 100644 --- a/src/debug_shell.lua +++ b/src/debug_shell.lua @@ -124,6 +124,7 @@ end debug_shell.exec_cmd = function() log.printf(log.DEBUG, "debug shell: received string: '%s'", debug_shell.buffer) + local ret = 0 local luacode = string.match(debug_shell.buffer, "^!(.*)$"); if(luacode and luacode ~= "") then local chunk = loadstring(luacode) @@ -148,11 +149,17 @@ debug_shell.exec_cmd = function() if(cmd == 'quit') then if(sep and sep ~= "") then return 0 end log.printf(log.INFO, "debug shell: quitting debug session") - return 1 + ret = 1 elseif(cmd == 'terminate') then if(sep and sep ~= "") then return 0 end log.printf(log.NOTICE, "debug shell: terminate command received") - return 2 + ret = 2 + elseif(cmd == 'help') then + if(sep and sep ~= "") then return 0 end + debug_shell.socks[2]:send("! execute lua code\n" .. + "quit quit this debug session\n" .. + "ping[ ] echo request (response will be 'pong[ ]')\n" .. + "terminate terminate the daemon\n") elseif(cmd == 'ping') then if(sep == ' ') then debug_shell.socks[2]:send("pong " .. (param or "") .. "\n") else debug_shell.socks[2]:send("pong\n") end @@ -161,5 +168,5 @@ debug_shell.exec_cmd = function() end end - return 0 + return ret end -- cgit v1.2.3