Changes between Version 2 and Version 3 of JavascriptDebugging


Ignore:
Timestamp:
Jan 14, 2013, 9:12:28 PM (11 years ago)
Author:
Yves
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JavascriptDebugging

    v2 v3  
    11== 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.
     2A 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.
     3The 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.
    44
    55== 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.
     6The DebuggingServer component makes debugging commands like (ToggleBreakpoint, Step, Continue etc...) available using a mongoose webserver.
     7The format used for return values is JSON, which should be easy to parse from a Web-GUI.
    88 
    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.
     9The 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.
    1010We had a [http://irclogs.wildfiregames.com/2013-01-02-QuakeNet-%230ad-dev.log discussion about that on IRC].
    1111
     
    2323
    2424=== Toggling (setting/removing) breakpoints: ===
     25Command:
    2526{{{
    26 http://127.0.0.1:9000/ToggleBreakpoint?filename=gui/gamesetup/gamesetup.js&line=1481
     27http://127.0.0.1:9000/ToggleBreakpoint?filename=gui/gamesetup/gamesetup.js&line=1502
     28}}}
     29Returns:
     30Nothing
     31
     32=== Get the status of all threads ===
     33{{{
     34http://127.0.0.1:9000/GetThreadDebuggerStatus
    2735}}}
    2836
    29 Nothing returned
     37Returns:
     38{{{
     39{ "ThreadDebuggerID" : 1,"ScriptInterfaceName" : "GUI","ThreadInBreak" : true,"BreakFileName" : "gui/gamesetup/gamesetup.js","BreakLine" : 1502 }
     40}}}
     41
     42Note:
     43BreakFileName and BreakLine should be considered "undefined" if ThreadInBreak is false!
     44
     45=== Continue ===
     46Continue the execution until the next breakpoint is hit.
     47{{{
     48http://127.0.0.1:9000/Continue?threadDebuggerID=1
     49}}}
     50
     51Arguments:
     52 * threadDebuggerID: The ThreadDebuggerID of the thread that should be continued. You can get this ID by calling GetThreadDebuggerStatus.
     53
     54Returns:
     55Nothing
     56
     57Note: The command has no effect if the thread is not stopped.
     58
    3059
    3160{{{