- 1 Lua Development Tools Debugger
- 1.1 Install Lua
- 1.2 Install LuaRocks
- 1.3 Install LuaSocket
- 1.4 Install debugger
- 1.5 Finally, how to start a debugger session
Lua Development Tools Debugger
The debugger is an interesting feature, but enabling it require a little explanation. The require steps allowing to run debugger are explained below.
The debugger client is written in Lua 5.1 as I'm writing. In order to be able to run it, Lua is required. You can download Lua here. Under OSX and Linux Lua is available in software manager repositories.
We need LuaSocket in order to get it, the nicer way is to install it through LuaRocks. LuaRocks is a component manager for Lua such as Pear for PHP or Gems for Ruby. Here is the link to install it. Under OSX and Linux LuaRocks is available in software manager repositories.
Once you installed LuaRocks, just ask for LuaSocket. On my Linux it looks like
% sudo luarocks install luasocket
Beforehand, you must download provided archive: Media:Debugger_lua.zip.
Linux ( OSX compatible )
Then, decide where you want to install it. In my case it is /home/kkinfoo/.bin/.
- Extract archive
- Edit run script
- Update the INSTALL_DIR variable to meet installation directory, in my case "/home/kkinfoo/.bin/debugger_lua"
- Move debugger_lua directory to install directory. In my case:
% cp -r debugger_lua/ /home/kkinfoo/.bin/
- Create symbolic link to make command available anywhere
% sudo ln -s /path/to/debugger_lua/run /usr/bin/debugger_lua # In my case % sudo ln -s /home/kkinfoo/.bin/debugger_lua/run /usr/bin/debugger_lua
- It is all set
% debugger_lua No input file given Command usage: /usr/bin/debugger_lua <filename.lua> Launches debugger on specified file /usr/bin/debugger_lua --help This help
Windows is not fully supported yet, you can try to edit provided .bat script.
Finally, how to start a debugger session
Create and run launch configuration
In IDE side everthing is set up to allow debugging. You just learnt about setting up debugger client. You just need few configuration tips.
IDE side configuration
Go to Window > Preferences > Dynamic Languages > Debug, you will have the UI below. Make sure that selected port is of Custom type and is the same as in DBGP_IDEPORT from previous run script. This post is used for communication between IDE and Lua debugger client. If those ports differ, debugger won't work.
Creating a Remote Lua Application, you will have following window. Working directory field is to specify path difference when you are debugging a remote target. It allow debugger to strip this part of the path and match distant files with workspace ones.
Once you clicked Debug, IDE will wait for debugger client response. In order to provide it, you must run provided debugger code with debugged file as parameter.
Linux (OSX compatible)
If you installed the command as described above, you just have to run:
% debugger_lua fileToDebug.lua
In provided archive, edit test.bat, replace myapp.lua with your application source path. Save and execute it.