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:
parent
10580b5759
commit
68c2b37b32
2 changed files with 15 additions and 24 deletions
|
@ -30,6 +30,7 @@ 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()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void initializeParticipants() {
|
public void initializeParticipants() {
|
||||||
addParticipants( new ISourceLookupParticipant[]{ new DsfSourceLookupParticipant(fSession) } );
|
addParticipants( new ISourceLookupParticipant[]{ new DsfSourceLookupParticipant(fSession) } );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,31 +196,22 @@ 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) {
|
|
||||||
type = configuration.getType().getSourceLocatorId();
|
|
||||||
}
|
|
||||||
if (type != null) {
|
|
||||||
IPersistableSourceLocator locator = DebugPlugin.getDefault().getLaunchManager().newSourceLocator(type);
|
|
||||||
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
|
String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
|
||||||
if (memento == null) {
|
if (memento == null) {
|
||||||
locator.initializeDefaults(configuration);
|
locator.initializeDefaults(configuration);
|
||||||
} else {
|
} else {
|
||||||
if(locator instanceof IPersistableSourceLocator2)
|
locator.initializeFromMemento(memento, configuration);
|
||||||
((IPersistableSourceLocator2)locator).initializeFromMemento(memento, configuration);
|
|
||||||
else
|
|
||||||
locator.initializeFromMemento(memento);
|
|
||||||
}
|
}
|
||||||
return locator;
|
return locator;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively creates a set of projects referenced by the current project
|
* Recursively creates a set of projects referenced by the current project
|
||||||
|
|
Loading…
Add table
Reference in a new issue