/** * Returns the first {@link NativeStackCallInfo} that is relevant. * <p/> * A relevant <code>NativeStackCallInfo</code> is a stack call that is not deep in the * lower level of the libc, but the actual method that performed the allocation. * @return a <code>NativeStackCallInfo</code> or <code>null</code> if the stack call has not * been processed from the raw addresses. * @see #setResolvedStackCall(ArrayList) * @see #isStackCallResolved() */ public synchronized NativeStackCallInfo getRelevantStackCallInfo() { if (mIsStackCallResolved && mResolvedStackCall != null) { Iterator<NativeStackCallInfo> sourceIterator = mResolvedStackCall.iterator(); Iterator<Long> addrIterator = mStackCallAddresses.iterator(); while (sourceIterator.hasNext() && addrIterator.hasNext()) { long addr = addrIterator.next(); NativeStackCallInfo info = sourceIterator.next(); if (addr != 0 && info != null) { if (isRelevant(info.getMethodName())) { return info; } } } // couldnt find a relevant one, so we'll return the first one if it // exists. if (mResolvedStackCall.size() > 0) return mResolvedStackCall.get(0); } return null; }
source.getLibraryName(), source.getMethodName(), source.getSourceFile(), source.getLineNumber())); } else { buffer.append(String.format("\t%1$08x\t%2$s --- %3$s --- %4$s\n", addr, source.getLibraryName(), source.getMethodName(), source.getSourceFile()));
source.getLibraryName(), source.getMethodName(), source.getSourceFile(), source.getLineNumber())); } else { buffer.append(String.format("\t%1$08x\t%2$s --- %3$s --- %4$s\n", addr, source.getLibraryName(), source.getMethodName(), source.getSourceFile()));
@Override public String toString() { return String.format("\t%1$08x\t%2$s --- %3$s --- %4$s:%5$d", getAddress(), getLibraryName(), getMethodName(), getSourceFile(), getLineNumber()); } }
/** * Returns the first {@link NativeStackCallInfo} that is relevant. * <p> * A relevant <code>NativeStackCallInfo</code> is a stack call that is not deep in the * lower level of the libc, but the actual method that performed the allocation. * @return a <code>NativeStackCallInfo</code> or <code>null</code> if the stack call has not * been processed from the raw addresses. * @see #setResolvedStackCall(List) * @see #isStackCallResolved() */ public synchronized NativeStackCallInfo getRelevantStackCallInfo() { if (mIsStackCallResolved && mResolvedStackCall != null) { for (NativeStackCallInfo info : mResolvedStackCall) { if (isRelevantLibrary(info.getLibraryName()) && isRelevantMethod(info.getMethodName())) { return info; } } // couldn't find a relevant one, so we'll return the first one if it exists. if (!mResolvedStackCall.isEmpty()) return mResolvedStackCall.get(0); } return null; }