Debugging with remdebug

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Debugging with remdebug

#1 Post by yufra »

I am trying to debug my module and I notice that remdebug is in the thirdparty directory. Can you give an example of how to use it in T-Engine? I will outline what I am trying with the example module.

I want to debug the player creation, or birth process. I figure putting a breakpoint at line 43 in modules/example/class/Player.lua, right at the start of the Player:init function should do the trick. First, I need to attach the remdebug process to T-Engine, and decided to add the following code to engine/Birther.lua after the initial requires and before the module call:

Code: Select all

require "remdebug.engine"
remdebug.engine.start()
I can now start T-Engine.app and once I start a new Example Module game and this yields the following entrance in the remdebug process: "Paused at file engine/Birther.lua"

Second, I believe that I need to set up remdebug, specifically basedir. I am running Mac OSX, so everything is contained within the app directory and I think that is where I need to set the base directory. This could be where I am going wrong, but I am executing the following in the remdebug process:

Code: Select all

> basedir Applications/Games/T-Engine.app/Contents/Resources/game/
Finally, I want to set a breakpoint in the modules/example/class/Player:init function. So I set about this:

Code: Select all

> setb modules/example/class/Player.lua 43
> listb
Applications/Games/T-Engine.app/Contents/Resources/modules/example/class/Player.lua: 43 
> run
The problem is that the debugger never picks back up. I know that it reaches line 43 since I put a print statement on that line and I see the output from it in stdout. Any suggestions on how to correctly set up remdebug? Thanks!
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Debugging with remdebug

#2 Post by darkgod »

I must admit I never actually needed it :)
But the basedir should probably be either empty or / because the game runs in a private virtual filesystem
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Debugging with remdebug

#3 Post by yufra »

Never had to debug! :cry: I will comfort myself that I just started learning Lua a few days ago.

The private virtual filesystem was exactly it, and once the basedir was left empty I could set breakpoints using the virual filesystem. I moved the remdebug call to the top of modules/example/class/Game.lua and then the remdebug session looked like this:

Code: Select all

Lua Remote Debugger
Run the program you wish to debug
Paused at file mod/class/Game.lua
Type 'help' for commands
> basedir

> setb mod/class/Player.lua 43
> listb
mod/class/Player.lua: 43 
> run
Paused at file mod/class/Player.lua line 43
> 
The basedir and listb command are just added for illustration purposes and can be removed. Thanks again DG!
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Debugging with remdebug

#4 Post by darkgod »

My pleasure :)

What kind of game are you making BTW ?
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Debugging with remdebug

#5 Post by yufra »

The original game concept is inspired by Zombieland and Fallout. Instead of a nuclear apocalypse there has been a viral apocalypse turning people into brain hungry zombies (why is it always the brains?). The global quest is to find a cure for the virus and save humanity. I had not originally planned on having leveling and different classes, but T-Engine makes that so easy that I am looking at ways to diversify the player. The original player had a rare resistance to the virus and could slowly regenerate his "viral load" to zero. Now I am considering having a player select a pre-apocalypse profession to determine talents/skills/masteries similar to ToME. For example, a police officer would be skilled with a gun where an engineer would be skilled with construction. Currently I am testing these game concepts out in the random dungeon from the example module.
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Debugging with remdebug

#6 Post by darkgod »

Ok :)
I always wanted a fallout rl ... hum :)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply