Using the Zeus Lua Debugger


1.0 - Introduction

  THIS SOFTWARE AND MANUAL ARE PROVIDED "AS IS" AND WITHOUT
  WARRANTIES AS TO PERFORMANCE OF MERCHANT ABILITY OR ANY
  OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED.  BECAUSE
  OF THE VARIOUS HARDWARE AND SOFTWARE ENVIRONMENTS INTO
  WHICH THIS  PROGRAM MAY BE PUT,  NO WARRANTY OF FITNESS
  FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME
  THE ENTIRE RISK OF USING THE PROGRAM. ANY LIABILITY OF THE
  SELLER WILL BE LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT
  OR REFUND OF PURCHASE PRICE.

The Zeus Lua Debugger provides an integrated debugging environment for the Zeus for Windows IDE


1.1 - Create a Simple Lua Example File

Below is a simple Lua script to that is to be debugged. This Lua script should be located in the c:\LuaDebug\Example.lua  folder.


--
-- Simple Debugging Example
--
-- For: http://www.zeusedit.com/LuaDebug.html
--

function factorial(n)
  if n < 2 then
    return 1
  else
    return n * factorial(n-1)
  end
end

function example()
  print("Hello world\n\n")

  print(arg[1] .. " " .. arg[2] .. " " .. arg[3] .. " " .. arg[4] .. " " .. arg[5] .. "\n\n" )

  print("Six Factorial: " .. factorial(6) .. "\n")

  print("Goodbye......\n")
end

-- run the function
example()


1.2 - Create the Zeus Workspace

To use the Lua debugger within Zeus requires the creation of a workspace.

To create a workspace use the Workspace, New  menu and create a workspace called LuaDebug  in the c:\LuaDebug\  folder location.

Select the Source Files  folder of the workspace and use the mouse right click to add the c:\LuaDebug\Example.lua  file to the folder.

Select the Workspace, Options  menu and change the Configuration  option to Debug  mode.

Go to the Debugging  panel and select the Executable  program type, enter Example.Lua  as the executable, add Welcome to my debugging example  as the arguments, add $WDD  as the directory, select the Lua Debugger Interface  as the debugger module and Apply  the changes.

NOTE: The $WDD  represents the Zeus workspace drive and directory folder location.


1.3 - Running the Zeus Lua Debugger

With the workspace created it is now time to start debugging. Use the Debugger, Start  menu to run the debugger.

If all went well the following output should have been produced in the debugger output window:


Module:'Example.Lua'
Directory:'c:\LuaDebug\'
Command Line:'xdbLua.exe Example.Lua Welcome to my debugging example'

Lua Debugger - Version 1.00
Designed to work with the Zeus for Windows IDE
http://www.zeusedit.com

Paused at file: xdblua (1367) (0)
Message: pause
Type 'help' for commands

Open the c:\LuaDebug\Example.lua  into the Zeus for Windows editor and place the cursor at line 25.

Use the debugger dialog Set  button to add a breakpoint at this line and you should see the breakpoint indicator displayed for that line.

Hit the Run  button to start debugging the program and if all goes well the progam should stop ar the breakpoint and the following output debug output is displayed:


setb 25 Example.lua
run
[DEBUG]> Paused at file: example.lua (25) (1) (breakpoint)

From this point on you can control the debugger using the debugger dialog. You can step over or through the code, examine the call stack, inspect local or global variables or run any other debugger commands.

For more information about other debugger commands just press the Help  button.

A screenshot of the debug session described above can be found here: http://www.zeusedit.com/lookdebug.png


Copyright (c) 1996-2008 Xidicone P/L. All rights reserved.

Last Modified: 6th March 2008 by Jussi Jumppanen
info@zeusedit.com
http://www.zeusedit.com