Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lua Development Tools » Debug though co-routines
Debug though co-routines [message #1387613] Wed, 25 June 2014 10:28 Go to next message
Luca Ghezzi is currently offline Luca Ghezzi
Messages: 4
Registered: June 2014
Junior Member
Hello,
I'm trying to debug with koneki the code of one of the examples of Orbit MVC Framework in order to understand how to debug my web application.

github.com/keplerproject/orbit/tree/master/samples

I'm using Xavante web server which uses WSAPI to launch the "Blog" sample.

My problem is that I only can debug the xavante launcher; when WSAPI creates a co-routine I'm not able to break into the blog application.
I think the problem is due to the cration of a new LUA state, dedicated to the "blog" wb app, when the co-routine is created.
Both the solutions of local and attached debug don't work. In case of local debug my application seems to break on the first breakpoint, but I don't see it (only using print in the code) and I can't control the debug session.

I also tried with AKdebugger, but the behavior is very similar...

This is my "start.lua" code, the Xavante launcher:

require "xavante"
require "xavante.filehandler"
require "xavante.redirecthandler"
require "wsapi.xavante"

-- Define here where Xavante HTTP documents scripts are located
local webDir = "."

local simplerules = {
    { -- URI remapping example
        match = "^[^%./]*/$",
        with = xavante.redirecthandler,
        params = {"blog.ws"}
    },
    { 
        match = {"%.ws$", "%.ws/.*$" },
        with = wsapi.xavante.makeGenericHandler (webDir)
    },
    { -- filehandler example
        match = ".",
        with = xavante.filehandler,
        params = {baseDir = webDir}
    },

}
xavante.HTTP{
    server = {host = "*", port = 8080},
    defaultHost = {
        rules = simplerules
    },
}
xavante.start()



I'm wrong in something? I'm a newbie in LUA... Very Happy
Can anyone help me?

Thank you very much.
Luca
Re: Debug though co-routines [message #1388259 is a reply to message #1387613] Thu, 26 June 2014 07:30 Go to previous messageGo to next message
Marc Aubry is currently offline Marc Aubry
Messages: 78
Registered: August 2012
Member
Hi Luca,

I don't know anythings about WSAPI and Xvante, but here some information about LDT:

-You need to start a debug session for each LuaState, so if your framework start several LuaState, you may bootstrap the debugger in each state.

-The debugger support only the standard co-courtine and luasocket. If you use another socket implementation, you should have to implement your own transportation layer.

-Using LDT 1.2 we have added basic logging in the debugger and also there is an option in the Debug Configurations to see DBGP protocol logging to see what happens. If previous information doesn't help you, please provide us theses logs to investigate further.

Marc
Re: Debug though co-routines [message #1388328 is a reply to message #1388259] Thu, 26 June 2014 09:23 Go to previous messageGo to next message
Luca Ghezzi is currently offline Luca Ghezzi
Messages: 4
Registered: June 2014
Junior Member
Hi Marc, thank you for the answer!
I'm using the standard LuaSocket in Lua for Windows.

Using the attached debugger I can see an execution break in the web application new LUA state, but I'm not able to see where I am in the code.

As you can see in my attached screeshot, I added the
require "debugger"()
code at the first line of blog web application and I have set a breakpoint in the same lua script (line 12).

My operations are:
- Launch the Debugger with default paramenters (host, port, idekey)
- Run the start.lua file in order to start the Xavante Web server
- Generate an HTTP request in order to trigger the creation of the new LUA state
- The debugger correctly attach to the running application
- The execution breaks at the breakpoint, but I don't see where...only with the "before" and "after" prints I can understand where the break is.

i61.tinypic.com/iwkc1w.jpg (Sorry! I have not enough posts to direct link images!)

- Clicking on "resume", the execution is not resumed (see the second attached screeshot).

i59.tinypic.com/29wol8k.jpg

This is my debug log:
Quote:

Event CREATE from org.eclipse.debug.core.model.RuntimeProcess
Event CHANGE from org.eclipse.debug.core.model.RuntimeProcess
Event CHANGE from org.eclipse.debug.core.model.RuntimeProcess
Event MODEL_SPECIFIC/5 from org.eclipse.dltk.dbgp.internal.DbgpDebugingEngine
<< <?xml version="1.0" encoding="UTF-8" ?>
<init fileuri="file:///c:/programmi/lua/5.1/lua/wsapi/common.lua" idekey="luaidekey" protocol_version="1.0" parent="" thread="main" appid="Lua DBGp" language="Lua" session="1403769082_main" xmlns="urn:debugger_protocol_v1"/>
>> feature_set -n max_children -i 12 -v 32
<< <?xml version="1.0" encoding="UTF-8" ?>
<response feature="max_children" success="1" command="feature_set" transaction_id="12" xmlns="urn:debugger_protocol_v1"/>
>> feature_set -n max_depth -i 13 -v 2
<< <?xml version="1.0" encoding="UTF-8" ?>
<response feature="max_depth" success="1" command="feature_set" transaction_id="13" xmlns="urn:debugger_protocol_v1"/>
>> feature_set -n max_data -i 14 -v 8192
<< <?xml version="1.0" encoding="UTF-8" ?>
<response feature="max_data" success="1" command="feature_set" transaction_id="14" xmlns="urn:debugger_protocol_v1"/>
>> feature_get -n stdin -i 15
<< <?xml version="1.0" encoding="UTF-8" ?>
<response transaction_id="15" feature_name="stdin" command="feature_get" supported="0" xmlns="urn:debugger_protocol_v1"><![CDATA[false]]></response>
>> feature_set -n notify_ok -i 16 -v 1
<< <?xml version="1.0" encoding="UTF-8" ?>
<response feature="notify_ok" success="0" command="feature_set" transaction_id="16" xmlns="urn:debugger_protocol_v1"/>
>> stdout -c 2 -i 17
<< <?xml version="1.0" encoding="UTF-8" ?>
<response command="stdout" transaction_id="17" success="1" xmlns="urn:debugger_protocol_v1"/>
>> stderr -c 2 -i 18
<< <?xml version="1.0" encoding="UTF-8" ?>
<response command="stderr" transaction_id="18" success="1" xmlns="urn:debugger_protocol_v1"/>
>> breakpoint_set -r 0 -t line -s enabled -n 13 -i 19 -f file:///D:/prog/WebCT/blog/blog.lua
<< <?xml version="1.0" encoding="UTF-8" ?>
<response transaction_id="19" id="0" state="enabled" command="breakpoint_set" xmlns="urn:debugger_protocol_v1"/>
Event CREATE from org.eclipse.dltk.internal.debug.core.model.ScriptThread
>> step_into -i 20
Event MODEL_SPECIFIC/4 from org.eclipse.dltk.internal.debug.core.model.ScriptThread
Event RESUME from org.eclipse.dltk.internal.debug.core.model.ScriptThread
Event CHANGE from org.eclipse.dltk.internal.debug.core.model.ScriptThread
Event MODEL_SPECIFIC/2 from org.eclipse.koneki.ldt.debug.core.internal.attach.LuaAttachDebuggingEngineRunner$1
<< <?xml version="1.0" encoding="UTF-8" ?>
<response transaction_id="20" status="break" xmlns="urn:debugger_protocol_v1" command="step_into" reason="ok"/>
>> stack_get -i 21
Event MODEL_SPECIFIC/3 from org.eclipse.dltk.internal.debug.core.model.ScriptThread


thanks,
Luca
Re: Debug though co-routines [message #1389315 is a reply to message #1388328] Fri, 27 June 2014 16:27 Go to previous message
Marc Aubry is currently offline Marc Aubry
Messages: 78
Registered: August 2012
Member
Are you sure you have copied the whole log ? because after the line :
<response transaction_id="20" status="break" ...

You should have the following command, that give to eclipse the information of where the break is.
>>	breakpoint_get -d 0 -i 73
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response transaction_id="73" command="breakpoint_get" xmlns="urn:debugger_protocol_v1"><breakpoint id="0" hit_count="1" state="enabled" filename="file:///home/maubry/LDT/standalone1.2.0.RC2/workspace/mldks/src/main.lua" hit_value="0" type="line" lineno="2" hit_condition=">="/></response>


And also you should have more commands to retrieve the context.

Before going deeper, can you just ensure you used the right debugger.lua module version ? You can find the debugger compatible with your LDT version by clicking on the link "Lua Debugger Client" in any Lua Attach Debug Configuration page.

Thanks
Previous Topic:Unable to make autocoplete working
Next Topic:The highlighting color is changed when typing.
Goto Forum:
  


Current Time: Tue Sep 16 09:38:26 GMT 2014

Powered by FUDForum. Page generated in 0.01656 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software