Wednesday Nov 21, 2007

JPDA (Java) Debugger Threads View Enhancements module on NetBeans Plugin Portal

I have uploaded the JPDA (Java) Debugger Threads View Enhancements module module to the NetBeans Plugin Portal.

Enhanced Threads View

This module unifies Threads and Call stack view (somewhat like Eclipse Java Debugger Threads View). The call stack frames are shown as the children of suspended thread in the Threads view. It supports same actions on as Call Stack view and more. For example, it shows actions to jump to types of local variable of a Call stackframe as well as the Show Classes action. It also shows full method signature of the Call stack frame. It additionally shows the actual class of the 'this' variable if it differs from the class that declares the method of the call stack frames.

The Show Classes action shows all the classes loaded in the JVM along with the loading and initiating ClassLoaders. This is useful for debugging class loading in multi-ClassLoder appications such as NetBeans itself.

Classes view


DISCLAIMER: This module is experimental. So no guarantees. Use the module at your own risk.

Monday May 21, 2007

Answer for Netbeans Teaser

In this blog entry I showed the following screenshot:

Debugger HeapWalker

Note: This functionality is available in recent (last weeks) NetBeans IDE build with JDK 6.

Here is the explaination of what is going on:

The screenshot shows the debugger stopped at a line in the contructor of class Foo. Foo has a member variable bar of type Bar which is an inner class of Foo. The Local Variables window show the this instance of type Foo and bar field of type Bar. Nothing new or interesting so far. Right clicking on the bar field's row in the Local Variables window reveals the Show References action in the popup menu. Invoking the Show references action shows the Instances window. The Instances window is the interesting bit. The Instances window shows three panes - Instances pane, Fields pane and References pane. The Instances pane shows all instances of type Bar. The Fields pane is analogous to the Local Variables window and shows the structure of the instance of Bar. The References pane shows the references to the selected instance of Bar. In this example the only reference to the instance pointed to by the bar field is the instance of Foo. I think this is huge! What this means is that I can look at the references to the objects while I am debugging my program. The ability to look at the references has been traditionally available in the Profiler tools such as HeapWalker. The differences is that the HeapWalker tool shows the static information from a heap dump file. The Instances window above shows the information from a live VM that is being debugged. This brings the power of Profiler like tools to the NetBeans debugger. I think this is very synergistic. For example, normally one can only look at the objects visible from the current stack frame in the Local Variables window. Using the Instances pane in the Instances window now it is possible to look at other instances of any reference type that may not be directly visible from the current stack frame. Similarly by using the fix&continue feature of the debugger it will be possible to debug memory leaks in certain scenarios.

There is also a Classes window which can be invoked using Windows:Debugger:Classes action. This is analogous to Classes window of the HeapWalker.

Small nit:

  • The #nnn numbers shown in the Instances pane of Instances window are not the same ad Unique Id# shown in the Local Variables window. I have already filed an RFE to display the debuger assigned Unique ids in the Instances window so that it will be easy to corelate the information those two windows.
  • The Fields pane shows information very similar to the Local Variables window. The two GUIs could be better unified.

Going forward I hope to see more and more integration of NetBeans debugger and profiler which will help integrate the profiling in the regular edit-compile-debug cycle.

Sunday May 20, 2007

NetBeans Teaser

What is going on in the following screenshot?

Hint: Study the areas marked by red rectangles.

Debugger Heapwalker

Answer in the next blog entry.




« February 2016