FeaturesPluginsDocs & SupportCommunityPartners

NetBeans 4.0 Debugger Changes - Users View

Author:
Jan Jancura

History:
  • 1.1 [2004/3/5] first version - discussed on debugger_core
  • 1.2 [2004/4/9] updated version
    • Step Into & Run to Cursor should still start debugging
    • Fix & Continue section removed. The action will work as in the nb36.
    • Kill Session action renamed to Finish Session
    • New Breakpoint dialog section added
    • Line Breakpoint paragraph added
  • 1.3 [2004/4/9]
    • Classes View paragraph added
  • 1.4 [2004/5/14]
    • static & inherited fields
    • fix & continue
    • breakpoint groups
    • Start New Session dialog removed
    • Breakpoint's stop property
  • 1.5 [2004/5/17]
    • Summarized support provided for Java 1.5
  • 1.6 [2004/5/18]
    • Source View description added
Abstract:
This document contains description of new features and UI changes planned for NB4.0 debugger modules. There are three main areas:
  • new project system planned for NB4.0
  • new debugger features:
    • Smart Stepping
    • Debugger Views filtering
    • multi language debugging + full JSR45 support
    • Better support for debugging of components
  • new Debugger API and complete rewrite of debugger modules

1. Integration with new projects

1.1 DebuggerTypes / Executor Types

NB3.x DebuggerType defines type of debugger to be used for some concrete file (debug as JSP, Applet, RMI, ...) and environment / settings for debugging (like main class, arguments, RMI port to use, etc).
In NB4.0 DebuggerType will be removed and ist functionality will be move to Project Type definition.

UI Components involved:
  • Tools / Options / Debugging and Executing / Debugger Types
  • Java Data Object - properties / Execution / Debugger & Executor
  • NB Debugger installs:
    • Default Debugging Debugger Type
    • Debugger Execution Executor Type
See Project System UI spec for more info.

1.2 Start Debugging, Step Into, Run to Cursor

NB3.x model:
Start Debugging Action, Step Into Action and Run to Cursor Action in NB3.x starts first debugging session. Next sessions can be started by Start Debugging action only.
These actions are "current file" sensitive. So user should select some file in Explorer or in Editor first.
NB4.0 model:
All these actions will not be current file sensitive, but main project sensitive. They will be disabled if there is no current debugger session.

1.3 Breakpoints and Watches

NB3.x model:
Breakpoints and watches are global for all projects, sessions and debugger types.
NB4.0 model:
New project system in the first version does not provide any representation for "application". Each project in NPS represents some module, but breakpoints should be logically connected with application, not module. That is why we have decided to have two types of breakpoints:
  • Java Line Breakpoint: will be associated with some concrete source file. One source file in NPS is associated with at most one project. So it means that Java Line Breakpoint will work in one project only.
  • other types of breakpoints (Exception Breakpoint, Class Load Breakpoint ...): will not be associated with projector file, and they will work in all projects.
Breakpoints View will show all breakpoints and Watches view shows all watches. So, from the UI point of view there will be one set of breakpoints and watches only. This set will be stored on some global place, and it stays untouched when some project is opened or closed, or if the main project is changed. This behaviuor is specific for NetBeans. Other IDEs based on NetBeans can change this default behaviour.

1.4 Sourcepath and scope of debugging

NB3.x model:
Classpath for debugger is defined by Debugger Type.
Sourcepath for debugger is defined by list of mounted visible (not hidden) filesystems - one global sourcepath customized by user.
How to find source: convert classname to resource name and evaluate it against FileSystems.
Problem 2 sources with the same class name - first source is used.
NB4.0 model:
Classpath defined by Project Type (see "stavbicka" users view).
Sourcepath contains all sources registered for given classpath, bootclasspath and platform. Project type can add specific roots to sourcepath.
How to find source: classname will be evaluated against sourcepath.
> Problem 2 sources with the same class name - source from main project will be used - there should be one source for given name only.

2. New Features

2.1 Smart Stepping

This feature covers two things:
  • Smart Stepping API: this api allows debugger plug-in to "hide" some code for execution - is means it forces JPDA debugger to NOT stop in some code which is normally accessible for execution. For example J2EE debugger will hide code generated for EJBs.
  • JPDA debugger uses Smart Stepping API to implement "do not stop if you do not have source" filter.
Stepping engine will be completely redesigned for nb40, but the UI impact should be small. NB3.x contains "Action on Step Into" dialog. It allows to define stepping behaviour: smart stepping (= "do not stop if you do not have source" filter), stop in sourceless classes or Step Out if source is not available.  As a new smart stepping implementation is solid and very fast these options are not useful any longer.

So, "Action on Step Into" dialog will be removed and smart stepping (= "do not stop if you do not have source" filter) will be default and the only one option (this is standard for most IDE's).

2.2 Filterring of Debugger Views

NB4.0 debugger allows plug-in providers to completely redefine content of all debugger views. Installed filter can change tree of nodes, display names, tooltips, icons, actions, properties and so on. Filters can be permanent or customizable. There is no UI restricitons and plug-in provider is responsible for complete & smooth integration of filter to nb debugger. There should be somegeneral suggestion how to integrate filter custonizer (if the filter is customizable) to IDE.  I see two basic possibilities.

Possibility 1: Fine grained customization

  • Filter customizer will be installed to pop-up menu of filterred view. There will be some submenu called "Filter" for this purpose.
  • Simple JRadioButtonMenuItem and JCheckBoxMenuItem should be used to switch on / off filters.
  • JMenuItem can be used for some comples filters with visual (JPanel) customizers.
Examples:
Callstack View pop-up:                             Variables View pop-up:

----------------- ---------------------
|Make Current | |Create Fixed Watch |
|Pop to Here | |-------------------| ---------------------------------------
|---------------| ------------------------------ |Filter > | | o Hide JSP expressions |
|Filter > | | O Hide J2EE Server Frames | |List Options > | | Customize Java Libraries Filter ... |
|List Options > | | x Hide Sourceless Frames | --------------------- | Add Custom Filter ... |
----------------- | .... | ... |


------------------------------------
| Java Libraries Filter Customizer |
------------------------------------
| x Use Hashmap Filter |
| x ArrayList Filter |
| x JComponent Filter |
| ... |
This solution seens too complex for me. I suppose that for 80% of users Logical View is all they need. And there can be possibility to switch back to Physical View.

Possibility 2: Rough customization

There can be only one common customizer for all filters: switch all filters on / of.
                Callstack View pop-up:   

-----------------
|Make Current |
 |Pop to Here |
|---------------|
|x Logical view |
|List Options > |
-----------------
I prefer second possibility.

2.3 Multi language debugging (Full JSR45 support)

NB40 debugger supports switching among different languages - muliti language debugging.  Each session will have "Language" property, and set of currently available languages.
                ---------------------------------------------
|Session View | Session pop-up:
|-------------------------------------------|
| Name | State | Language | ---------------------
|-------------------------------------------| | Make Current |
| Hello World | On Breakpoint | JSP V | | Finish | --------------
| J2EE Server | Running | Java V | | Language > | | x Java |
| ... | |-------------------| | JSP |
| List Options > | | Bytecode |
--------------------- --------------
Current language can be changed from:
  • TreeTable - column "Language". ComboBox will be used to select current language here.
  • Session node pop-up menu - "Language" submenu.
All other debugger UI components depends on current language property. Threads View, Callstack View, Locals View, Editor & current line and Watches View are updated when current language is changed.

2.4 Better support for debugging of J2EE components

NB3.x debugger is focused on debugging of one application on in one JVM. But J2EE use little bit different model. There are many components running in one server (~one JVM). And user typically needs to debug one component not application (server).

NB3.x model:
  • Breakpoint stops all threads when the even occures.
  • Step ... Actions starts & stops all threads.
  • Continue resumes all threads.
  • Pause stops all threads.
This model does not work if you would like to debug one component only.
NB4.0 model:
We plan to add one switch to Java Session defining scope of debugging:
          Session pop-up:
---------------------
| Make Current |
| Finish | --------------------------
| Scope > | | x Debug All Threads |
| Language > | | Debug Current Thread |
|-------------------| --------------------------
 | List Options > |
---------------------

And each Java breakpoint will have Stop property. Stop property offers three choices:
  • <none> : do not stops debugger on this breakpoint, breakpoint can print some message to Debugger Output only.
  • <current thread>: stops one thread which has invoked the breakpoint
  • <all threads>: stops all threads like in nb36.

2.5 Customize Action and Properties Action

NB3.x model:
Properties View has been used as a standard customizer for all debugger nodes - thread node, session node, watch node, ...
In NB3.5 the Properties View has been integrated to Debugger Window. NB3.6 does not contain Debugger Window and all Debugger Views use separate independent TopComponents. Properties View can be opened from nodes pop-up menu.
Motivation for change:
Properties View is not optimal visual component for customization of complex items like breakpoint. For simple items like Callstack Frame its not useful at all. Callstack Frame has three read only properties. All of them are visible in Callstack View, so there is no reason to duplicate them in Properties View again.
NB4.0 model:
We will use visual customizers (panels) for customization of complex items. Properties Action for simple items will be removed. All properties should be accessible through the Debugger View in this case, so there will be no regression in feature set.
  • Customize Action will be added to the pop-up menu of the breakpoint (all breakpoint types). The breakpoint customizer component will be the same as a component used in New Breakpoint Dialog, so we do not need some special UI spec for it.
  • Customize Action will be added to the pop-up menu of the watch. The watch customizer component will be the same as a component used in New Watch Dialog, so we do not need any special UI spec for it.

2.6 Finish Debugging Dialog, Finish Action

UI Components involved:
  • Finish Debugging Dialog - will be removed
  • Finish Sessions Action (menu, toolbar) - will be renamed to Finish Session
  • Tools Options - some properties removed
NB3.x model:
There is one "global" action Finish Sessions in NB3.x debugger. It opens Finish Debugging Dialog. Finish Debugging Dialog allows to specify sessions to be finished and sessions which should survive.
Motivation for change:
This functionality has been recognized as not very useful, and it is problematic for some debugger plug-ins (dbx mainly). Different debugger plug-ins have different methods how to "finish" sessions - kill, finish & restart, disconnect... FDD does not allow to specify method to be used. So we have decided to replace global action by some context sensitive one.
NB4.0 model:
  • Finish Session Action will be added to toolbar and menu on the place of Finish Sessions Action. It will be current session sensitive.

2.7 Debugger Settings changes

This chapter is about Tools / Options / Debugging and Executiong / Debugger Settings node.

Debugger Settings
  • Show Finish Debugger Dialog: will be removed see 2.6
  • Run Multisession: will be removed see 2.11
  • Show Run Multisession Dialog: will be removed see 2.11
  • Java
    • Run Compilation: removed and moved to NPS - see 1.2
    • Action on Step Into: removed, see 2.1
    • Show Action on Step Into Dialog: removed, see 2.1

2.8 Attach to ... Dialog

NB3.x model:
Attach to ... dialog contains list of Attaching Connectors provided by JDK JPDA platform.
Listening Connectors are not supported.
NB4.0 model:
List of Listening Connectors will be added to Attach to ... dialog.
Attach to dialog starts debugging for remote process in the context of the Main Project selected in Explorer.

2.8 New Breakpoint Dialog

NB3.6 NBD contains special ComboBox selectors for Package Name, Class Name, and Method Name.  This feature will be dropped for NB40. We had some performance problems in the old version, and this performance problems becames much harder to solve in new projects infrastructure (there are more projects open - more packages accessible.
NB40 New Breakpoint Dialog will contain simple text fields for package name, class name, field name, method name etc. They will be prefiled with current context information.
                  --------------------- 
Package Name: | org.netbeans.a |v|
---------------------
| org.netbeans.b |
| org.netbeans.cc |
| org.netbeans.ddd |
---------------------

2.9 Line Breakpoint


NB3.x model:
Line Breakpoint is defined by [package name, line number]. It means that is can be associated with more than one source file.
NB4.0 model:
Line Breakpoint is defined by [source file, line number]. And Line Breakpoint can be added to any source file form any project. But it can not be added to file which is not a part of any project.
Thats why the old Line Breakpoint Panel in New Breakpoint Dialog is unusable. We have decided to remove this panel. It can not be used for adding line breakpoint - user do not see source. Its currently used for customizing other properties of line breakpoint. But this functionality will be accessible in breakpoint customizer panel.
                ----------------------------------------------
| Line Breakpoint Customizer |
|--------------------------------------------|
| -Settings -------------------------------- |
| | | |
| | Project: x read only text field x | | // contains name of project the file is in
| | Source Name: x read only text field x | | // contains relative name of file like: /org/netbeans/debugger/HelloWorld.java
| | Line Number: x read only text field x | |
| | Condition: x text field x | |
| |----------------------------------------| |
| |
| -Actions --------------------------------- |
| | | |
| | x Suspend Debugging | |
| | x Print Text: x text field x | |
----------------------------------------------
The same panel (but with read / write text fields) can be used for NBD too, but its still open issue. Toggle Breakpoint Action will be added to global Run menu.

2.10 Classes View

Classes View will be simplified. NB36 Classes View contains list of methods and fields. This is duplicate information to the standard Explorer, so we have decided to remove it. New Classes View will contain tree of class loaders, packages and  classes.

2.11 Support for Java Tiger release 1.5

2.11.1 Expression evaluator

Expression evaluation was completely rewritten and now supports new syntax of Java 1.5. New language features that are relevant to and supported by the debugger are:
  • Auto boxing/unboxing: Debugger automaticaly wraps/unwraps primitive types to/from their wrapper types if necessary when calling a method. This conversion should be done in accordance to the Java language specification V3.
  • Varargs: Debugger supports calling of methods declared taking variable number of arguments.
  • Static imports: While resolving static method and field names expression evaluator now consults the new static imports just like it consults normal imports while resolving types.
  • Generic casts: Evaluator now supports casting to generic types, eg. (List<String>) list

2.11.2 Debugger views

There is 1 view that is affected by the new 1.5 features: the Locals view. This view was enhanced to display generic signatures for parametrized types (when available) in the Type column. When both debugger and debugee are running at least Java 1.5 and a field or a local variable has a generic signature, this signature is displayed in the Type column in accordance to the generic types syntax, eg. List<String>.

2.12 Sources View

Project defines some basic source path for debugger. Sources View allows to change this source path during debugging and define exactly sources used in debugger.

Sources View contains two types of items:
  • Source Path Root: folred / jar file / zip file containing sources for debugger. User can ennable / disable it for debugging. The original set of source roots is defined by Project Type, and used can not remove original source roots. They can be disabled only.
  • Class Exclusion Filter: Defines packages and classes that should be hidden for debugging (Step actions should not stop there). Examples: java.*, examples.ted.Ted.
Actions:
  • Add Class Exclusion Filter: Global action. Pop-ups input line dialogs. Allows to create a new Class Exclusion Filter.
  • Delete: Allows to delete Class Exclusion Filter.

2.13 Other chages

  • Valid property removed from breakpoint node.
  • All In One View removed.
  • Grouping of breakpoints is simplyfied. Breakpoint group can not contain another group. The name of group is a property of breakpoint. User can select several breakpoints (from all existing groups), and invoke "Set Group Name" action form popu menu. Input Line dialog is opened and than you can specify a new name of group for all selected breakpoints.
    Cut & Paste will be removed from breakpoint nodes.
  • Start New Session Dialog removed. Session can be finished by Finish Session action. And Run in Debugger action will always start a new session.
  • Static and Inherided fields will be accessible in Locales View and Watches  View in special subnodes.
       Variable
    |
    |- Static
    | |- <list of all static fields from this class and all superclasses>
    |
    |- Inherited
    | |- <list of all inherited fields from all superclasses>
    |
    |- <list of all fields defined in this class without without fields defined in superclassess>


  • Fix & Continue simplyfied.  This feature will not pop-up any dialogs. When its invoked it:
              • recompile current file
              • uploads all changes to JVM
              • pops up one frame form deprecated current frame


Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by