Josh Posted March 14, 2018 Share Posted March 14, 2018 Here is how the script debugger works. The first time a game is run in debug mode, an ENET host is created. The hostname and port are passed to the game via the command line: mygame.debug.exe +debuggerhostname "localhost" +debuggerport 8000 The game then connects to the debugger via network commands. The game can stop and send a message to the debugger with this message: MESSAGE_SENDERRORMESSAGE The debugger can also control the execution of the game with these messages: MESSAGE_PAUSE MESSAGE_DEBUGSTEP MESSAGE_DEBUGSTEPIN MESSAGE_DEBUGSTEPOUT MESSAGE_DEBUGRESUME The game automatically sends the callstack for display at the appropriate times with the following message: MESSAGE_SENDCALLSTACK This is then parsed with code included below and turned into the debug tree. Debugger.zip Breakpoints are initially loaded from the breakpoints file. If the user modifies breakpoints while the game is running they can be sent with the MESSAGE_EDITBREAKPOINTS message, followed by data in the following format: case MESSAGE_EDITBREAKPOINTS: #ifdef LEADWERKS_5 stream = CreateBankStream(message->data); #else stream = BankStream::Create(message->data,false); #endif countbreakpoints = stream->ReadInt(); for (int i=0; i<countbreakpoints; i++) { editmode=stream->ReadInt(); source = stream->ReadString(); linenumber = stream->ReadInt(); if (editmode==1) { SetBreakpoint(source,linenumber); } else { RemoveBreakpoint(source,linenumber); } } break; Constants are defined as: Const LE_MESSAGE_CONNECT:Int=-1 Const LE_MESSAGE_DISCONNECT:Int=-2 Const MESSAGE_SENDCALLSTACK:Int=-101 Const MESSAGE_REQUESTTABLE:Int=-102 Const MESSAGE_SENDTABLE:Int=-103 Const MESSAGE_SEQUENCED:Int=1 Const MESSAGE_RELIABLE:Int=2 Const MESSAGE_DEBUGRESUME:Int=-104 Const MESSAGE_DEBUGSTEP:Int=-105 Const MESSAGE_DEBUGSTEPIN:Int=-106 Const MESSAGE_DEBUGSTEPOUT:Int=-107 Const MESSAGE_SENDERRORMESSAGE:Int=-108 Const MESSAGE_DEBUGPOINTERINFOREQUEST:Int=-109 Const MESSAGE_EDITBREAKPOINTS:Int=-111 Const MESSAGE_PAUSE:Int=-112 Network communication is performed using this version of ENet: enet.zip 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.