mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +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 getData();
|
||||||
|
|
||||||
public long getBSS();
|
public long getBSS();
|
||||||
|
|
||||||
|
public boolean isLittleEndian();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,15 @@ public class Binary extends CFile implements IBinary {
|
||||||
return ((BinaryInfo)getElementInfo()).getSoname();
|
return ((BinaryInfo)getElementInfo()).getSoname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.core.model.IBinary#isLittleEndian()
|
||||||
|
*/
|
||||||
|
public boolean isLittleEndian() {
|
||||||
|
return ((BinaryInfo)getElementInfo()).isLittleEndian();
|
||||||
|
}
|
||||||
|
|
||||||
public CElementInfo createElementInfo() {
|
public CElementInfo createElementInfo() {
|
||||||
return new BinaryInfo(this);
|
return new BinaryInfo(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,14 @@ class BinaryInfo extends CFileInfo {
|
||||||
return soname;
|
return soname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLittleEndian() {
|
||||||
|
init();
|
||||||
|
if (attribute != null) {
|
||||||
|
return attribute.isLittleEndian();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void addFunction(Elf.Symbol [] symbol, boolean external) {
|
private void addFunction(Elf.Symbol [] symbol, boolean external) {
|
||||||
for (int i = 0; i < symbol.length; i++) {
|
for (int i = 0; i < symbol.length; i++) {
|
||||||
ICElement parent = getElement();
|
ICElement parent = getElement();
|
||||||
|
@ -244,6 +252,7 @@ class BinaryInfo extends CFileInfo {
|
||||||
|
|
||||||
sizes = helper.getSizes();
|
sizes = helper.getSizes();
|
||||||
soname = helper.getSoname();
|
soname = helper.getSoname();
|
||||||
|
|
||||||
attribute = helper.getElf().getAttributes();
|
attribute = helper.getElf().getAttributes();
|
||||||
helper.dispose();
|
helper.dispose();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -590,6 +590,7 @@ public class Elf {
|
||||||
String cpu;
|
String cpu;
|
||||||
int type;
|
int type;
|
||||||
boolean bDebug;
|
boolean bDebug;
|
||||||
|
boolean isle;
|
||||||
|
|
||||||
public String getCPU() {
|
public String getCPU() {
|
||||||
return cpu;
|
return cpu;
|
||||||
|
@ -602,6 +603,10 @@ public class Elf {
|
||||||
public boolean hasDebug() {
|
public boolean hasDebug() {
|
||||||
return bDebug;
|
return bDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLittleEndian() {
|
||||||
|
return isle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -649,13 +654,15 @@ public class Elf {
|
||||||
default:
|
default:
|
||||||
attrib.cpu = "none";
|
attrib.cpu = "none";
|
||||||
}
|
}
|
||||||
if ( !bSkipElfData) {
|
if (!bSkipElfData) {
|
||||||
switch (ehdr.e_ident[Elf.ELFhdr.EI_DATA]) {
|
switch (ehdr.e_ident[Elf.ELFhdr.EI_DATA]) {
|
||||||
case Elf.ELFhdr.ELFDATA2LSB :
|
case Elf.ELFhdr.ELFDATA2LSB :
|
||||||
attrib.cpu+= "le";
|
attrib.cpu+= "le";
|
||||||
|
attrib.isle = true;
|
||||||
break;
|
break;
|
||||||
case Elf.ELFhdr.ELFDATA2MSB :
|
case Elf.ELFhdr.ELFDATA2MSB :
|
||||||
attrib.cpu += "be";
|
attrib.cpu += "be";
|
||||||
|
attrib.isle = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue