1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

new Method isLittleEndian().

This commit is contained in:
Alain Magloire 2002-10-25 18:38:19 +00:00
parent 98f490f5f9
commit 64bbca18a7
4 changed files with 28 additions and 1 deletions

View file

@ -32,4 +32,7 @@ public interface IBinary extends ICFile {
public long getData();
public long getBSS();
public boolean isLittleEndian();
}

View file

@ -74,7 +74,15 @@ public class Binary extends CFile implements IBinary {
return ((BinaryInfo)getElementInfo()).getSoname();
}
/**
* @see org.eclipse.cdt.core.model.IBinary#isLittleEndian()
*/
public boolean isLittleEndian() {
return ((BinaryInfo)getElementInfo()).isLittleEndian();
}
public CElementInfo createElementInfo() {
return new BinaryInfo(this);
}
}

View file

@ -114,6 +114,14 @@ class BinaryInfo extends CFileInfo {
return soname;
}
public boolean isLittleEndian() {
init();
if (attribute != null) {
return attribute.isLittleEndian();
}
return false;
}
private void addFunction(Elf.Symbol [] symbol, boolean external) {
for (int i = 0; i < symbol.length; i++) {
ICElement parent = getElement();
@ -244,6 +252,7 @@ class BinaryInfo extends CFileInfo {
sizes = helper.getSizes();
soname = helper.getSoname();
attribute = helper.getElf().getAttributes();
helper.dispose();
} catch (IOException e) {

View file

@ -590,6 +590,7 @@ public class Elf {
String cpu;
int type;
boolean bDebug;
boolean isle;
public String getCPU() {
return cpu;
@ -602,6 +603,10 @@ public class Elf {
public boolean hasDebug() {
return bDebug;
}
public boolean isLittleEndian() {
return isle;
}
}
@ -649,13 +654,15 @@ public class Elf {
default:
attrib.cpu = "none";
}
if ( !bSkipElfData) {
if (!bSkipElfData) {
switch (ehdr.e_ident[Elf.ELFhdr.EI_DATA]) {
case Elf.ELFhdr.ELFDATA2LSB :
attrib.cpu+= "le";
attrib.isle = true;
break;
case Elf.ELFhdr.ELFDATA2MSB :
attrib.cpu += "be";
attrib.isle = false;
break;
}
}