Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Koneki » LDT debugger(more broader explanationn of LDT debugger)
LDT debugger [message #1110072] Mon, 16 September 2013 06:20 Go to next message
Milan Jelisavcic is currently offline Milan Jelisavcic
Messages: 2
Registered: September 2013
Junior Member
I'v managed to run LDT debugger Attach to Application Configuration following instructions given in this video: youtube.com/watch?v=cZdn1yDrH8Y

It wotks for Corona SDK, but there you had to start Corona Debugger first and then you could debug. I was wondering, when I want to remotely debug like this in emulated environment, do I need some other debugger or just debugger.lua module? How does exactly LDT debugger works? And how does remote LDT debugger works?
Re: LDT debugger [message #1110273 is a reply to message #1110072] Mon, 16 September 2013 12:36 Go to previous messageGo to next message
Simon Bernard is currently offline Simon Bernard
Messages: 164
Registered: July 2009
Senior Member
Hi,
This video is out of date. You could find here a more recent way to debug corona application : http://forums.coronalabs.com/topic/35188-windows-eclipse-koneki-corona-first-steps-setup/?p=183754
(but it seems it's not really your point Razz)

The debugger is a single lua file. (In fact, this is several modules concatenated in one file)
It needs a way to communicate in TCP/IP. The default implementation is based on luasocket, but you could implement your own communication layer.
The debugger use the DBGP protocol. The debugger.lua file starts the connection to the DBGP server embedded in the IDE.
The 3 way to debug (Lua Application, Remote Application or Attach to Application) use the same debugger.lua file.

You could find more information in the user guide :
http://wiki.eclipse.org/Koneki/LDT/Developer_Area/User_Guides/User_Guide_1.0
At the end of this page, there some requirements to be compliant with our debugger:
http://wiki.eclipse.org/Koneki/LDT/User_Area/Compatible_Lua_VMs


HTH,

Simon
Re: LDT debugger [message #1113024 is a reply to message #1110273] Fri, 20 September 2013 10:34 Go to previous messageGo to next message
Milan Jelisavcic is currently offline Milan Jelisavcic
Messages: 2
Registered: September 2013
Junior Member
OK, this are all steps that I'm taking. I've managed to build Lua 5.2.2 wit luasocket 3-RC1 and it works from console. Now, I want to test debugging from LDT with it. Firrst, clicked on Manage interpreters... and added a new Lua 5.2.2 interpreter. Then, selected this interpreter inside Debug configuration and enabled DBGP logging. As it was show in the instruction, two files debugger.lua and debugintrospection.lua were added to src of a project. At the beginning of main.lua I typed
require("debugger")()
.

This i entire debug log in LDT:
>>	stop -i 87
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response reason="ok" xmlns="urn:debugger_protocol_v1" command="stop" transaction_id="87" status="stopped"/>
Event	TERMINATE from org.eclipse.dltk.internal.debug.core.model.ScriptThread
>>	stop -i 88
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response reason="ok" transaction_id="88" status="stopped" command="stop" xmlns="urn:debugger_protocol_v1"/>
>>	step_into -i 89
Event	MODEL_SPECIFIC/1 from org.eclipse.dltk.launching.InterpreterConfig
Event	CHANGE from org.eclipse.dltk.launching.process.ScriptRuntimeProcess
Event	CREATE from org.eclipse.dltk.launching.process.ScriptRuntimeProcess
Event	CHANGE from org.eclipse.dltk.launching.process.ScriptRuntimeProcess
Event	CHANGE from org.eclipse.dltk.launching.process.ScriptRuntimeProcess
Event	MODEL_SPECIFIC/5 from org.eclipse.dltk.dbgp.internal.DbgpDebugingEngine
<<	<?xml version="1.0" encoding="UTF-8" ?>
<init idekey="dbgp_1379687287256" fileuri="unknown:/" session="1379687287_thread: 006C1938" protocol_version="1.0" thread="thread: 006C1938" appid="Lua DBGp" parent="" language="Lua" xmlns="urn:debugger_protocol_v1"/>
>>	feature_set -n max_children -i 90 -v 32
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="1" command="feature_set" transaction_id="90" feature="max_children"/>
>>	feature_set -n max_depth -i 91 -v 2
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="1" command="feature_set" transaction_id="91" feature="max_depth"/>
>>	feature_set -n max_data -i 92 -v 8192
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="1" command="feature_set" transaction_id="92" feature="max_data"/>
>>	feature_get -n stdin -i 93
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response feature_name="stdin" supported="0" transaction_id="93" xmlns="urn:debugger_protocol_v1" command="feature_get"><![CDATA[false]]></response>
>>	feature_set -n notify_ok -i 94 -v 1
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="0" command="feature_set" transaction_id="94" feature="notify_ok"/>
>>	stdout -c 2 -i 95
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="stdout" success="1" transaction_id="95"/>
>>	stderr -c 2 -i 96
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="stderr" success="1" transaction_id="96"/>
>>	breakpoint_set -r 0 -t line -s enabled -n 5 -i 97 -f file:///C:/Development/Java/LDT32%20StandAloneDownloaded/org.eclipse.koneki.ldt.product-win32.win32.x86/workspace/test/src/main.lua
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" id="0" state="enabled" transaction_id="97" command="breakpoint_set"/>
Event	CREATE from org.eclipse.dltk.internal.debug.core.model.ScriptThread
>>	step_into -i 98
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.LuaDebugTarget
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" status="break" reason="ok" transaction_id="98" command="step_into"/>
>>	stack_get -i 99
Event	MODEL_SPECIFIC/3 from org.eclipse.dltk.internal.debug.core.model.ScriptThread
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="stack_get" transaction_id="99"><stack type="file" level="0" filename="file:///c:/development/java/ldt32%20standalonedownloaded/org.eclipse.koneki.ldt.product-win32.win32.x86/workspace/test/src/main.lua" lineno="1"/></response>
Event	CHANGE from org.eclipse.dltk.internal.debug.core.model.ScriptThread
>>	breakpoint_get -d 0 -i 100
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="breakpoint_get" transaction_id="100"><breakpoint id="0" state="enabled" hit_count="0" type="line" hit_condition=">=" lineno="5" filename="file:///c:/development/java/ldt32%20standalonedownloaded/org.eclipse.koneki.ldt.product-win32.win32.x86/workspace/test/src/main.lua" hit_value="0"/></response>
>>	coroutine_list -i 101
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="coroutine_list" transaction_id="101"></response>
Event	SUSPEND from org.eclipse.dltk.internal.debug.core.model.ScriptThread
>>	context_names -d 0 -i 102
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="context_names" transaction_id="102"><context id="0" name="Local"/><context id="2" name="Upvalue"/><context id="1" name="Global"/></response>
>>	context_get -c 0 -d 0 -i 103
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" transaction_id="103" command="context_get"><error code="998"><message><![CDATA[....product-win32.win32.x86\workspace\test\src\debugger.lua:794: attempt to call field 'getfenv' (a nil value)]]></message></error></response>
>>	context_get -c 1 -d 0 -i 104
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" transaction_id="104" command="context_get"><error code="998"><message><![CDATA[....product-win32.win32.x86\workspace\test\src\debugger.lua:794: attempt to call field 'getfenv' (a nil value)]]></message></error></response>
>>	context_get -c 2 -d 0 -i 105
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" transaction_id="105" command="context_get"><error code="998"><message><![CDATA[....product-win32.win32.x86\workspace\test\src\debugger.lua:794: attempt to call field 'getfenv' (a nil value)]]></message></error></response>


This is when I set "break on first line". When I click on step over, everything breaks and I get:

>>	step_over -i 106
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/5 from org.eclipse.dltk.dbgp.internal.DbgpDebugingEngine
<<	<?xml version="1.0" encoding="UTF-8" ?>
<init idekey="dbgp_1379687287256" fileuri="file:///c:/development/java/ldt32%20standalonedownloaded/org.eclipse.koneki.ldt.product-win32.win32.x86/workspace/test/src/main.lua" session="1379687438_thread: 006C1938" protocol_version="1.0" thread="thread: 006C1938" appid="Lua DBGp" parent="" language="Lua" xmlns="urn:debugger_protocol_v1"/>
>>	feature_set -n max_children -i 107 -v 32
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="1" command="feature_set" transaction_id="107" feature="max_children"/>
>>	feature_set -n max_depth -i 108 -v 2
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="1" command="feature_set" transaction_id="108" feature="max_depth"/>
>>	feature_set -n max_data -i 109 -v 8192
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="1" command="feature_set" transaction_id="109" feature="max_data"/>
>>	feature_get -n stdin -i 110
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response feature_name="stdin" supported="0" transaction_id="110" xmlns="urn:debugger_protocol_v1" command="feature_get"><![CDATA[false]]></response>
>>	feature_set -n notify_ok -i 111 -v 1
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" success="0" command="feature_set" transaction_id="111" feature="notify_ok"/>
>>	stdout -c 2 -i 112
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="stdout" success="1" transaction_id="112"/>
>>	stderr -c 2 -i 113
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns="urn:debugger_protocol_v1" command="stderr" success="1" transaction_id="113"/>
>>	feature_get -n language_supports_threads -i 114
<<	<?xml version="1.0" encoding="UTF-8" ?>
<response feature_name="language_supports_threads" supported="1" transaction_id="114" xmlns="urn:debugger_protocol_v1" command="feature_get"><![CDATA[0]]></response>
>>	breakpoint_set -r 0 -t line -s enabled -n 5 -i 115 -f file:///C:/Development/Java/LDT32%20StandAloneDownloaded/org.eclipse.koneki.ldt.product-win32.win32.x86/workspace/test/src/main.lua
Event	TERMINATE from org.eclipse.dltk.internal.debug.core.model.ScriptThread


My Lua5.2.2 VM have just luasocket without any other library. Could that be a problem? I am testing this because I want to use it on embedded device and on emulated embedded device so I guess I'll need Attach to Application configuration. So, how to run this effectively?
Re: LDT debugger [message #1113107 is a reply to message #1113024] Fri, 20 September 2013 12:52 Go to previous message
Simon Bernard is currently offline Simon Bernard
Messages: 164
Registered: July 2009
Senior Member
Hi,
There're something strange, you talk about debugger.lua and debugintrospection.lua. This is a very old version of our debugger. Now all the debugger code stand in just one file. ("debugger.lua")
This old version is not compatible with lua 5.2. That's must explain the "attempt to call field 'getfenv'" error you can see in your log. (this function does not exist anymore in lua 5.2)

To debug lua 5.2 code, you need to use the last version of LDT (1.0)
When you use Lua Application or Remote Application Launch configuration you don't need to add debugger file in your project and to call require "debugger"(), this is automatically managed by LDT.
When you use Attach to application, you must add the debugger file and bootstrap it manually (There're a link to get the debugger.lua in the attach to application configuration dialog, as it explain in documentation)
Previous Topic:LuaSocket
Next Topic:Unable to connect OMA-DM simulator with funambol dm server 3.7
Goto Forum:
  


Current Time: Fri Aug 01 22:46:57 EDT 2014

Powered by FUDForum. Page generated in 0.02890 seconds