Changes between Version 23 and Version 24 of JavascriptDebugging


Ignore:
Timestamp:
Jan 4, 2014, 9:33:46 PM (10 years ago)
Author:
Yves
Comment:

Info: The JS debugger is temporarily disabled during the SpiderMonkey upgrade (check ticket #2348 for details)

Legend:

Unmodified
Added
Removed
Modified
  • JavascriptDebugging

    v23 v24  
    11[[TOC]]
     2
     3{{{
     4#!html
     5<h1 style="color: red">
     6 The JS debugger is temporarily disabled during the SpiderMonkey upgrade (check ticket #2348 for details)
     7</h1>
     8}}}
    29
    310== Introduction ==
     
    3239The following sections describe all these panels in more detail.
    3340
    34 
    3541=== Files (1) ===
    3642This is a list of all .js files currently loaded into the vfs by the engine. You can type something in the search field and it will only display those files that match the pattern. Double-clicking a file will open it in the file panel in the middle.
     
    4450
    4551=== Actions (3) ===
    46 
    47 The actions are basically the same as with other debuggers.
    48 You don't change anything at the code or what happens when it's executed.
    49 These actions are just commands to stop and continue the execution in a certain way.
     52The actions are basically the same as with other debuggers. You don't change anything at the code or what happens when it's executed. These actions are just commands to stop and continue the execution in a certain way.
    5053
    5154Be aware that the debugger is only capable of stepping through JS code and has no control over native (c++) code.
    5255
    53 ==== Step ====
    54 Step (or step over) continues the execution until the next line of code is reached.
    55 If there is a function call on the current line, it does not stop the execution after it entered the function (it steps over it).
     56==== Step ====
     57Step (or step over) continues the execution until the next line of code is reached. If there is a function call on the current line, it does not stop the execution after it entered the function (it steps over it).
    5658
    57 
    58 ==== Step into ====
    59 If there is a function call on the current line, it steps into that function and stops the execution at the first line of that function.
    60 Otherwise it just stops the execution at the next line of code.
     59==== Step into ====
     60If there is a function call on the current line, it steps into that function and stops the execution at the first line of that function. Otherwise it just stops the execution at the next line of code.
    6161
    6262==== Step out ====
    63 Continues until the current function is completed and then stops the execution in the parent function. 
     63Continues until the current function is completed and then stops the execution in the parent function.
    6464
    65 ==== Continue ==== 
     65==== Continue ====
    6666Continue the execution of all threads.
    6767
    68 ==== Continue thread ==== 
     68==== Continue thread ====
    6969Continue the execution of the currently selected thread.
    7070
     
    7272Stop the execution of each thread as soon as possible (basically as soon as the next JS code is executed).
    7373
    74 
    7574=== Threads (4) ===
    76 Actually the term "thread" is not quite accurate.
    77 All ScriptInterface instances are listed there. A ScriptInterface represents a JS runtime and a JS context.
    78 Multiple ScriptInterface instances can be used in one or more threads.
    79 Important to know is that stopping one thread will sometimes make it impossible to stop another one without continuing the first again.
    80 However, if two threads are really running in parallel and independent from each other, the debugger will try to stop the second thread too if you stopped the fist one.
     75Actually the term "thread" is not quite accurate. All ScriptInterface instances are listed there. A ScriptInterface represents a JS runtime and a JS context. Multiple ScriptInterface instances can be used in one or more threads. Important to know is that stopping one thread will sometimes make it impossible to stop another one without continuing the first again. However, if two threads are really running in parallel and independent from each other, the debugger will try to stop the second thread too if you stopped the fist one.
    8176
    8277If one thread is in break state, you can double-click on it to switch to that thread. The debugger will try to open the file the thread is currently executing and it will display the associated callstack and variables.
    8378
    8479=== Call stack (5) ===
    85 
    8680[[Image(callstack_and_values.gif, 25%)]]
    8781
    88 If you look at this example, keywordTestOR is the innermost function which got called by an anonymous function, which got called by "testFilter" etc...
    89 Often the debugger will only show anonymous functions because we are working with prototypes a lot and don't use named functions often.
     82If you look at this example, keywordTestOR is the innermost function which got called by an anonymous function, which got called by "testFilter" etc... Often the debugger will only show anonymous functions because we are working with prototypes a lot and don't use named functions often.
    9083
    9184You can double-click on one function name to display the variables of that scope.
     
    9487There are three main types of values that can be displayed.
    9588
    96 1. Locals
    97 Locals are locals variables in the current scope.
    98 2. This
    99 This is Javascript's "this" object. If you are a Javascript developer you should know what it is, it's quite difficult to explain.
    100 Note that we are using the "strict" mode which means that sometimes the "this" object will be empty.
    101 3. Global
     89 1. Locals
     90
     91Locals are locals variables in the current scope.
     92
     93 2. This
     94
     95This is Javascript's "this" object. If you are a Javascript developer you should know what it is, it's quite difficult to explain. Note that we are using the "strict" mode which means that sometimes the "this" object will be empty.
     96
     97 3. Global
     98
    10299This is the current global object.
    103100
    104 Sometimes retrieving these values from the game via JSON can take quite a while (in rare cases up to 15 seconds).
    105 If you want to quickly step through code you should collapse all root nodes (or at least the ones with a lot of values) because their content is only loaded when they are expanded. This will make stepping a lot faster.
     101Sometimes retrieving these values from the game via JSON can take quite a while (in rare cases up to 15 seconds). If you want to quickly step through code you should collapse all root nodes (or at least the ones with a lot of values) because their content is only loaded when they are expanded. This will make stepping a lot faster.
    106102
    107 The web GUI remembers expanded nodes and they will stay expanded the next time values are loaded from the service.
    108 Sub nodes will not be collapsed if you collapse their parent node (they will become invisible but they will be in expanded state if you expand the parent again).
     103The web GUI remembers expanded nodes and they will stay expanded the next time values are loaded from the service. Sub nodes will not be collapsed if you collapse their parent node (they will become invisible but they will be in expanded state if you expand the parent again).
    109104
    110105=== Breakpoints from code ===
    111106You can use this code to trigger breakpoints from JS code:
    112107
    113 {{{ 
     108{{{
    114109throw "Breakpoint";
    115110}}}
    116 
    117 The debugger will clear the exception and stop the execution as if you used "break" or set a breakpoint in the debugger's web GUI.
    118 However, these code breakpoints will have to be removed again for final versions of code because the exception will not be cleared if the debugger is not enabled!
    119 Maybe we will add this to some kind of "assert" function which will not affect release builds.
     111The debugger will clear the exception and stop the execution as if you used "break" or set a breakpoint in the debugger's web GUI. However, these code breakpoints will have to be removed again for final versions of code because the exception will not be cleared if the debugger is not enabled! Maybe we will add this to some kind of "assert" function which will not affect release builds.
    120112
    121113=== Debugger settings ===
    122 The debugger supports some settings that allow you to change its behaviour.
    123 These settings are not included in the web GUI at the moment and you have to type some URLs in your browser manually to change them.
     114The debugger supports some settings that allow you to change its behaviour. These settings are not included in the web GUI at the moment and you have to type some URLs in your browser manually to change them.
    124115
    125116==== Simultaneous thread break ====
    126 It's enabled by default and means that if one thread stops (because of a breakpoint for example), the debugger will try to stop all other threads too.
    127 Note: Setting it to false should work but isn't very well tested.
     117It's enabled by default and means that if one thread stops (because of a breakpoint for example), the debugger will try to stop all other threads too. Note: Setting it to false should work but isn't very well tested.
     118
    128119{{{
    129120http://127.0.0.1:9000/SetSettingSimultaneousThreadBreak?Enabled=false
    130121}}}
     122==== Break on exception ====
     123It's enabled by default and means that the debugger will stop script execution if any exception is thrown. Even if you disable it, the debugger will still trigger breakpoints exceptions with the message "Breakpoint".
    131124
    132 ==== Break on exception ====
    133 It's enabled by default and means that the debugger will stop script execution if any exception is thrown.
    134 Even if you disable it, the debugger will still trigger breakpoints exceptions with the message "Breakpoint".
    135125{{{
    136126http://127.0.0.1:9000/SetSettingBreakOnException?Enabled=false