Ported the Script Debugger from dhewm3#6
Open
DanielGibson wants to merge 8 commits intostgatilov:trunkfrom
Open
Ported the Script Debugger from dhewm3#6DanielGibson wants to merge 8 commits intostgatilov:trunkfrom
DanielGibson wants to merge 8 commits intostgatilov:trunkfrom
Conversation
This reverts commit 9123259.
It's based on the (nonfunctional) script debugger included in the Doom3 GPL code, fixed in dhewm3 by Harrie van Ginneken and further improved by him and me. Doesn't work in TDM yet, especially because there's still SDL-code in it
... that weren't really specific to it but (as far as I can tell) required to make it work
this appears to be from the original Doom3 GPL source, no idea why.. on Windows this restriction is not enforced, and at least nowadays usleep() on Linux has a precision that is *much* better than 1ms
pthread_join() returns an error code, this can be logged in addition to the existing message (both as string and its number)
by replacing SDL-based threading code with stuff from sys_threading.h
…t/prev the code for this already existed, it just wasn't wired into the UI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Doom3 GPL contained most of the source of the script debugger that used to be part of Quake4.
Harrie van Ginneken fixed it for dhewm3 by implementing the missing parts and we further improved it together.
Like all the original Tools it's mostly Windows-only, but it's actually split into client (that Windows MFC frontend) and server, and the serverpart should also work on Linux (tested that on dhewm3 a while back, didn't test it in TDM now). And I guess TDM also works fine in Wine?
On Windows, just enter
debuggerin the console to start it.Then go to the "Scripts" Tab and select a script you're interested in and find an interesting function and set a breakpoint (click in the line and press F9 or click to the left of the line number where that dot will appear).
When the game gets to that point it will pause and you can inspect the function in the script debugger or step through it line-by-line with F10/F11 (or those buttons); you can make it continue running normally (until it hits a breakpoint again) by pressing that little triangular "play" button at the top.
When hovering variables with the mouse cursor, it should show their current value. Doesn't seem to work for constants though..
After clicking a variable you can press Shift+F9 to get into some "quick watch" view, where you can also add the variable to the watch tab
Also check out the context menu in the text view showing the script source (no you can't edit it there).
Generally it's kinda ugly and janky, but better than nothing.
Download
Here's a testbuild for Windows, based on current trunk code, seems to work with latest 2.14 beta game data: TheDarkModx64-scriptdbg2.zip
Linux build: thedarkmod.x64-script-dbg-linux.zip
More details
The script debugger will actually run in a separate process, same you get when starting thedarkmod with the
+debuggercommandline argument (then you get only the debugger window).For the networked setup, the following CVars are relevant:
com_enableDebuggerServer,com_dbgClientAdrandcom_dbgServerAdr.Maybe (on Linux) you could even run
TheDarkModx64.exe +debuggerin Wine and the native darkmod (on the same machine) with+set com_enableDebuggerServer 1and they may find each other. Likely you need to start the native one with the server first, if anyone tries please let me know :)