DebuggerImprovements

NetBeans 6 Debugger Improvements

There are two major debugger improvements in Netbeans 6. The first one called 'Expression Stepping' is a new fine-grade stepping feature that can be used for detailed expression inspection. The second improvement called 'Heap Walking' is an integration of profiler-like heap walker into debugging workflow.

Expression Stepping

When debugging an expression, you can use the Step Over Expression command to achieve a more fine-grained stepping than other debugging steps. Step Over Expression enables you to proceed through each method call in an expression and view the input parameters as well as resulting output values of each method call. You can invoke the Step Over Expression command just as you would any other step commands. If there are no further method calls, Step Over Expression behaves like the Step Over command.

Each method call in an expression has some input (parameters) and output values. Each time you use the Step Over Expression command in an expression, the debugger resumes VM execution and then stops before executing the next method call. You can inspect the output values for the previous method and the input parameters for the next method in the Local Variables window. Invoking Step Over Expression again resumes the VM execution until the next method call in the expression.

File:NB_ExprStepBefore_a2_DebuggerImprovements.png
Highlighted position before call to method 'getFactorial'. Method 'pow2' was already executed and it's returned value is available in the tooltip.

File:NB_ExprStepBefore_b2_DebuggerImprovements.png
Local Variables window informs you that the program counter is right before call to method 'getFactorial' and provide access to the list of arguments. Returned values of processed methods is displayed as well.

File:NB_ExprStepAfter_a1_DebuggerImprovements.png
Highlighted position after the return (step out) from method 'getFactorial'.

File:NB_ExprStepAfter_b1_DebuggerImprovements.png
Local Variables window informs you that the program counter is right after call to method 'getFactorial' and provide access to the returned value.


Expression stepping technology is also behind the implementation of Run Into Method action that suspends the execution after the specified method call has been entered. Run Into Method action can significantly simplify debugging of complex expressions.

Heap Walking

Heap walking is a well-known profiling approach to memory heap inspection of static memory snapshots. On the other hand, Heap Walker integrated in NetBeans debugger provides view of live heap data any time the application is suspended (e.g. on a breakpoint or after a step).

The support for heap walking functionality is available when running on JDK 6 and newer. 'Loaded Classes' view displays the list of classes loaded in the debugged virtual machine sorted by the instance count. Instance browser window can be opened on every class type, providing detailed information about the instances and referring objects. This is valuable for solving memory leaks.

File:Heap1a_DebuggerImprovements.png


The number of instanced in memory heap. This view is automatically updated while the application is running.

File:Heap3a_DebuggerImprovements.png
Class filter can be used to view just the instances in interest. A popup menu is available on each class type, 'Show In Instances View' action opens instance browser.

File:Heap2a_DebuggerImprovements.png
Instances window with the list of instances of the selected type and their referring objects.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo