use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.
the class HistogramDecoder method assignSamplesSymbol.
/**
* Assign the hits to the given symbols
* @param symblist
*/
public void assignSamplesSymbol() {
if (hist_sample == null || hist_sample.length == 0)
return;
ISymbol[] symblist = this.decoder.getProgram().getSymbols();
/* read samples and assign to namelist symbols */
int j = 1;
for (int i = 0; i < hist_sample.length; i++) {
int ccnt = hist_sample[i];
if (ccnt != 0) {
long pcl = lowpc + (bucketSize * i);
long pch = pcl + bucketSize;
total_time += ccnt;
long svalue0;
long svalue1 = symblist[j - 1].getAddress().getValue().longValue();
for (j = j - 1; j < symblist.length - 1; j++) {
svalue0 = svalue1;
svalue1 = symblist[j + 1].getAddress().getValue().longValue();
/* if high end of tick is below entry address,
* go for next tick. */
if (pch < svalue0) {
break;
}
/* if low end of tick into next routine,
* go for next routine. */
if (pcl < svalue1) {
long start_addr = pcl > svalue0 ? pcl : svalue0;
long end_addr = pch < svalue1 ? pch : svalue1;
long overlap = end_addr - start_addr;
if (overlap > 0) {
ISymbol symbol = symblist[j];
int time = (int) ((overlap * ccnt) / bucketSize);
Bucket bck = new Bucket(start_addr, end_addr, time);
addBucket(bck, symbol);
}
}
}
}
}
}
use of org.eclipse.cdt.core.IBinaryParser.ISymbol 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;
}
use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.
the class CGArc method getSamples.
@Override
public int getSamples() {
Object o = this.getParent();
CGCategory category = (CGCategory) o;
ISymbol symbol;
if (CGCategory.CHILDREN.equals(category.category)) {
symbol = arc.child.getSymbol();
} else {
symbol = arc.parent.getSymbol();
}
return HistFunction.getSamples(symbol);
}
use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.
the class CGArc method getSourceLine.
@Override
public int getSourceLine() {
Object o = this.getParent();
CGCategory category = (CGCategory) o;
if (CGCategory.CHILDREN.equals(category.category)) {
ISymbol symbol = arc.child.getSymbol();
return STSymbolManager.sharedInstance.getLineNumber(symbol, arc.getProject());
} else {
return arc.parentLine;
}
}
use of org.eclipse.cdt.core.IBinaryParser.ISymbol in project linuxtools by eclipse.
the class HistFile method addCallGraphNode.
void addCallGraphNode(CallGraphNode node) {
ISymbol s = node.getSymbol();
HistFunction hf = getChild(s);
hf.addCallGraphNode(node);
}
Aggregations