Debugging Lua Modules

Questions and information about using Lua scripting with Storyboard

Moderator: jamiev

Debugging Lua Modules

Postby rdowdall » Wed Oct 18, 2017 9:04 am


This is just a quick post to outline steps that can be taken to debug a custom Lua module that has been compiled to run with Storyboard.

Step 1: Compile your Lua module with debug symbols. This can be done by adding the -g option to the flags that are being passed to the compiler. An optional step would be to also disable optimizations by passing a -O0.
Step 2: Copy your debug Lua module in to your Storyboard application and run it as you normally would. Grab the process ID number of Storyboard engine. This can be done by running ps (Linux System) or pidin (QNX System).
Step 3: Launch the gdb debugger. This can be done by running "gdb <path_to_sbengine>/sbengine". There won't be any symbols for the engine, but you shouldn't need them to debug the custom Lua module.
Step 4: Once gdb is up you will need to attach to the process with the pid that was obtained in Step 2. At the gdb command prompt, simply type "attach <pid_from_step_2>". This should attach to the running process. It may complain about missing symbols from libraries.
Step 5: Set the search path for your debug Lua module. This will allow gdb to pull in the symbols from the debug Lua module so that you can get information from it while sbengine is running. To do this run "set solib-search-path <path_to_lua_module>

At this point you should have your symbols loaded in the debugger. Note that this is assuming that everything is being done on one system. If you are using a host to target configuration where you are building on the host and running on a target, you will need to look in to how to do remote debugging to your target. These steps are also for a Linux/QNX with gdb based system.

Posts: 125
Joined: Mon Nov 02, 2009 9:46 pm

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 4 guests