Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 51884

Summary: Feature request: More flexible debug hierarchy
Product: [Eclipse Project] Platform Reporter: Cameron Stevens <cameron.stevens>
Component: DebugAssignee: Luc Bourlier <eclipse>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipse, eharris, stevenyj, turnham
Version: 2.1.2   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 44724    
Bug Blocks: 75280    

Description Cameron Stevens CLA 2004-02-12 14:09:55 EST
Currently, the debug model is restricted to something like:

Launch
   Target
      Thread
         Stack Frame

It would be nice to have a little more flexibility.  The device I am targeting 
has a more hierarchical structure, and it would be nice to reveal this in the 
Debug view.  In my case, I would like to express something more like:

Launch
   Target 1
      Chip 1
          Core 1
              Node 1
                  Thread 1
                     Stack Frame 1

Perhaps if IDebugElements were self-aggregating, this would be sufficient.
Comment 1 Darin Wright CLA 2004-02-12 17:20:42 EST
Need to investigate impact for 3.0
Comment 2 Darin Wright CLA 2004-03-09 13:40:30 EST
Deferred for post 3.0 consideration.
Comment 3 Darin Wright CLA 2004-08-26 13:02:02 EDT
Consider in 3.1
Comment 4 Darin Wright CLA 2004-09-29 10:03:41 EDT
In order to support a flexible presentation/hierarhcy in the debug view, we 
intend to support a "debug view content providers" extension point. The 
extension will contribute an ITreeContentProvider for a debug model, which 
will be consulted to retrieve children for debug elements from that model. The 
root element will still be an IDebugTarget, but past that, the content 
provider can provide an arbitrary structure.

The Java debugger will use this feature to support bug 75280.
Comment 5 Darin Wright CLA 2004-09-29 12:14:34 EDT
I have released an initial implementation to HEAD.

* added debugViewContentProviders extension point and schema
* added DefaultDebugViewContentProvider class to org.eclipse.debug.ui
* added "empty" content provider/extension for Java debugger 
(JavaDebugContentProvider)
* enhanced LaunchViewContentProvider to delegate to model specific content 
providers
* modified LaunchConfigurationPresentationManager to load/manage debug view 
content provider extensions
Comment 6 Darin Wright CLA 2004-10-13 14:58:58 EDT
Issue: the content provider is based on debug model, which precludes debug 
models that wrapper a model to inherit the content provider specific to a 
model.
Comment 7 Darin Wright CLA 2004-10-15 11:16:56 EDT
Erin, we have added this feature (pluggable debug hierarchy) to the debug 
platform, to allow debug models to provide custom element hierarchies in the 
debug view.

Rather than changing the model, we have left this as a presentation issue. For 
example, the use case we have with the Java debugger is to integrate extra 
information into the debug view to show the monitors (locks) owned by a 
thread. The locks are shown as children of a thread (before stack frames), 
whem the "Show Monitors" option is turned on in the debug view.

The issue is that the feature only works for non-wrappered debug models, since 
the content provider is contributed for a specific debug model. The elements 
displayed are not "core model elements", but rather UI elements representing 
the locks.

Do you think models that wrapper our Java debugger will want/need to display 
the same information?
Comment 8 Erin Harris CLA 2004-10-15 11:37:31 EDT
In general, wrapper debuggers would want to display this information as well
since their purpose is to add functionality to the Java debugger without losing
any of the features that it already has.
Comment 9 Darin Wright CLA 2004-10-19 14:14:53 EDT
I'm not sure we can make this work for wrappering models - as we would end up 
mixing elements from different debug models. Currently, everything in a "java 
adapter" wrappers the underlying Java debug model.

For example, our content provider retrieves children for IJavaThread's, and it 
returns the monitor information elements as well as IJavaStackFrames. You 
would need a mixed list of the monitor elements and your wrappering stack 
frames (and our model knows nothing of the wrapper).

One possible solution is to contribute a content provider for an adapter - 
i.e. for elements that provide and adapter of a specific type such as 
IJavaThread. Needs more investigation. 
Comment 10 Darin Wright CLA 2004-10-19 16:30:15 EDT
Fixed. Changed the extension point to contribute a content provider for 
arbitrary elements in the debug view based on an enablement expression. The 
extension point must have an id that uniquely identifies it.

Changed the Java contribution to be applicable to objects that have 
IJavaThreadAdapters or are instances of IJavaMonitorElement (which I added as 
a tagging interface for our extra debug elements).

Changes in LaunchConfigurationPresentationManager, LaunchViewContentProvider, 
JavaDebugContentProvider, (added) IJavaMonitorElement, JavaContendedMonitor, 
JavaOwnedMonitor, JavaOwningThread, JavaWaitingThread, plugin.xml, and schema 
for debugContentProviders.

Will file a new bug to update the monitor manager/elements to have back 
pointers to the apporpriate parent element (from a wrapper model).
Comment 11 Darin Wright CLA 2004-10-19 16:31:06 EDT
Please verify, Luc.
Comment 12 Darin Wright CLA 2004-10-20 10:49:56 EDT
This support is going to change to support deferred content generation in 
debug views.
Comment 13 Darin Wright CLA 2004-10-22 11:36:03 EDT
To support background content in debug views, the debug view has changed to 
use a workbench content provider via IWorkbenchAdapters and 
IDeferredWorkbenchAdapaters. I removed the debugViewContentProviders extension 
point. Instead, models wishing to provide custom content can provide 
IWorkbenchAdapters and/or IDeferredWorkbenchAdapater for appropriate elements.

The Java debugger provdies an IDeferredWorkbenchAdapter for IJavaThread to 
provdide extra monitor information, as well as adapters for its monitor 
information elements.
Comment 14 Darin Wright CLA 2004-10-22 15:54:23 EDT
Fixed. Please verify, Luc. (There are many changes)

@see DeferredContentProvider, and hierarchy of DeferredMonitorElement. The 
java debugger provides IDeferredWorkbenchAdapters for Java Thread and the 
monitor information elements.

I will file a new bug to address the issue of displaying the monitor 
information for models that wrapper the java debugger (which is a seperate 
issue - support for a flexible hierarchy now exists).
Comment 15 Darin Wright CLA 2004-10-22 15:55:17 EDT
Also see DebugElementWorkbenchAdapter, a public class that can be subclassed 
by adapters provided by other debug models.
Comment 16 Luc Bourlier CLA 2004-10-25 20:05:34 EDT
Verified.