Lua Debugger
6 6

40 posts in this topic

Recommended Posts

Just a few bullet points for now, will expand on it later:
 
Will fill this out as I go, we're uploading an SI test release btw  :)

  • Must be in debug mode (either hold left shift while booting the game, or for more permanently run game with -debug / -Ddebug params (depends, try both))* - alternatively try holding left shift while booting the game.
  • There is an edit box above the filename browser that you can use to search for files containing case insensitive strings 
  • F11 breaks into the debugger at the next available Lua entry point. Key is bindable.
  • F5 steps into code, F6 steps over code.
  • Left double click lua line to place / remove breakpoint.
  • Local variables panel is something that required a lot of guesswork and fiddling this end, and was by far the most complicated thing, and there may be times where it doesn't show something it should. Will get to all these in time.
  • Still some issues with java objects in object viewer etc
  • Just occured to me I didn't update the main dev branch with the new map debugging stuff (showing characters / collision, will get that in another release)
  • Right click object viewer for menu to put a breakpoint on the data on read / write, or to add to the watch window.
  • Left double click stuff to open info in a window is the general rule for object viewers, stacks etc.
  • Line numbers may occasionally be a line off in errors / stack. Will look to improve this if possible, but its tricky. Even ProDG the official Sony Playstation debugger suffered this problem the entire time I used it.
  • If UI breakpoints aren't enough, call the function breakpoint() in lua  :) this will always break every time it runs.

     

Expect bugs and slightly unfinished things. It's all very experimental, but is already MASSIVELY useful for any lua modder, so get used to using it :D if you do lua and you're not using it, then you are MAD. :P


*Mac Users need to follow these steps to use the debugger:
Open your PZ.app and look for a file called "Info.plist" then search for this line:

    <string>-noverify -XX:+UseNUMA -XX:+AggressiveOpts -XX:+TieredCompilation -XX:Tier2CompileThreshold=70000 -XX:CompileThreshold=1500  -Xms64m -Xmx512m -XX:+UseAdaptiveSizePolicy -XX:GCTimeRatio=50 -XX:MaxGCPauseMillis=20</string>

add "-Ddebug" to it (of course before the last </string> tag).

Edited by RoboMat
Added mac instructions

Share this post


Link to post
Share on other sites

Looks completely brilliant, will take it for a proper spin this weekend.  Is there a Lua available method to toggle the command line on and off?  I only saw the binding for the full debugger?

Share this post


Link to post
Share on other sites

Sweet mother in the morning, when I do something wrong it just .... it ... just ....

 

SHOWS ME THE *&%?! LINE?

 

This.  Is.  Beautiful.  And seriously, if it happens to be accidentally showing me the line above or below it?  I think I can forgive.

Share this post


Link to post
Share on other sites

 

i have .16 now can't get debuger to work

 

 

and my char can't drink water from the sink in the kitchen

Did you add the -debug flag?

 

don't think so where do i do that?, im on windows btw.

Share this post


Link to post
Share on other sites

I'm trying to get the debugger to work, but no luck. I've tried ./projectzomboid.sh -Ddebug -debug while holding left shift, but pressing F11 in a game does... nothing?

Share this post


Link to post
Share on other sites

I'm trying to get the debugger to work, but no luck. I've tried ./projectzomboid.sh -Ddebug -debug while holding left shift, but pressing F11 in a game does... nothing?

 

For me it only comes up, when I have set a breakpoint or if it encounters a bug ... maybe try that?

Share this post


Link to post
Share on other sites

 

I'm trying to get the debugger to work, but no luck. I've tried ./projectzomboid.sh -Ddebug -debug while holding left shift, but pressing F11 in a game does... nothing?

 

For me it only comes up, when I have set a breakpoint or if it encounters a bug ... maybe try that?

 

Tried it, no debug stuff :-(

Got an error message in the logfile though. Just want to know if I can call the screenshot function from lua...

Share this post


Link to post
Share on other sites

 

 

I'm trying to get the debugger to work, but no luck. I've tried ./projectzomboid.sh -Ddebug -debug while holding left shift, but pressing F11 in a game does... nothing?

 

For me it only comes up, when I have set a breakpoint or if it encounters a bug ... maybe try that?

 

Tried it, no debug stuff :sad:

Got an error message in the logfile though. Just want to know if I can call the screenshot function from lua...

 

 

Do you get a console window in-game when u start? If not, then you are not in debug mode.

Share this post


Link to post
Share on other sites

 

Do you get a console window in-game when u start? If not, then you are not in debug mode.

 

 

This is the problem I get.

 

Shift was doing nothing for me, neither was -debug or -Ddebug

 

I'm guessing the arguments aren't case sensitive. Wouldn't explain why shift wasn't being picked up on thought.

Share this post


Link to post
Share on other sites

To fix it on Linux, open projectzomboid.sh and put in

-Ddebug \

like this

#!/bin/bash## projectzomboid.sh################################################################################SCRIPT="`basename $0`"GAMEDIR="${HOME}/.project_zomboid_2.9.9.17"LOGFILE="${GAMEDIR}/${SCRIPT}.log"INSTDIR="`dirname $0`" ; cd "${INSTDIR}" ; INSTDIR="`pwd`"[[ ! -d "${GAMEDIR}" ]] && mkdir -m 0755 "${GAMEDIR}"JARPATH=".:lwjgl.jar:lwjgl_util.jar:jinput.jar"# XMODIFIERS is cleared here to prevent SCIM screwing up keyboard inputXMODIFIERS= java \    -Djava.library.path="${INSTDIR}" \    -Dorg.lwjgl.util.NoChecks=true \    -Dorg.lwjgl.librarypath="${INSTDIR}" \    -Ddebug \    -Xms768m \    -Xmx768m \	-XX:-UseSplitVerifier \    -cp "${JARPATH}" \    zombie.core.LaunchDialog \    "$@" \    >"${LOGFILE}"exit 0## EOF################################################################################

Share this post


Link to post
Share on other sites

 

To fix it on Linux, open projectzomboid.sh and put in

-Ddebug \

 

That did it! So "$@" is at the wrong place in the script. Should be "${@}" anyway :P

 

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
6 6