using readlink command in target platform via da_command script, get the actual file path of application executable
Change-Id: If326eff72219706dac67a19a029c254707a5ed9c
Signed-off-by: woojin <woojin2.jung@samsung.com>
public static final String WINDOW_ACTIVATOR_MACOS = "macoswindowactivator.sh";//$NON-NLS-1$
// paths
+ // DA_REMOTE_PROBE_PATH : to drop sample log from probe library [function profiling]
public static final String DA_REMOTE_PROBE_PATH = "/usr/lib/da_probe"; //$NON-NLS-1$
public static final String DA_REMOTE_PATH = "/home/developer/sdk_tools/da/"; //$NON-NLS-1$
public static final String DA_REMOTE_DAEMON_BINARY_PATH = DA_REMOTE_PATH
public static final String DACOMMAND_FIND_UNITTEST = "da findunittest";
public static final String DACOMMAND_FIND_IME = "/usr/bin/pkginfo --arg-flt 10 http://tizen.org/category/ime";
public static final String DACOMMAND_CHECK_VERSION = "da getversion";
+ public static final String DACOMMAND_READLINK = "da readlink ";
public static final String CMD_IS_ARM_ARCH = "uname -m"; //$NON-NLS-1$
public static final String CMD_CAT_PORT_FILE = "cat /tmp/port.da"; //$NON-NLS-1$
// _end indicates end of BSS (uninitialized data) section
// function entry of _end is considered as bad data
// TODO: test and remove _end condition
- if (null == functionName || functionName.isEmpty() || functionName.equals("_end")) { //$NON-NLS-1$
+ if (null == functionName || functionName.isEmpty()) {
+ functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+ } else if (functionName.equals("_end")) { //$NON-NLS-1$)
+ DA_LOG.error("function name : _end occurred!\n");
functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
} else {
String prevFunctionName = functionName;
BinaryInfo bInfo = null;
switch (type) {
case ProfilingData.TYPE_APPLICATION:
- binaryId = (Integer) profilingData
- .get(ProfilingDataDBTable.COLUMN.BINARYID.index);
- bInfo = AnalyzerManager.getProject().getDeviceStatusInfo().getBinaryInfo(binaryId);
- name = bInfo.getTargetBinaryPath();
- fupData = new ProfilingData(seq, name, exCount, inCount, callCount,
- inElapsedTime, exElapsedTime, profiler);
- profiler.setAppBin(fupData);
- break;
case ProfilingData.TYPE_DEPENDENTLIBRARY:
+ case ProfilingData.TYPE_LIBRARY:
binaryId = (Integer) profilingData
- .get(ProfilingDataDBTable.COLUMN.BINARYID.index);
- bInfo = AnalyzerManager.getProject().getDeviceStatusInfo().getBinaryInfo(binaryId);
- name = bInfo.getTargetBinaryPath();
- fupData = new ProfilingData(seq, name, exCount, inCount, callCount,
- inElapsedTime, exElapsedTime, profiler);
- profiler.setDependentLib(fupData);
- break;
- case ProfilingData.TYPE_LIBRARY:
- binaryId = (Integer) profilingData
- .get(ProfilingDataDBTable.COLUMN.BINARYID.index);
+ .get(ProfilingDataDBTable.COLUMN.BINARYID.index);
bInfo = AnalyzerManager.getProject().getDeviceStatusInfo().getBinaryInfo(binaryId);
name = bInfo.getTargetBinaryPath();
fupData = new ProfilingData(seq, name, exCount, inCount, callCount,
System.out.println("invalid profiling data type");
break;
}
+
+ if (type == ProfilingData.TYPE_APPLICATION) {
+ profiler.setAppBin(fupData);
+ } else if (type == ProfilingData.TYPE_DEPENDENTLIBRARY) {
+ profiler.setDependentLib(fupData);
+ }
profiler.getProfilingDataMap().put(seq, fupData);
UIDataManager.getInstance().getfunctionProfilingDataChecker()
import java.util.List;
import java.util.Map;
+import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
import org.tizen.dynamicanalyzer.common.ElfSymbolExtractor;
import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.sdblib.receiver.MultiLineReceiver;
public class AppInfo {
private String execFileName = null;
private List<String> localPackagePath = null;
private Map<Integer, String> runningProcesses = null;
-
+ private String execPath = null;
+
+ private static List<String> readlinkResult = new ArrayList<String>();
private List<String> properties = new ArrayList<String>();
// instance initializer
public String getExecFileName() {
if (null == execFileName) {
- String[] splitPath = properties.get(PROPERTY.EXEC.index).split(
- CommonConstants.SLASH);
- if (getAppType().contains(APPTYPE_CPP)) {
- execFileName = splitPath[splitPath.length - 1]
- + CommonConstants.EXTENSION_EXEC_FILE;
- } else {
- execFileName = splitPath[splitPath.length - 1];
- }
+// String[] splitPath = properties.get(PROPERTY.EXEC.index).split(
+// CommonConstants.SLASH);
+// if (getAppType().contains(APPTYPE_CPP)) {
+// execFileName = splitPath[splitPath.length - 1]
+// + CommonConstants.EXTENSION_EXEC_FILE;
+// } else {
+// execFileName = splitPath[splitPath.length - 1];
+// }
+ String[] splitPath = getExecPath().split(CommonConstants.SLASH);
+ execFileName = splitPath[splitPath.length - 1];
}
return execFileName;
}
}
public String getExecPath() {
- String exec = properties.get(PROPERTY.EXEC.index);
- if (getAppType().contains(APPTYPE_CPP)) {
- exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");
- exec += CommonConstants.EXTENSION_EXEC_FILE;
+ if (null != execPath) {
+ return execPath;
+ } else {
+ String exec = properties.get(PROPERTY.EXEC.index);
+ String command = AnalyzerShellCommands.DACOMMAND_READLINK + exec;
+ readlinkResult.clear();
+ CommunicatorUtils.execHostCommand(command, new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ readlinkResult.add(appLines[i]);
+ }
+ }
+ }); // get actual file path using da readlink command (inside target platform)
+
+ if (readlinkResult.isEmpty() || readlinkResult.size() > 1) { // fail to get path
+ if (getAppType().contains(APPTYPE_CPP)) {
+ exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");
+ exec += CommonConstants.EXTENSION_EXEC_FILE;
+ } else if (getAppType().contains(APPTYPE_CAPP)) {
+ exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");
+ }
+ execPath = exec;
+ } else {
+ execPath = readlinkResult.get(0);
+ }
+
+ return execPath;
}
- return exec;
}
public String getAppType() {
private List<BinaryInfo> binaryInfoArray = new ArrayList<BinaryInfo>();
public DeviceStatusInfo(List<String> functionList) {
+ // TODO: add <unknown function> first, then add apiMap list
this.functionList = functionList;
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.util.DALogger;
public class FunctionNameManager {
}
public static void clear() {
- if (DACommunicator.isSWAPVersion()) {
- getFunctionList().clear();
- }
+ getFunctionList().clear();
}
}
.getInstance().getTargetBinInfoMap();
List<String> binPaths = new ArrayList<String>();
binPaths.addAll(binInfoMap.keySet());
-
+ // TODO: performance improvement
int size = binPaths.size();
for (int i = 0; i < size; i++) {
String binPath = binPaths.get(i);
int apiId = SymbolManager.getFuncId(pData, pData.getPcAddr(),
pData.getPid(), pData.getTime());
String apiName = FunctionNameManager.getFunctionName(apiId);
-
+ // TODO : <unknown function> check with apiId
if (apiId == -1 || apiName.equals("<unknown function>")) {
continue;
} else {
private static final DALogger DA_LOG = DALogger.getInstance();
+ // TODO: get path and function name as parameter, not symbol
public CallStackUnit(long addr, String symbol, LogData log) {
address = addr;
functionStartAddress = addr;
}
private void makeCallstackData() {
-
+ // callstack symbol format : path(functionName
+ // ex. /usr/lib/libpthread.so(pthread_create
String[] splitPath = originSymbol.split("\\(", 2); //$NON-NLS-1$
path = splitPath[0];
if (!path.startsWith("/") && !path.contains(FunctionUsageProfiler.APPLICATION) //$NON-NLS-1$