mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 00:45:28 +02:00
Improvements to the Executables manager including work for bug 253778.
This commit is contained in:
parent
b9deab734a
commit
55a0d30355
5 changed files with 52 additions and 13 deletions
|
@ -71,6 +71,15 @@ public class Executable extends PlatformObject {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object arg0) {
|
||||||
|
if (arg0 instanceof Executable)
|
||||||
|
{
|
||||||
|
Executable exe = (Executable)arg0;
|
||||||
|
return exe.getPath().equals(this.getPath());
|
||||||
|
}
|
||||||
|
return super.equals(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
private IPath path;
|
private IPath path;
|
||||||
private IProject project;
|
private IProject project;
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -143,7 +152,7 @@ public class Executable extends PlatformObject {
|
||||||
String filename = symReaderSources[i];
|
String filename = symReaderSources[i];
|
||||||
String orgPath = filename;
|
String orgPath = filename;
|
||||||
|
|
||||||
filename = ExecutablesManager.getExecutablesManager().remapSourceFile(filename);
|
filename = ExecutablesManager.getExecutablesManager().remapSourceFile(this, filename);
|
||||||
|
|
||||||
// Sometimes the path in the symbolics will have a
|
// Sometimes the path in the symbolics will have a
|
||||||
// different
|
// different
|
||||||
|
@ -222,7 +231,7 @@ public class Executable extends PlatformObject {
|
||||||
public String getOriginalLocation(ITranslationUnit tu) {
|
public String getOriginalLocation(ITranslationUnit tu) {
|
||||||
String orgLocation = remappedPaths.get(tu);
|
String orgLocation = remappedPaths.get(tu);
|
||||||
if (orgLocation == null)
|
if (orgLocation == null)
|
||||||
orgLocation = tu.getPath().toOSString();
|
orgLocation = tu.getLocation().toOSString();
|
||||||
return orgLocation;
|
return orgLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,14 +170,18 @@ public class ExecutablesManager extends PlatformObject {
|
||||||
DebugPlugin.log( e );
|
DebugPlugin.log( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collection<Executable> exes = executables.values();
|
|
||||||
return exes.toArray(new Executable[exes.size()]);
|
synchronized (executables)
|
||||||
|
{
|
||||||
|
Collection<Executable> exes = executables.values();
|
||||||
|
return exes.toArray(new Executable[exes.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String remapSourceFile(String filePath) {
|
public String remapSourceFile(Executable executable, String filePath) {
|
||||||
synchronized (sourceFileRemappings) {
|
synchronized (sourceFileRemappings) {
|
||||||
for (ISourceFileRemapping remapping : sourceFileRemappings) {
|
for (ISourceFileRemapping remapping : sourceFileRemappings) {
|
||||||
String remappedPath = remapping.remapSourceFile(filePath);
|
String remappedPath = remapping.remapSourceFile(executable, filePath);
|
||||||
if (!remappedPath.equals(filePath))
|
if (!remappedPath.equals(filePath))
|
||||||
return remappedPath;
|
return remappedPath;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +249,9 @@ public class ExecutablesManager extends PlatformObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean executableExists(IPath exePath) {
|
public boolean executableExists(IPath exePath) {
|
||||||
return executables.containsKey(exePath.toOSString());
|
synchronized (executables) {
|
||||||
|
return executables.containsKey(exePath.toOSString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getSourceFiles(final Executable executable,
|
public String[] getSourceFiles(final Executable executable,
|
||||||
|
@ -320,4 +326,8 @@ public class ExecutablesManager extends PlatformObject {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRefreshNeeded(boolean refresh) {
|
||||||
|
refreshNeeded = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,6 +19,6 @@ package org.eclipse.cdt.debug.core.executables;
|
||||||
*/
|
*/
|
||||||
public interface ISourceFileRemapping {
|
public interface ISourceFileRemapping {
|
||||||
|
|
||||||
String remapSourceFile(String filePath);
|
String remapSourceFile(Executable executable, String filePath);
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.IBinaryParser;
|
import org.eclipse.cdt.core.IBinaryParser;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.core.filesystem.EFS;
|
import org.eclipse.core.filesystem.EFS;
|
||||||
|
@ -39,7 +40,9 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.content.*;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||||
|
import org.eclipse.core.runtime.content.IContentTypeSettings;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
|
||||||
public class StandardExecutableImporter implements IExecutableImporter {
|
public class StandardExecutableImporter implements IExecutableImporter {
|
||||||
|
@ -96,7 +99,12 @@ public class StandardExecutableImporter implements IExecutableImporter {
|
||||||
store = store.getChild(newProjectHandle.getName());
|
store = store.getChild(newProjectHandle.getName());
|
||||||
for (String deleteName : ignoreList) {
|
for (String deleteName : ignoreList) {
|
||||||
IFileStore projFile = store.getChild(deleteName);
|
IFileStore projFile = store.getChild(deleteName);
|
||||||
projFile.delete(EFS.NONE, null);
|
projFile.delete(EFS.NONE, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
IFileStore[] children = store.childStores(EFS.NONE, new NullProgressMonitor());
|
||||||
|
for (IFileStore fileStore : children) {
|
||||||
|
if (fileStore.fetchInfo().isDirectory())
|
||||||
|
fileStore.delete(EFS.NONE, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
exeProject = CCorePlugin.getDefault().createCProject(description, newProjectHandle, null, DEBUG_PROJECT_ID);
|
exeProject = CCorePlugin.getDefault().createCProject(description, newProjectHandle, null, DEBUG_PROJECT_ID);
|
||||||
} catch (OperationCanceledException e) {
|
} catch (OperationCanceledException e) {
|
||||||
|
@ -224,8 +232,20 @@ public class StandardExecutableImporter implements IExecutableImporter {
|
||||||
// Make sure the project has this parser
|
// Make sure the project has this parser
|
||||||
ICProjectDescription pd = CCorePlugin.getDefault().getProjectDescription(exeProject);
|
ICProjectDescription pd = CCorePlugin.getDefault().getProjectDescription(exeProject);
|
||||||
try {
|
try {
|
||||||
pd.getDefaultSettingConfiguration().create(CCorePlugin.BINARY_PARSER_UNIQ_ID, parserID);
|
boolean existsAlready = false;
|
||||||
CCorePlugin.getDefault().setProjectDescription(exeProject, pd, true, new NullProgressMonitor());
|
ICConfigExtensionReference[] parsers = pd.getDefaultSettingConfiguration().get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||||
|
for (ICConfigExtensionReference configExtensionReference : parsers) {
|
||||||
|
if (configExtensionReference.getID().equals(parserID))
|
||||||
|
{
|
||||||
|
existsAlready = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!existsAlready)
|
||||||
|
{
|
||||||
|
pd.getDefaultSettingConfiguration().create(CCorePlugin.BINARY_PARSER_UNIQ_ID, parserID);
|
||||||
|
CCorePlugin.getDefault().setProjectDescription(exeProject, pd, true, new NullProgressMonitor());
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||||
|
|
||||||
public class StandardSourceFileRemapping implements ISourceFileRemapping {
|
public class StandardSourceFileRemapping implements ISourceFileRemapping {
|
||||||
|
|
||||||
public String remapSourceFile(String filePath) {
|
public String remapSourceFile(Executable executable, String filePath) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object[] foundElements = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().findSourceElements(filePath);
|
Object[] foundElements = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().findSourceElements(filePath);
|
||||||
|
|
Loading…
Add table
Reference in a new issue