// common
public static final int MAX_TRACE_TIME_INSECOND = 24*60*60; // 1 day
public static final long MAX_SEQUENCE_NUMBER = Long.MAX_VALUE; //2^63-1, 4G*2G-1
- public static final int MAX_PROCESS_COUNT = (int) Math.pow(2, 16); // 65535
- public static final int MAX_BINARY_COUNT = (int) Math.pow(2, 16); // 65535
+ public static final int MAX_PROCESS_COUNT = (int) Math.pow(2, 16); // 65536
+ public static final int MAX_BINARY_COUNT = (int) Math.pow(2, 16); // 65536
public static final int MAX_FUNCTION_COUNT = (int) Math.pow(2, 20); // 1,048,576
public static final int MAX_FUNCTION_ARGUMENTS_COUNT = FUNCTION_ARGUMENTS_FORMAT_LENGTH; // Because "MAX_FUNCTION_ARGUMENTS_COUNT < FUNCTION_ARGUMENTS_FORMAT_LENGTH" is always true
public static final long MAX_DAEMON_LOG_SIZE = 1024*1024; // 1 mega byte
+ public static final int MAX_PAYLOAD_SIZE = (int) Math.pow(2, 16); // 65536
// Leak
public static final int MAX_LEAK_CHECK_BUFFER_SIZE = (int) Math.pow(2, 20); // 1,048,576
import static org.tizen.sdblib.util.DeviceUtil.isOnline;
import static org.tizen.sdblib.util.IOUtil.tryClose;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.IShellOutputReceiver;
List<String> apiMap = new ArrayList<String>();
apiMap.add("unknown");
- for (int i = 0; i < lines.size(); i++) {
- String input = lines.get(i);
- String[] splitLine = input.trim().split(CommonConstants.SPACE, 2);
- apiMap.add(new String(splitLine[1]));
+ if (lines.size() > 0) {
+ if (!lines.get(0).contains(AnalyzerConstants.CMDSCRIPT_UNKNOWN)
+ && !lines.get(0).contains(AnalyzerConstants.CMDSCRIPT_USAGE)) {
+ for (int i = 0; i < lines.size(); i++) {
+ String input = lines.get(i);
+ String[] splitLine = input.trim().split(CommonConstants.SPACE, 2);
+ apiMap.add(new String(splitLine[1]));
+ }
+ }
}
return apiMap;
pinfo.setDropLog(true);
}
pinfo.setMappingState(true);
-
+
ProcessMemoryMap pMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
pinfo.addProcessMemoryMap(pMap);
BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(libPath);
LibraryObject libObj = new LibraryObject(bininfo.getID(), lowAddr, highAddr);
- if(!lastMap.addLibraryMap(libObj)) {
+ if (!lastMap.addLibraryMap(libObj)) {
Logger.error("exist library");
}
-
+
pinfo.setMappingState(true);
} else {
DATime changeTime = new DATime(sec, nano);
DATime profileStartTime = project.getProfilingStartTime();
DATime subTime = changeTime.subtract(profileStartTime);
-
- if(pinfo.isMapping()) {
+
+ if (pinfo.isMapping()) {
// make new memory map
- ProcessMemoryMap newMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
+ ProcessMemoryMap newMap = new ProcessMemoryMap(pinfo.getPid(),
+ subTime.getLongTime());
pinfo.addProcessMemoryMap(newMap);
newMap.copy(lastMap);
-
+
// remove from new map
newMap.removeLibrary(lowAddr, highAddr);
} else {
// update captured time of last memory map
pinfo.updateProcessMemoryMap(lastMap, subTime.getLongTime());
-
+
// remove from map
lastMap.removeLibrary(lowAddr, highAddr);
}
-
+
pinfo.setMappingState(false);
}
}
int id = ByteUtil.toInt(header, 0);
UnsignedInt seq = ByteUtil.toUnsignedInt(header, INT_SIZE);
- if(seq.equals(Long.valueOf(0))) {
+ if (seq.equals(Long.valueOf(0))) {
Global.getProject().incSeqRotation();
}
int payloadSize = ByteUtil.toInt(header, MSG_PAYLOAD_SIZE_INDEX);
+ if (payloadSize < 0 || payloadSize > DALimit.MAX_PAYLOAD_SIZE) {
+ // wrong message format, stop profiling
+ break;
+ }
+
byte[] payload = null;
try {
printWriter.printf("\n");
}
- processMessage(buffer);
+ if (!processMessage(buffer)) {
+ // unknown message id
+ break;
+ }
+
if (id == DataChannelConstants.MSG_DATA_TERMINATE) {
Logger.debug("message data terminate arrived!!!");
Logger.performance("TEST", "While tracing", "Terminate Application");
Logger.performance("TEST", "DA end", "Stop timer");
addBufferToList();
Logger.performance("TEST", "DA end", "Add buffer to list");
-
+
// stop DB insert thread
DBInsertManager.stopInserters();
-
+
if (!StartProcessManager.getInstance().isCancelled()) {
Logger.debug("start!! : stop log process");//$NON-NLS-1$
StopLogProcessor.runStopLogProcessThread();
ReplayTraceHandler.startTime = null;
}
- private void processMessage(byte[] data) {
+ // return false if message id is unknown
+ private boolean processMessage(byte[] data) {
+ boolean bret = true;
int id = ByteUtil.toInt(data, 0);
LogData log = null;
switch (id) {
if ((runtime.totalMemory() - runtime.freeMemory()) >= runtime.maxMemory() * 0.95) {
DALimit.stopTraceAndOpenWarningDialog();
}
-
+
if (AnalyzerManager.isProcessInfoArrived()) {
// make log
log = LogDataFactory.createInstance(data);
}
}
break;
- default: // MSG_PROBE
- if (AnalyzerManager.isProcessInfoArrived() && id > 0x0100 && id < 0x0200) {
- log = LogDataFactory.createInstance(data);
- if (null != log) {
- buffer.add(log);
- messageCount++;
+ case DataChannelConstants.MSG_DATA_IMAGE:
+ break;
+ default:
+ if (id > 0x0100 && id < 0x0200) { // MSG_PROBE
+ if (AnalyzerManager.isProcessInfoArrived()) {
+ log = LogDataFactory.createInstance(data);
+ if (null != log) {
+ buffer.add(log);
+ messageCount++;
+ }
}
+ } else {
+ // unknown message id
+ bret = false;
}
+
break;
}
addBufferToList();
messageCount = 0;
}
+
+ return bret;
}
}