[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-debug-dev] Possible Bug in Launching Java Applications (Eclipse 3.1)?
|
>
> My plug-in uses JDT to launch programmatically Java applications.
> The plug-in also adds breakpoints to the launched apps and registersa
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)
When do you create/add the breakpoints? If you create them after the
launch, the target execution may complete before you add the breakpoints.
I notice that you have commented out the line to "stop in main" which look
suspicious.
Note that JavaLineBreakpoint is a private internal implementation class
that is not intended to be subclassed by other plugins.
If you could provdide us with a reproduceable (small) example, it would be
easier to diagnose the problem.
Darin