Changes between Version 14 and Version 15 of JavascriptDebugging


Ignore:
Timestamp:
Mar 3, 2013, 5:33:22 PM (11 years ago)
Author:
Yves
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • JavascriptDebugging

    v14 v15  
    22
    33== Introduction ==
    4 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.
    5 Existing 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 debugging tool for 0 A.D. and the Pyrogenesis engine which is not as sophisticated as Firebug but offers some basic debugging functionality.
    6 This article describes the usage of the Pyrogenesis script debugger. If you are interested in technical documentation of the debugger and in changing the debugger itself, please refer to [wiki:JavascriptDebuggingServer Javascript debugging server].
     4A 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. Existing 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 debugging tool for 0 A.D. and the Pyrogenesis engine which is not as sophisticated as Firebug but offers some basic debugging functionality. This article describes the usage of the Pyrogenesis script debugger. If you are interested in technical documentation of the debugger and in changing the debugger itself, please refer to [wiki:JavascriptDebuggingServer Javascript debugging server].
     5
     6== Overview ==
     7The debugger requires two components to work. First, there's a webserver built into the engine and second, there's a web GUI that can be launched from anywhere by opening a html file in a web browser. All important commands can be executed from the web GUI and it displays script code and information like active breakpoints or running threads.
     8
     9== Enabling the debugger ==
     10The debugger can run both in release and in debug builds. However, the debugging server is disabled by default for performance and security reasons. You can enable it by adding this line to your local.cfg.
     11
     12{{{
     13jsdebugger.enable = true                   ; Enable Javascript debugging (default off for security/performance)
     14}}}
     15If you only need the debugger for a single session, you can use a command line argument:
     16
     17{{{
     18./pyrogenesis -conf=jsdebugger.enable:true
     19}}}
     20A yellow warning message is displayed in the game if the debugger is enabled.
     21
     22== Using the debugger ==
     23
     24=== Starting ===
     25First start the game and make sure that the debugger is enabled.
     26Then open 0ad/source/tools/jsdebugger/index.html in a web browser.
     27
     28
     29
     30The debugger will load a list of script files loaded by the engine (1).
     31Because no file is loaded at the moment, the file panel in the middle (2) will be empty.
     32On the right side (3) you see all (or most) commands that are available.
     33On the bottom left side (4) there's a list of currently running script interface instances. They can all be different threads, but that's not necessarily so.
     34Because the scripts are running and we haven't triggered a breakpoint yet, the callstack window (5) is empty. The values window (6) contains the three root nodes for values you can watch (locals, this, global) but they are empty at the moment.
     35
     36The following sections describe all these panels in more detail.
     37
     38
     39=== Files (1) ===
     40This is a list of all .js files currently loaded into the vfs by the engine.
     41You can type something in the search field and it will only display those files that match the pattern.
     42Double-clicking a file will open it in the file panel in the middle.
     43
     44=== File panel (2) ===
     45The file panel displays a file with line numbers, syntax highlighting and even some basic syntax validations. However, it only displays the file and you can't edit it there directly.
     46You see breakpoints and can toggle breakpoints by klicking left beside the line numbers.
     47The yellow line shows you at which line the execution is currently halted.
     48
     49
     50
     51 
     52