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

Bug 106212

Summary: [plan item] New source lookup for debugging Eclipse applications
Product: [Eclipse Project] PDE Reporter: Mike Wilson <Mike_Wilson>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P4 CC: gunnar, pascal
Version: 3.1Keywords: plan
Target Milestone: 3.2 M5   
Hardware: All   
OS: All   
Whiteboard:

Description Mike Wilson CLA 2005-08-05 12:57:34 EDT
The default source lookup mechanism for debugging Java applications has scalability issues since the 
debugger may needing to scan a list of hundreds of plug-in projects each time it look up a source file. 
PDE should provide its own source path computer to which the debugger can delegate the task of locating 
source files. In addition to faster lookups, the PDE-based approach will be better positioned to handle 
duplicate source files on the same source path. It would also allow the user to easily debug plug-ins 
against different targets without having to change the Target Platform in the preferences. [PDE, Debug, 
Core]
Comment 1 Wassim Melhem CLA 2006-01-29 00:37:14 EST
The interesting discussion took place in bug 65614.

Source lookup when debugging all PDE launch configurations (Eclipse App, Equinox and Plugin/JUnit) now uses a source lookup mechanism that is faithful to the OSGi classloader.

The solution involved a new source lookup director, which extends the standard lookup director.

Here is how it works:
1. The debugger hits a breakpoint.
2. The director receives a stack frame object (IJavaStackFrame) for which it has to locate the source.
3. the director retrieves the classloader associated with the stack frame.
This classloader is an instance of org.eclipse.core.runtime.adaptor.EclipseClassLoader and carries a member variable (hostdata) which holds the name/version/location of the bundle associated with this classloader.

4. PDE uses this info to zero in on the project/package fragment root/external archive containing the source for this bundle and returns it.

This new source lookup is much faster than the standard linear Java lookup as it knows exactly where to look for source and what projects/libraries are involved.

It is also very accurate and is not fooled by Java files by the same qualified name in the workspace.

As a luxury bonus feature, you can now even debug an entire Eclipse Application, including stopping in Main, without having a single project in your host workbench.
Comment 2 Wassim Melhem CLA 2007-01-29 00:33:43 EST
I meant to cross-reference bug 65164 in comment 1