1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

Always fetch the paths in the .cdtproject.

This commit is contained in:
Alain Magloire 2003-10-14 21:02:48 +00:00
parent 956250cf95
commit 19cd0ff470
4 changed files with 43 additions and 19 deletions

View file

@ -26,27 +26,26 @@ import org.eclipse.core.runtime.PlatformObject;
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;
}
/**

View file

@ -296,9 +296,11 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
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 @@ public class BinaryObject extends BinaryFile implements IBinaryObject {
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;
}

View file

@ -19,7 +19,7 @@ import org.eclipse.core.runtime.Path;
/**
*/
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 class GNUElfParser extends ElfParser implements IBinaryParser {
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;
}

View file

@ -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();
}