Hi,
My plug-in uses JDT to launch programmatically Java
applications. The plug-in also adds breakpoints to the launched apps and
registers a listener
to receive the notifications when the breakpoint is
hit. The plug-in was initially developed for Eclipse 3.0, but lately I have
been porting it to 3.1. I noticed
that when I add the breakpoints in 3.1, I don’t
receive breakpointHit- notifications from the Debug-plugin. I started
debugging the plug-in and noticed that
the launched application runs to completion before
the breakpoints are added, so the JDIDebugTarget.breakpointAdded doesn’t
actually add the breakpoint
to the debug target. This is strange because the same
code works in 3.0. I launch the application using following code:
DebugPlugin debugPlugin = DebugPlugin.getDefault();
debugPlugin.addDebugEventListener(new
DebugEventHandler());
ILaunchManager manager =
DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type =
manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy wc =
type.newInstance(null, "Profiling");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
javaProject.getElementName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
className);
//wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN,true);
ILaunchConfiguration config = wc.doSave();
ILaunch launch =
config.launch(ILaunchManager.DEBUG_MODE, null);
and the breakpoint are added using following code:
ProfileBreakpoint br = new
ProfileBreakpoint(resource, typeName, line, -1, -1, 0, false,
new HashMap(), UNKNOWN_MARKER);
debugTarget.breakpointAdded(br);
(Notice that ProfileBreakpoint is just a subclass
from the JavaLineBreakpoint)
I guess the error is in the launching architecture,
perhaps in the ILaunchManager.DEBUG_MODE?