Debugging code

The following controls are available to perform line-by-line debugging:

  • Pause/start debugging: The first control is used to toggle the active and off states of the debugger. The same, as stated earlier in the chapter, can be achieved by pressing the F2 key.
  • Resume script execution: The second icon is active only when the debugger is paused on a breakpoint. We can click on the resume script execution icon to continue (advance) the execution of the code from the current breakpoint or line to the next breakpoint, which could be in the same script or another server-side code for this interactive session and call trace. Keyboard shortcut: F9 key.
  • Step over next function call: The third icon in the list of control is used to advance from the current line to the next evaluated line in the script that executes on the server. Keyboard shortcut: F8 key. In the following code, we can notice that the line-by-line debugger is stepping inside the if condition block every time we submit the form. We can use the debugger to identify the error in our code and change the line gr.addQuery() to gr.addQuery("u_caller",current.u_caller);:
  • Step into next function call: The fourth control icon is used to advance into the first executable line of code within the method call. The user must have read-only access to the target method if it is in a different script file, otherwise the control will act as step over. Keyboard shortcut: F7 key.
  • Step out of current function: The fifth and the last control icon is used to exit the current method call and return to the calling line of code in the calling script from the list of call stack. The control will act as step over if the user doesn't have process access to the code in the call stack or the debugger is not within a method call. Keyboard shortcut: Shift + F8 key:
Make sure to remove breakpoints if you do not intend to further test your script using the logged-in user. This is to prevent any unplanned debugging alert and avoid confusion when debugging any other script.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.163.58