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:
parent
98f490f5f9
commit
64bbca18a7
4 changed files with 28 additions and 1 deletions
|
@ -32,4 +32,7 @@ public interface IBinary extends ICFile {
|
|||
public long getData();
|
||||
|
||||
public long getBSS();
|
||||
|
||||
public boolean isLittleEndian();
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -653,9 +658,11 @@ public class Elf {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue