Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging/Testing LPC code

Tags:

debugging

Updating the object in the hosting driver will show any syntax errors, and any runtimes are logged in the appropriate way. I can inspect globals in the object and inherit using commands, but I'm at a loss when it comes to inspecting function-scoped variables and parameters, or stepping through functions and inspecting during the execution.

I can use debugging printf statements in my own code, but these are unwieldy. For some problems, adding a printf would require write access to the code containing the variable I want to watch, which isn't always available.

Is it possible to step through an LPC function in a driver, or is there a "fake" driver built into any IDE, or is there an interpreter that allows step-through, like with perl -d?

like image 726
Jeremy Smyth Avatar asked Nov 06 '22 20:11

Jeremy Smyth


2 Answers

No current LPMud driver has a feature like this. It's pretty much antithetical to the way LP drivers are architected, in that they're designed never to let code execution hold up the driver the way stepped debugging does.

I'll note that one thing I've done in working around this that's been particularly helpful has been creating a sefun set_error_advisory() that can be passed an arbitrary value which will then be picked up by the master object error handler and reported if an error occurs. I use that to get particularly relevant locally scoped information into the debug output.

like image 72
chaos Avatar answered Nov 15 '22 12:11

chaos


As far as I know there is no such debugging feature in the current LPMUD and LDMUD-driver although nearly all developers have wished for it one time or another.

I'd recommend that you ask Zesstra / Gnomi (the current developers of LDMUD 3.5: svn://svn.bearnip.com/ldmud/trunk) for some hints where to add such a code to the driver.

like image 44
Leonidas Avatar answered Nov 15 '22 13:11

Leonidas