}
private static void makeUserCallstack(String[] input) {
+ boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
+ String baseAddr = AnalyzerManager.getProject().getBaseAddress();
String binPath = AnalyzerManager.getProject().getBinaryPath();
if (null == binPath || binPath.isEmpty()) {
return;
String callerSymbol = addrMap.get(caller);
if (null == selfSymbol) {
- selfSymbol = SymbolManager.addr2func(binPath, selfAddr);
+ selfSymbol = SymbolManager.addr2func(binPath, selfAddr, isPieBuild, baseAddr);
+ selfSymbol = SymbolNameDemangler.nameDemangle(selfSymbol);
selfSymbol = getUserFunctionPosition()
+ AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + selfSymbol;
addrMap.put(self, new String(selfSymbol));
int size = userCallstack.size();
if (null == callerSymbol) {
- callerSymbol = SymbolManager.addr2func(binPath, callerAddr);
+ callerSymbol = SymbolManager.addr2func(binPath, callerAddr, isPieBuild, baseAddr);
+ callerSymbol = SymbolNameDemangler.nameDemangle(callerSymbol);
callerSymbol = getUserFunctionPosition()
+ AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
+ callerSymbol;
}
private static void setFuncName(List<String> input) {
+ boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
+ String baseAddr = AnalyzerManager.getProject().getBaseAddress();
String path = AnalyzerManager.getProject().getBinaryPath();
String pcAddr = input.get(LogCenterConstants.PCADDR_INDEX);
- String funcName = SymbolManager.addr2func(path, pcAddr);
+ String funcName = SymbolManager.addr2func(path, pcAddr, isPieBuild, baseAddr);
+ funcName = SymbolNameDemangler.nameDemangle(funcName);
input.set(LogCenterConstants.APINAME_INDEX, funcName);
FunctionUsageProfiler profiler = AnalyzerManager
return reader;
}
- public static SourceLine addr2line(String strPath, String strAddr) {
- Addr32 addr;
+ public static SourceLine addr2line(String strPath, String strAddr, boolean isPieBuild, String strBaseAddr) {
+ Addr32 addr, baseAddr, offsetAddr;
IEDCSymbolReader reader;
SourceLine srcline = new SourceLine();
return srcline;
}
+ if(isPieBuild) {
+ if(strBaseAddr == null || strBaseAddr.isEmpty()) {
+ srcline.setError(AnalyzerConstants.SOURCELINE_NULL_ADDRESS);
+ return srcline;
+ }
+
+ try {
+ baseAddr = new Addr32(strBaseAddr);
+ } catch (Exception e) {
+ srcline.setError(AnalyzerConstants.SOURCELINE_BAD_ADDRESS);
+ return srcline;
+ }
+ offsetAddr = new Addr32(baseAddr.distanceTo(addr).longValue());
+ addr = offsetAddr;
+ }
+
try {
reader = getSymbolReader(path);
} catch (NoClassDefFoundError e) {
return srcline;
}
- public static String addr2func(String strPath, String strAddr) {
+ public static String addr2func(String strPath, String strAddr, boolean isPieBuild, String strBaseAddr) {
+ Addr32 addr, baseAddr, offsetAddr;
+
if (strPath == null || strPath.isEmpty()) {
// FIXME : temp code
return "unknown.";
// FIXME
return "unknown";
}
+
+ if(isPieBuild) {
+ if(strBaseAddr == null || strBaseAddr.isEmpty()) {
+ // FIXME
+ return "unknown";
+ }
+ }
- Addr32 addr = new Addr32(strAddr);
+ addr = new Addr32(strAddr);
+ if(isPieBuild) {
+ baseAddr = new Addr32(strBaseAddr);
+ offsetAddr = new Addr32(baseAddr.distanceTo(addr).longValue());
+ addr = offsetAddr;
+ }
Elf elf = null;
WeakReference<Elf> elfEntry = elfCache.get(strPath);
public static final int APP_INFO_PID = 15;\r
public static final int APP_INFO_START_TIME = 16;\r
public static final int APP_INFO_PIE_BUILD = 17;\r
- public static final int APP_INFO_BINARY_PATH = 18;\r
- public static final int APP_INFO_SIZE = 19;\r
+ public static final int APP_INFO_BASE_ADDRESS = 18;\r
+ public static final int APP_INFO_BINARY_PATH = 19;\r
+ public static final int APP_INFO_SIZE = 20;\r
\r
/* Real Time Tab ID */\r
public static final int REALTIME_TAB_RESOURCE_LIFECYCLE = 0;\r
// error no check\r
if (AnalyzerConstants.SOURCELINE_NO_MATCHING_LINE == errno) {\r
boolean isPie = AnalyzerManager.getProject().isPieBuild();\r
- if (isPie) {\r
- errno = AnalyzerConstants.SOURCELINE_PIE_BUILD;\r
- }\r
+// if (isPie) {\r
+// errno = AnalyzerConstants.SOURCELINE_PIE_BUILD;\r
+// }\r
}\r
\r
// Creates tooltip title label.\r
}\r
addr = LogSpliter.getPCAddrBySeq(seqNum);\r
}\r
+ boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();\r
+ String baseAddr = AnalyzerManager.getProject().getBaseAddress();\r
String path = AnalyzerManager.getProject().getBinaryPath();\r
- SourceLine sl = SymbolManager.addr2line(path, addr);\r
+ SourceLine sl = SymbolManager.addr2line(path, addr, isPieBuild, baseAddr);\r
return sl;\r
}\r
\r
}
return false;
}
+
+ public String getBaseAddress() {
+ if (null != getAppInfo() || !getAppInfo().isEmpty()) {
+ return appInfo.get(AnalyzerConstants.APP_INFO_BASE_ADDRESS);
+ }
+ return null;
+ }
public void setTotalProfilingSampleCount(int count) {
AnalyzerManager.getFunctionUserProfiler().setTotalSampleCount(count);