Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorKen Ryall2008-04-10 15:26:57 +0000
committerKen Ryall2008-04-10 15:26:57 +0000
commit027bd802aa3c8f094f8fbaabcd2d96d63cf63214 (patch)
treea4f35a726ef0cc06cbf1050f5685d5e7d66b5039 /debug
parent3a72e413b238a7011515404339bf9b9977f0a897 (diff)
downloadorg.eclipse.cdt-027bd802aa3c8f094f8fbaabcd2d96d63cf63214.tar.gz
org.eclipse.cdt-027bd802aa3c8f094f8fbaabcd2d96d63cf63214.tar.xz
org.eclipse.cdt-027bd802aa3c8f094f8fbaabcd2d96d63cf63214.zip
Better support for breakpoints in external files.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java5
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java33
2 files changed, 36 insertions, 2 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
index ee2330daa8..a1e4dfc7a7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 QNX Software Systems and others.
+ * Copyright (c) 2004, 2007, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -218,6 +218,9 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
else if ( sourceElement instanceof IStorage ) {
sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString();
}
+ else if ( sourceElement instanceof ITranslationUnit ) {
+ sourceHandle = ((ITranslationUnit)sourceElement).getLocation().toOSString();
+ }
String bpSourceHandle = ((ICLineBreakpoint)breakpoint).getSourceHandle();
if ( sourceElement instanceof LocalFileStorage ) { // see bug #112008
try {
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java
index e33aa6072b..f4333eb4c9 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/MapEntrySourceContainer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 QNX Software Systems and others.
+ * Copyright (c) 2004, 2005 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,15 +11,23 @@
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File;
+import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.internal.core.model.ExternalTranslationUnit;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.containers.AbstractSourceContainer;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
@@ -76,6 +84,29 @@ public class MapEntrySourceContainer extends AbstractSourceContainer {
return list.toArray();
File file = path.toFile();
+
+ // The file is not already in the workspace so try to create an external translation unit for it.
+ ISourceLookupDirector director = getDirector();
+ if (director != null)
+ {
+ ILaunchConfiguration launchConfiguration = director.getLaunchConfiguration();
+ if (launchConfiguration != null)
+ {
+ String projectName = launchConfiguration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
+ if (projectName.length() > 0) {
+ ICProject project = CoreModel.getDefault().getCModel().getCProject(projectName);
+ if (project != null)
+ {
+ String id;
+ try {
+ id = CoreModel.getRegistedContentTypeId(project.getProject(), Path.fromOSString(file.getCanonicalPath()).lastSegment());
+ return new ExternalTranslationUnit[] { new ExternalTranslationUnit(project, file.toURI(), id) };
+ } catch (IOException e) { e.printStackTrace(); }
+ }
+ }
+ }
+ }
+
if ( file.exists() && file.isFile() ) {
return new Object[] { new LocalFileStorage( file ) };
}

Back to the top