1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fixed bug # 80713

This commit is contained in:
David Inglis 2004-12-10 19:59:14 +00:00
parent 817d04d43f
commit 1cd952bf2b
8 changed files with 84 additions and 17 deletions

View file

@ -1,3 +1,14 @@
2004-12-10 David Inglis
Fixed bug #80713
* utils/org/eclipse/cdt/utils/BinaryObjectAdapter.java
* utils/org/eclipse/cdt/utils/coff/PE.java
* utils/org/eclipse/cdt/utils/coff/parser/PEBinaryObject.java
* utils/org/eclipse/cdt/utils/elf/parser/ElfBinaryObject.java
* utils/org/eclipse/cdt/utils/macho/parser/MachOBinaryObject.java
* utils/org/eclipse/cdt/utils/som/parser/SOMBinaryObject.java
* utils/org/eclipse/cdt/utils/xcoff/parser/XCOFFBinaryParser.java
2004-12-09 Alain Magloire
Fix for 80620
* utils/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryObject.java

View file

@ -34,7 +34,6 @@ public abstract class BinaryObjectAdapter extends BinaryFile implements IBinaryO
public String soname;
public String[] needed;
public String cpu;
public IAddressFactory addressFactory;
public BinaryObjectInfo() {
cpu = soname = ""; //$NON-NLS-1$
@ -153,14 +152,7 @@ public abstract class BinaryObjectAdapter extends BinaryFile implements IBinaryO
}
return ""; //$NON-NLS-1$
}
public IAddressFactory getAddressFactory()
{
BinaryObjectInfo info = getBinaryObjectInfo();
if (info != null) {
return info.addressFactory;
}
return null; //$NON-NLS-1$
}
/**
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryObject#getName()
*/
@ -176,6 +168,7 @@ public abstract class BinaryObjectAdapter extends BinaryFile implements IBinaryO
* @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryObject#getSymbols()
*/
public abstract ISymbol[] getSymbols();
public abstract IAddressFactory getAddressFactory();
protected abstract BinaryObjectInfo getBinaryObjectInfo();

View file

@ -107,11 +107,6 @@ public class PE {
public int getWord() {
return word;
}
public IAddressFactory getAddressFactory(){
return addrFactory;
}
}
/**

View file

@ -17,11 +17,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.utils.AR;
import org.eclipse.cdt.utils.Addr32;
import org.eclipse.cdt.utils.Addr32Factory;
import org.eclipse.cdt.utils.BinaryObjectAdapter;
import org.eclipse.cdt.utils.Symbol;
import org.eclipse.cdt.utils.coff.Coff;
@ -33,6 +35,7 @@ import org.eclipse.core.runtime.IPath;
public class PEBinaryObject extends BinaryObjectAdapter {
BinaryObjectInfo info;
IAddressFactory addressFactory;
ISymbol[] symbols;
AR.ARHeader header;
@ -132,7 +135,6 @@ public class PEBinaryObject extends BinaryObjectAdapter {
info.isLittleEndian = attribute.isLittleEndian();
info.hasDebug = attribute.hasDebug();
info.cpu = attribute.getCPU();
info.addressFactory = attribute.getAddressFactory();
}
protected void loadSymbols(PE pe) throws IOException {
@ -160,4 +162,15 @@ public class PEBinaryObject extends BinaryObjectAdapter {
}
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getAddressFactory()
*/
public IAddressFactory getAddressFactory() {
if (addressFactory == null) {
addressFactory = new Addr32Factory();
}
return addressFactory;
}
}

View file

@ -17,10 +17,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.utils.AR;
import org.eclipse.cdt.utils.Addr32Factory;
import org.eclipse.cdt.utils.BinaryObjectAdapter;
import org.eclipse.cdt.utils.Symbol;
import org.eclipse.cdt.utils.elf.Elf;
@ -35,6 +37,7 @@ public class ElfBinaryObject extends BinaryObjectAdapter {
private BinaryObjectInfo info;
private ISymbol[] symbols;
private final AR.ARHeader header;
private IAddressFactory addressFactory;
public ElfBinaryObject(IBinaryParser parser, IPath p, AR.ARHeader h){
super(parser, p, IBinaryFile.OBJECT);
@ -146,7 +149,7 @@ public class ElfBinaryObject extends BinaryObjectAdapter {
info.isLittleEndian = attribute.isLittleEndian();
info.hasDebug = attribute.hasDebug();
info.cpu = attribute.getCPU();
info.addressFactory = attribute.getAddressFactory();
addressFactory = attribute.getAddressFactory();
}
protected void loadSymbols(ElfHelper helper) throws IOException {
@ -183,4 +186,18 @@ public class ElfBinaryObject extends BinaryObjectAdapter {
return super.getAdapter(adapter);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getAddressFactory()
*/
public IAddressFactory getAddressFactory() {
if (addressFactory == null) {
try {
loadInfo();
} catch (IOException e) {
return new Addr32Factory();
}
}
return addressFactory;
}
}

View file

@ -17,10 +17,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.utils.Addr32;
import org.eclipse.cdt.utils.Addr32Factory;
import org.eclipse.cdt.utils.BinaryObjectAdapter;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.Symbol;
@ -38,6 +40,7 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
private BinaryObjectInfo info;
private ISymbol[] symbols;
private AR.ARHeader header;
private IAddressFactory addressFactory;
/**
* @param parser
@ -201,4 +204,13 @@ public class MachOBinaryObject extends BinaryObjectAdapter {
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getAddressFactory()
*/
public IAddressFactory getAddressFactory() {
if (addressFactory == null) {
addressFactory = new Addr32Factory();
}
return addressFactory;
}
}

View file

@ -18,11 +18,13 @@ import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.Addr32;
import org.eclipse.cdt.utils.Addr32Factory;
import org.eclipse.cdt.utils.BinaryObjectAdapter;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.IGnuToolFactory;
@ -45,6 +47,7 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
ISymbol[] symbols;
long starttime;
private ARHeader header;
private IAddressFactory addressFactory;
/**
* @param parser
@ -314,4 +317,15 @@ public class SOMBinaryObject extends BinaryObjectAdapter {
}
return super.getAdapter(adapter);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getAddressFactory()
*/
public IAddressFactory getAddressFactory() {
if (addressFactory == null) {
addressFactory = new Addr32Factory();
}
return addressFactory;
}
}

View file

@ -16,11 +16,13 @@ import java.util.Arrays;
import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
import org.eclipse.cdt.utils.Addr2line;
import org.eclipse.cdt.utils.Addr32;
import org.eclipse.cdt.utils.Addr32Factory;
import org.eclipse.cdt.utils.BinaryObjectAdapter;
import org.eclipse.cdt.utils.CPPFilt;
import org.eclipse.cdt.utils.IGnuToolFactory;
@ -41,6 +43,7 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
ISymbol[] symbols;
long starttime;
private AR.MemberHeader header;
private IAddressFactory addressFactory;
/**
* @param parser
@ -306,4 +309,13 @@ public class XCOFFBinaryObject extends BinaryObjectAdapter {
return super.getAdapter(adapter);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.utils.BinaryObjectAdapter#getAddressFactory()
*/
public IAddressFactory getAddressFactory() {
if (addressFactory == null) {
addressFactory = new Addr32Factory();
}
return addressFactory;
}
}