Changes between Version 2 and Version 3 of JavascriptDebugging
- Timestamp:
- Jan 14, 2013, 9:12:28 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
JavascriptDebugging
v2 v3 1 1 == Introduction == 2 A large part of the game like components, GUI scripts or the AI are written in Javascript. If you have programmed C++ or used Javascript for websites you probably know how important a good debugger can be and how much it helps to find bugs or learn how a part of code works.3 The web based tools like Firebug can't be used for 0 A.D. because the debugger has to be very closely connected to the Javascript runtime. However, there's a dedicated tool for 0 A.D. and the Pyrogenesis engine being developed at the moment that should hopefully be ready to use soon.2 A large part of the game like components, GUI scripts or the AI are written in Javascript. If you have programmed C++ or used Javascript for Websites you probably know how important a good Debugger can be and how much it helps to find Bugs or learn how a Part of code works. 3 The web based Tools like Firebug can't be used for 0 A.D. because the debugger has to be very closely connected to the Javascript runtime. However, there's a dedicated tool for 0 A.D. and the Pyrogenesis engine being developed at the moment that should hopefully be ready to use soon. 4 4 5 5 == Technical background == 6 The DebuggingServer component makes debugging commands like (ToggleBreakpoint, Step, Continue etc...) available using a Mongoose webserver.7 The format used for return values is JSON, which should be easy to parse from a web-GUI.6 The DebuggingServer component makes debugging commands like (ToggleBreakpoint, Step, Continue etc...) available using a mongoose webserver. 7 The format used for return values is JSON, which should be easy to parse from a Web-GUI. 8 8 9 The debugger uses the JSDBGAPI provided by Spidermonkey 1.8.5. Newer versions of Spidermonkey provide a simplified new API (along with memory leak fixes, performance improvements and more), but unfortunately Mozilla isn't interested in doing the work and publishing a independent build from Firefox at the moment.9 The Debugger uses the JSDBGAPI provided by Spidermonkey 1.8.5. Newer versions of Spidermonkey provide a simplified new API (along with memory leak fixes, performance improvements and more), but unfortunately Mozilla isn't interested in doing the work and publishing a independent build from Firefox at the moment. 10 10 We had a [http://irclogs.wildfiregames.com/2013-01-02-QuakeNet-%230ad-dev.log discussion about that on IRC]. 11 11 … … 23 23 24 24 === Toggling (setting/removing) breakpoints: === 25 Command: 25 26 {{{ 26 http://127.0.0.1:9000/ToggleBreakpoint?filename=gui/gamesetup/gamesetup.js&line=1481 27 http://127.0.0.1:9000/ToggleBreakpoint?filename=gui/gamesetup/gamesetup.js&line=1502 28 }}} 29 Returns: 30 Nothing 31 32 === Get the status of all threads === 33 {{{ 34 http://127.0.0.1:9000/GetThreadDebuggerStatus 27 35 }}} 28 36 29 Nothing returned 37 Returns: 38 {{{ 39 { "ThreadDebuggerID" : 1,"ScriptInterfaceName" : "GUI","ThreadInBreak" : true,"BreakFileName" : "gui/gamesetup/gamesetup.js","BreakLine" : 1502 } 40 }}} 41 42 Note: 43 BreakFileName and BreakLine should be considered "undefined" if ThreadInBreak is false! 44 45 === Continue === 46 Continue the execution until the next breakpoint is hit. 47 {{{ 48 http://127.0.0.1:9000/Continue?threadDebuggerID=1 49 }}} 50 51 Arguments: 52 * threadDebuggerID: The ThreadDebuggerID of the thread that should be continued. You can get this ID by calling GetThreadDebuggerStatus. 53 54 Returns: 55 Nothing 56 57 Note: The command has no effect if the thread is not stopped. 58 30 59 31 60 {{{