Saturday 3 August 2013

26:view

Learning Objectives
After completing this session, you will be able to describe the process of debugging Web
applications using the following views in SDE:
‰  Breakpoint view
‰  Console view
‰  Debug view
‰  Display view
‰  Expressions view
‰  Registers view
Breakpoint View
‰  Breakpoints are indicators to the debugger that it should stop execution at specific
places in the code, and let you step through it.
‰  A breakpoint causes the execution of a thread to suspend at the location where the
breakpoint is set.
‰  Breakpoints view lists all the breakpoints you have set in the workbench projects.
‰  In this view, you can double-click a breakpoint to display its location in the editor.
‰  You can also enable or disable breakpoints, delete them, or add new ones.
‰  Breakpoints can be set to trigger always or when a certain condition has been met.
‰  The Breakpoints view lists Java exception breakpoints, which suspend execution at
the point where the exception is thrown. You can add or remove exceptions.
‰  To add a breakpoint in the code, do the following:
‰  Open the file in the Java editor
‰  Place your cursor in the grey bar (along the left edge of the editor area) on the line
‰  Double-click to set a breakpoint and a marker will be shown at the line
Console View
This view shows the output of the execution of your program and allows you to enter input for the
program.
The console shows three kinds of text, each in a different color:
‰  Standard output
‰  Standard error
‰  Standard input
You can choose the different colors for these kinds of text on the preferences pages. (Window >
Preferences > Run/Debug > Console).
Debug View
‰  This view allows you to manage the debugging or running of a program in the
workbench.
‰  It displays the stack frame for the suspended threads for each target you are
debugging.
‰  Each thread in your program appears as a node in the tree.
‰  It displays the process for each target you are running.
‰  If the thread is suspended, then its stack frames are shown as child elements.
Display View
‰  This view displays the result of evaluating an expression in the context of the current
stack frame.
‰  You can evaluate and display a selection eitherfrom the editor or directly from the
Display view.
Expressions View
‰  Data can be inspected in the Expressions view.
‰  You can inspect data from a scrapbook page,a stack frame of a suspended thread,
and other places.
‰  The Expressions view opens automaticallywhen the Inspect command is activated.
Registers View
‰  You can view the contents of a register from the Registers view.
‰  To view the contents of a register in the Register view:
‰  In the Debug view, select the thread for which you want to view the registers.
‰  In the Registers view, expand the register group that you want to view.
‰  If necessary, use the scroll bars or PageUp and PageDown keys to scroll the Register
view until the register is visible.
‰  Nodes in the Registers view are visible if theyare at the top level of the tree structure,
or if the nodes at a level higher have been expanded.
‰  For all nodes that are visible in this view, you can jump to a specific node by typing the
first letter of the node.
‰  The view will jump to the next node that begins with that letter.
Tips and Tricks:
When a thread is suspended, how the execution ofa Java program is stepped through line by line
using SDE?
Solution:
‰  When a thread is suspended, the step controls can be used to step through the
execution of the program line-by-line.
‰  Step Over: The currently selected line is executed and suspends on the next
executable line. Click on Run > Step Over in the tool bar or press F6 key to perform
this operation.
‰  Step Into: The next expression on the currently selected line to be executed is
invoked, and execution suspends at the next executable line in the method that is
invoked. Click on Run > Step Into inthe tool bar or press F5 key.
‰  Step Return: Execution resumes until the next return statement in the current method
is executed, and execution suspends on the next executable line. Click on Run > Step
Return in the tool bar or press F7 key.
Summary
‰  Breakpoints view lists all the breakpoints you have set in the workbench projects.
‰  Console view shows the output of the execution of your program and allows you to
enter input for the program.
‰  Debug view allows you to manage the debugging or running of a program in the
workbench.
‰  Display view displays the result of evaluating an expression in the context of the
current stack frame.
‰  Data can be inspected in the Expressions view.
‰  Registers view displays the contents of a register.
Test Your Understanding
1.What is a Breakpoint?
a)Breakpoints are indicators to the debugger thatit should stop execution at specific places.
b)Breakpoints display variables applied in the code.
c)Breakpoints are used to exit fromcode abruptly during execution.
d)All the above
e)How are stack frames of a suspended thread displayed in the Debug view?
a)Parent elements
b)Child elements

No comments:

Post a Comment