[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] CDT_1_0_1 branch cdt.core:BinaryInfo
|
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.54.2.4
diff -u -r1.54.2.4 ChangeLog
--- ChangeLog 12 Mar 2003 21:22:01 -0000 1.54.2.4
+++ ChangeLog 17 Mar 2003 21:24:55 -0000
@@ -1,3 +1,14 @@
+2003-03-17 Alain Magloire
+
+ Patch from Chris Songer.
+
+ This is a first guess to find the corresponding source file
+ of a binary. We search in the binary directory for the file.
+
+ * model/org/eclipse/cdt/internal/core/model/BinaryInfo.java
+ Method addFunction() and addVariable() check for the file in
+ the current directory of the binary.
+
2003-03-12 Alain Magloire
Patch from Chris Songer
Index: model/org/eclipse/cdt/internal/core/model/BinaryInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BinaryInfo.java,v
retrieving revision 1.5.4.1
diff -u -r1.5.4.1 BinaryInfo.java
--- model/org/eclipse/cdt/internal/core/model/BinaryInfo.java 12 Mar 2003 21:21:53 -0000 1.5.4.1
+++ model/org/eclipse/cdt/internal/core/model/BinaryInfo.java 17 Mar 2003 21:24:55 -0000
@@ -20,6 +20,7 @@
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -185,6 +186,25 @@
if (filename != null && !filename.equals("??")) {
TranslationUnit tu = null;
IPath path = new Path(filename);
+
+ /*
+ * This is a first guess, to figure out where the source code file is
+ * We guess that is is in the same directory as the binary:
+ * - The correct fix would be to compile the program with absolute path.
+ * - Use the future binary attachement mechanism. */
+ if (!path.isAbsolute()) {
+ IResource parentRes = null;
+ try {
+ parentRes = (IResource)parent.getResource();
+ } catch (CModelException e) {
+ }
+ // assert parentRes, we should always have a solid executable.
+ if (parentRes != null) {
+ IPath parentPath = parentRes.getLocation().removeLastSegments(1);
+ path = parentPath.append(path);
+ }
+ }
+
if (hash.containsKey(path)) {
tu = (TranslationUnit) hash.get(path);
} else {
@@ -225,6 +245,25 @@
if (filename != null && !filename.equals("??")) {
TranslationUnit tu = null;
IPath path = new Path(filename);
+
+ /*
+ * This is a first guess, to figure out where the source code file is
+ * We guess that is is in the same directory as the binary:
+ * - The correct fix would be to compile the program with absolute path.
+ * - Use the future binary attachement mechanism. */
+ if (!path.isAbsolute()) {
+ IResource parentRes = null;
+ try {
+ parentRes = (IResource)parent.getResource();
+ } catch (CModelException e) {
+ }
+ // assert parentRes, we should always have a solid executable.
+ if (parentRes != null) {
+ IPath parentPath = parentRes.getLocation().removeLastSegments(1);
+ path = parentPath.append(path);
+ }
+ }
+
if (hash.containsKey(path)) {
tu = (TranslationUnit) hash.get(path);
} else {