1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 18:35:32 +02:00

[234296] - [source lookup] Source lookup open "<unknown>" editor after after launching two multiple duplicate debug sessions.

This commit is contained in:
Pawel Piech 2008-06-02 16:40:18 +00:00
parent 10580b5759
commit 68c2b37b32
2 changed files with 15 additions and 24 deletions

View file

@ -30,7 +30,8 @@ public class DsfSourceLookupDirector extends CSourceLookupDirector {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#initializeParticipants() * @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
*/ */
public void initializeParticipants() { @Override
public void initializeParticipants() {
addParticipants( new ISourceLookupParticipant[]{ new DsfSourceLookupParticipant(fSession) } ); addParticipants( new ISourceLookupParticipant[]{ new DsfSourceLookupParticipant(fSession) } );
} }

View file

@ -38,19 +38,18 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.ThreadSafe; import org.eclipse.dd.dsf.concurrent.ThreadSafe;
import org.eclipse.dd.dsf.debug.sourcelookup.DsfSourceLookupDirector;
import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.GdbPlugin;
import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants; import org.eclipse.dd.gdb.internal.provisional.IGDBLaunchConfigurationConstants;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.ISourceLocator; import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.LaunchConfigurationDelegate; import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
import org.eclipse.debug.core.sourcelookup.IPersistableSourceLocator2;
/** /**
* The shared launch configuration delegate for the DSF/GDB debugger. * The shared launch configuration delegate for the DSF/GDB debugger.
@ -197,30 +196,21 @@ public class GdbLaunchDelegate extends LaunchConfigurationDelegate
// because once the launch is created and added to launch manager, // because once the launch is created and added to launch manager,
// the adapters will be created for the whole session, including // the adapters will be created for the whole session, including
// the source lookup adapter. // the source lookup adapter.
ISourceLocator locator = getSourceLocator(configuration);
return new GdbLaunch(configuration, mode, locator); GdbLaunch launch = new GdbLaunch(configuration, mode, null);
launch.setSourceLocator(getSourceLocator(configuration, launch.getSession()));
return launch;
} }
private ISourceLocator getSourceLocator(ILaunchConfiguration configuration) throws CoreException { private ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session) throws CoreException {
String type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null); DsfSourceLookupDirector locator = new DsfSourceLookupDirector(session);
if (type == null) { String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
type = configuration.getType().getSourceLocatorId(); if (memento == null) {
locator.initializeDefaults(configuration);
} else {
locator.initializeFromMemento(memento, configuration);
} }
if (type != null) { return locator;
IPersistableSourceLocator locator = DebugPlugin.getDefault().getLaunchManager().newSourceLocator(type);
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
if (memento == null) {
locator.initializeDefaults(configuration);
} else {
if(locator instanceof IPersistableSourceLocator2)
((IPersistableSourceLocator2)locator).initializeFromMemento(memento, configuration);
else
locator.initializeFromMemento(memento);
}
return locator;
}
return null;
} }
/** /**