Search in sources :

Example 1 with IAddress

use of org.eclipse.cdt.core.IAddress in project linuxtools by eclipse.

the class STSymbolManager method getLineNumber.

/**
 * @param symbol
 * @param project
 * @return the line number of the given symbol
 */
public int getLineNumber(ISymbol symbol, IProject project) {
    IBinaryObject obj = symbol.getBinaryObject();
    IAddress address = symbol.getAddress();
    return getLineNumber(obj, address, project);
}
Also used : IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) IAddress(org.eclipse.cdt.core.IAddress)

Example 2 with IAddress

use of org.eclipse.cdt.core.IAddress in project linuxtools by eclipse.

the class STSymbolManager method getFilename.

/**
 * @param symbol
 * @param project
 * @return the filename of the given symbol
 */
public String getFilename(ISymbol symbol, IProject project) {
    IBinaryObject obj = symbol.getBinaryObject();
    IAddress address = symbol.getAddress();
    return getFileName(obj, address, project);
}
Also used : IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) IAddress(org.eclipse.cdt.core.IAddress)

Example 3 with IAddress

use of org.eclipse.cdt.core.IAddress 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)

Example 4 with IAddress

use of org.eclipse.cdt.core.IAddress in project linuxtools by eclipse.

the class CallGraphDecoder method decodeCallGraphRecord.

/**
 * Decode call-graph record from gmon file.
 * @param stream
 * @throws IOException
 */
public void decodeCallGraphRecord(DataInput stream, boolean bsdFormat) throws IOException {
    long from_pc = readAddress(stream);
    long self_pc = readAddress(stream);
    int count = bsdFormat ? (int) readAddress(stream) : stream.readInt();
    IBinaryObject program = decoder.getProgram();
    IAddressFactory addressFactory = program.getAddressFactory();
    IAddress parentAddress = addressFactory.createAddress(Long.toString(from_pc));
    ISymbol parentSymbol = program.getSymbol(parentAddress);
    IAddress childAddress = addressFactory.createAddress(Long.toString(self_pc));
    ISymbol childSymbol = program.getSymbol(childAddress);
    if (childSymbol == null || parentSymbol == null) {
        return;
    }
    addCallArc(parentSymbol, parentAddress, childSymbol, count);
}
Also used : IAddressFactory(org.eclipse.cdt.core.IAddressFactory) ISymbol(org.eclipse.cdt.core.IBinaryParser.ISymbol) IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject) IAddress(org.eclipse.cdt.core.IAddress)

Example 5 with IAddress

use of org.eclipse.cdt.core.IAddress in project linuxtools by eclipse.

the class HistFunction method addBucket.

void addBucket(Bucket b, IBinaryObject program) {
    int lineNumber = -1;
    IAddress address = program.getAddressFactory().createAddress(String.valueOf(b.startAddr));
    lineNumber = STSymbolManager.sharedInstance.getLineNumber(program, address, getProject());
    HistLine hf = getChild(lineNumber);
    hf.addBucket(b);
    histSym.put(symbol, b.time + histSym.get(symbol));
}
Also used : IAddress(org.eclipse.cdt.core.IAddress)

Aggregations

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