Search in sources :

Example 1 with BinaryObjectAdapter

use of org.eclipse.cdt.utils.BinaryObjectAdapter in project linuxtools by eclipse.

the class PPC64ElfBinaryObjectWrapper method getSymbols.

@Override
public ISymbol[] getSymbols() {
    if (symbols != null) {
        return symbols;
    }
    symbols = super.getSymbols();
    try {
        if (dataSection == null) {
            Elf elf = new Elf(getPath().toOSString());
            // $NON-NLS-1$
            dataSection = elf.getSectionByName(".data");
        }
    } catch (IOException e) {
    }
    // Failed to load data Section
    if (dataSection == null) {
        return symbols;
    }
    LinkedList<ISymbol> list = new LinkedList<>();
    for (ISymbol s : symbols) {
        if (s.getType() == ISymbol.FUNCTION && s instanceof Symbol) {
            IAddress addr = fixAddr(s.getAddress());
            if (addr == null) {
                addr = s.getAddress();
            }
            list.add(new Symbol((BinaryObjectAdapter) s.getBinaryObject(), s.getName(), s.getType(), addr, s.getSize()));
        } else {
            list.add(s);
        }
    }
    symbols = list.toArray(new Symbol[0]);
    Arrays.sort(symbols);
    return symbols;
}
Also used : BinaryObjectAdapter(org.eclipse.cdt.utils.BinaryObjectAdapter) ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol) Symbol(org.eclipse.cdt.utils.Symbol) ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol) IOException(java.io.IOException) Elf(org.eclipse.cdt.utils.elf.Elf) LinkedList(java.util.LinkedList) IAddress(org.eclipse.cdt.core.IAddress)

Aggregations

IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 IAddress (org.eclipse.cdt.core.IAddress)1 ISymbol (org.eclipse.cdt.core.IBinaryParser.ISymbol)1 BinaryObjectAdapter (org.eclipse.cdt.utils.BinaryObjectAdapter)1 Symbol (org.eclipse.cdt.utils.Symbol)1 Elf (org.eclipse.cdt.utils.elf.Elf)1