Jump to: navigation, search

Difference between revisions of "Koneki/LDT/User Guide/Concepts/Debugger"

< Koneki‎ | LDT‎ | User Guide‎ | Concepts
m (wording/spelling)
Line 1: Line 1:
 
=Lua Development Tools Debugger=
 
=Lua Development Tools Debugger=
 
==Remote Debug==
 
==Remote Debug==
The Debugger of Lua Development Tools is based on DBGP protocol.<br/>
+
The Debugger of Lua Development Tools is based on the DBGP protocol.<br/>
The IDE contains a DBGP server. To connect to this one and begin remote/attach debugging, you need to get our [[Media:Debugger_lua.zip|DBGP lua client]].
+
The IDE contains a DBGP server. To connect to this server, and begin remote/attach debugging, you need to get our [[Media:Debugger_lua.zip|DBGP lua client]].
  
 
===DBGP Client===
 
===DBGP Client===
 
The DBGP Lua client is composed of two lua files ([http://git.eclipse.org/c/koneki/org.eclipse.koneki.ldt.git/plain/plugins/org.eclipse.koneki.ldt.debug.core/script/debugger.lua debugger.lua] and [http://git.eclipse.org/c/koneki/org.eclipse.koneki.ldt.git/plain/plugins/org.eclipse.koneki.ldt.debug.core/script/debugintrospection.lua debugintrospection.lua]).<br/>
 
The DBGP Lua client is composed of two lua files ([http://git.eclipse.org/c/koneki/org.eclipse.koneki.ldt.git/plain/plugins/org.eclipse.koneki.ldt.debug.core/script/debugger.lua debugger.lua] and [http://git.eclipse.org/c/koneki/org.eclipse.koneki.ldt.git/plain/plugins/org.eclipse.koneki.ldt.debug.core/script/debugintrospection.lua debugintrospection.lua]).<br/>
It runs on unix like OS and windows (XP and later). It is written in '''Lua 5.1''' and '''was dependant of lua-socket'''.<br/>
+
It runs on Unix-like OS and Windows (XP and later). It is written in '''Lua 5.1''' and '''depends on lua-socket'''.<br/>
''You could get lua on http://www.lua.org/download.html and install lua-socket thanks to [http://luarocks.org/en/Download luarocks] or via your official OS repositories.''<br/>
+
''You can get Lua on http://www.lua.org/download.html and install lua-socket thanks to [http://luarocks.org/en/Download luarocks], or via your official OS repositories.''<br/>
  
To use it, you must have this two files in your lua path.<br/>
+
To use it, you must have these two files in your lua path.<br/>
 
To begin the connection, you must execute this lua code :
 
To begin the connection, you must execute this lua code :
 
  > local initconnection = require("debugger")
 
  > local initconnection = require("debugger")
Line 16: Line 16:
 
  > require("debugger")(host, port, idekey)
 
  > require("debugger")(host, port, idekey)
  
* '''host''': the host name or the ip address of the DBGP server (so of your ide).
+
* '''host''': the host name or the IP address of the DBGP server (thus, of your IDE).
** if host is nil, the DBGP_IDEHOST env var is used.
+
** if host is nil, the DBGP_IDEHOST environment variable is used.
** if the env var is nil, the default value '127.0.0.1' is used.
+
** if the envirnonment variable is nil, the default value '127.0.0.1' is used.
 
* '''port''': the port of the DBGP server (must be configured in the IDE).
 
* '''port''': the port of the DBGP server (must be configured in the IDE).
** if port is nil, the DBGP_IDEPORT env var is used.
+
** if port is nil, the DBGP_IDEPORT environment variable is used.
** if the env var is nil, the default value '10000' is used.
+
** if the environment variable is nil, the default value '10000' is used.
 
* '''idekey''': a string which is used as session key (must be configured in the IDE).
 
* '''idekey''': a string which is used as session key (must be configured in the IDE).
** if IDEKEY is nil, the DBGP_IDEKEY env var is used.
+
** if IDEKEY is nil, the DBGP_IDEKEY environment variable is used.
** if the env var is nil, the default value 'luaidekey' is used.
+
** if the environment variable is nil, the default value 'luaidekey' is used.
  
 
So, To debug your application you could do :  
 
So, To debug your application you could do :  
 
  lua -e "require('debugger')("idehost","ideport");" MyApp.lua  
 
  lua -e "require('debugger')("idehost","ideport");" MyApp.lua  
  
===GBGP Server===
+
===DBGP Server===
 
The DBGP Server is integrated in LDT.<br/>
 
The DBGP Server is integrated in LDT.<br/>
To allow it to accept debug session, you must create a new '''Remote Lua Application''' launch configuration, then launch it.   
+
In order to accept incoming debug sessions, you must create a new '''Remote Lua Application''' launch configuration, then launch it.   
  
 
Go in '''Run/Debug Configurations...'''.
 
Go in '''Run/Debug Configurations...'''.
 
[[Image:LaunchConfiguration.png|center]]<br/>
 
[[Image:LaunchConfiguration.png|center]]<br/>
* '''Project''' : Set the ldt project in your workspace which include the lua source file of the application you want to debug. <br/>   
+
* '''Project''' : Set the LDT project in your workspace which includes the Lua source file(s) of the application you want to debug. <br/>   
* '''IdeKey''' : Default value is luaidekey, if you need to debug more than one application at the same time, you should change it to associate a launchconfiguration to only one application to debug.<br/>
+
* '''IdeKey''' : Default value is luaidekey, if you need to debug more than one application at the same time, you should change it to associate a launch configuration with only one application to debug.<br/>
* '''Remote Source Mapping''' : use to make the mapping between the source file used at runtime and the source file in your ide workspace.
+
* '''Remote Source Mapping''' : This parameter is used to set the mapping between the source files used at runtime and the source files in the workspace of the IDE.
For exemple if your run your application like this :
+
For example, if your run your application this way:
 
  $cd /my/runtime/path
 
  $cd /my/runtime/path
 
  $lua -e "require('debugger')();" MyApp.lua  
 
  $lua -e "require('debugger')();" MyApp.lua  
Line 44: Line 44:
  
 
<br/>
 
<br/>
Now you can launch it by clicking '''Debug'''. IDE will wait for debugger client connection on the port you could see in the debug view.<br/>
+
Now you can start your debug session by clicking '''Debug'''. IDE will wait for an incoming connection from the debugger client, on the port you can see in the debug view.<br/>
 
[[Image:DebugView.png|center]]
 
[[Image:DebugView.png|center]]
  
You could change the server port, in ''Window > Preferences > Dynamic Languages > Debug''.
+
If needed, you can change the server port, in ''Window > Preferences > Dynamic Languages > Debug''.
 
[[Image:DebugUI.png|center]]
 
[[Image:DebugUI.png|center]]

Revision as of 12:47, 14 November 2011

Lua Development Tools Debugger

Remote Debug

The Debugger of Lua Development Tools is based on the DBGP protocol.
The IDE contains a DBGP server. To connect to this server, and begin remote/attach debugging, you need to get our DBGP lua client.

DBGP Client

The DBGP Lua client is composed of two lua files (debugger.lua and debugintrospection.lua).
It runs on Unix-like OS and Windows (XP and later). It is written in Lua 5.1 and depends on lua-socket.
You can get Lua on http://www.lua.org/download.html and install lua-socket thanks to luarocks, or via your official OS repositories.

To use it, you must have these two files in your lua path.
To begin the connection, you must execute this lua code :

> local initconnection = require("debugger")
> initconnection(host, port, idekey)

or shortly

> require("debugger")(host, port, idekey)
  • host: the host name or the IP address of the DBGP server (thus, of your IDE).
    • if host is nil, the DBGP_IDEHOST environment variable is used.
    • if the envirnonment variable is nil, the default value '127.0.0.1' is used.
  • port: the port of the DBGP server (must be configured in the IDE).
    • if port is nil, the DBGP_IDEPORT environment variable is used.
    • if the environment variable is nil, the default value '10000' is used.
  • idekey: a string which is used as session key (must be configured in the IDE).
    • if IDEKEY is nil, the DBGP_IDEKEY environment variable is used.
    • if the environment variable is nil, the default value 'luaidekey' is used.

So, To debug your application you could do :

lua -e "require('debugger')("idehost","ideport");" MyApp.lua 

DBGP Server

The DBGP Server is integrated in LDT.
In order to accept incoming debug sessions, you must create a new Remote Lua Application launch configuration, then launch it.

Go in Run/Debug Configurations....

LaunchConfiguration.png

  • Project : Set the LDT project in your workspace which includes the Lua source file(s) of the application you want to debug.
  • IdeKey : Default value is luaidekey, if you need to debug more than one application at the same time, you should change it to associate a launch configuration with only one application to debug.
  • Remote Source Mapping : This parameter is used to set the mapping between the source files used at runtime and the source files in the workspace of the IDE.

For example, if your run your application this way:

$cd /my/runtime/path
$lua -e "require('debugger')();" MyApp.lua 

You should define /my/runtime/path as working directory. (On Windows : you should use this notation /x:/myruntime/path)


Now you can start your debug session by clicking Debug. IDE will wait for an incoming connection from the debugger client, on the port you can see in the debug view.

DebugView.png

If needed, you can change the server port, in Window > Preferences > Dynamic Languages > Debug.

DebugUI.png