Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Applied[head]: GNU elf binary parser

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.161
diff -u -r1.161 ChangeLog
--- ChangeLog	8 Oct 2003 18:58:25 -0000	1.161
+++ ChangeLog	14 Oct 2003 21:01:29 -0000
@@ -1,3 +1,13 @@
+2003-10-14 Alain Magloire
+
+	Always fetch the addr2line/c++path in the .cdtproject
+
+	* utils/org/eclipse/cdt/utils/elf/BinaryFile.java
+	* utils/org/eclipse/cdt/utils/elf/BinaryObject.java
+	* utils/org/eclipse/cdt/utils/elf/BinaryArchive.java
+	* utils/org/eclipse/cdt/utils/elf/ElfParser.java
+	* utils/org/eclipse/cdt/utils/elf/GNUElfParser.java
+
 2003-10-07 Alain Magloire
 
 	More work on the GNU Elf Binary parser.
Index: utils/org/eclipse/cdt/utils/elf/parser/BinaryFile.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/BinaryFile.java,v
retrieving revision 1.3
diff -u -r1.3 BinaryFile.java
--- utils/org/eclipse/cdt/utils/elf/parser/BinaryFile.java	8 Oct 2003 18:58:15 -0000	1.3
+++ utils/org/eclipse/cdt/utils/elf/parser/BinaryFile.java	14 Oct 2003 21:01:29 -0000
@@ -26,27 +26,26 @@
 public abstract class BinaryFile extends PlatformObject implements IBinaryFile {
 
 	protected IPath path;
-	protected IPath addr2linePath;
-	protected IPath cppfiltPath;
+	protected IToolsProvider toolsProvider;
 
 	public BinaryFile(IPath p) {
 		path = p;
 	}
 
-	public void setAddr2LinePath(IPath p) {
-		addr2linePath = p;
+	public void setToolsProvider(IToolsProvider p) {
+		toolsProvider = p;
 	}
 
 	public IPath getAddr2LinePath() {
-		return addr2linePath;
-	}
-
-	public void setCPPFiltPath(IPath p) {
-		cppfiltPath = p;
+		if (toolsProvider != null)
+			return toolsProvider.getAddr2LinePath();
+		return null;
 	}
 
 	public IPath getCPPFiltPath() {
-		return cppfiltPath;
+		if (toolsProvider != null)
+			return toolsProvider.getCPPFiltPath();
+		return null;
 	}
 
 	/**
Index: utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java,v
retrieving revision 1.3
diff -u -r1.3 BinaryObject.java
--- utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java	8 Oct 2003 18:58:15 -0000	1.3
+++ utils/org/eclipse/cdt/utils/elf/parser/BinaryObject.java	14 Oct 2003 21:01:29 -0000
@@ -296,9 +296,11 @@
 	protected Addr2line getAddr2Line() {
 		IPath addr2LinePath = getAddr2LinePath();
 		Addr2line addr2line = null;
-		try {
-			addr2line = new Addr2line(addr2LinePath.toOSString(), getPath().toOSString());
-		} catch (IOException e1) {
+		if (addr2LinePath != null && !addr2LinePath.isEmpty()) {
+			try {
+				addr2line = new Addr2line(addr2LinePath.toOSString(), getPath().toOSString());
+			} catch (IOException e1) {
+			}
 		}
 		return addr2line;
 	}
@@ -306,9 +308,11 @@
 	protected CPPFilt getCPPFilt() {
 		IPath cppFiltPath = getCPPFiltPath();
 		CPPFilt cppfilt = null;
-		try {
-			cppfilt = new CPPFilt(cppFiltPath.toOSString());
-		} catch (IOException e2) {
+		if (cppFiltPath != null && ! cppFiltPath.isEmpty()) {
+			try {
+				cppfilt = new CPPFilt(cppFiltPath.toOSString());
+			} catch (IOException e2) {
+			}
 		}
 		return cppfilt;
 	}
Index: utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java,v
retrieving revision 1.3
diff -u -r1.3 GNUElfParser.java
--- utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java	8 Oct 2003 18:58:15 -0000	1.3
+++ utils/org/eclipse/cdt/utils/elf/parser/GNUElfParser.java	14 Oct 2003 21:01:29 -0000
@@ -19,7 +19,7 @@
 
 /**
  */
-public class GNUElfParser extends ElfParser implements IBinaryParser {
+public class GNUElfParser extends ElfParser implements IBinaryParser, IToolsProvider {
 
 	/**
 	 * @see org.eclipse.cdt.core.model.IBinaryParser#getBinary(IPath)
@@ -27,8 +27,7 @@
 	public IBinaryFile getBinary(IPath path) throws IOException {
 		IBinaryFile binary = super.getBinary(path);
 		if (binary instanceof BinaryFile) {
-			((BinaryFile)binary).setAddr2LinePath(getAddr2LinePath());
-			((BinaryFile)binary).setCPPFiltPath(getCPPFiltPath());
+			((BinaryFile)binary).setToolsProvider(this);
 		}
 		return binary;
 	}
Index: utils/org/eclipse/cdt/utils/elf/parser/IToolsProvider.java
===================================================================
RCS file: utils/org/eclipse/cdt/utils/elf/parser/IToolsProvider.java
diff -N utils/org/eclipse/cdt/utils/elf/parser/IToolsProvider.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ utils/org/eclipse/cdt/utils/elf/parser/IToolsProvider.java	14 Oct 2003 21:01:29 -0000
@@ -0,0 +1,22 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 QNX Software Systems and others.
+ * All rights reserved.   This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors: 
+ * QNX Software Systems - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.utils.elf.parser;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ */
+public interface IToolsProvider {
+
+	IPath getAddr2LinePath();
+
+	IPath getCPPFiltPath();
+}



Back to the top