+ "test"
+ File.separator
+ AnalyzerConstants.DYNAMIC_ANALYZER_FOLDER_NAME;
+ public static final String DA_DEBUG_DATA_CHANNEL_LOG_PATH = TIZEN_SDK_DATA_PATH
+ + File.separator + "data.log";
+ public static final String DA_DEBUG_CONTROL_CHANNEL_LOG_PATH = TIZEN_SDK_DATA_PATH
+ + File.separator + "control.log";
public static final String TOOL_FOLDER_PATH = DYNAMIC_ANALYZER_INSTALL_PATH
+ File.separator + AnalyzerConstants.TOOL_FOLDER_NAME;
public static final String TEMP_FOLDER_PATH = DYNAMIC_ANALYZER_SAVE_PATH
}
public void setProfileStartTime(DATime time) {
+ System.out.printf("profile starttime : %d\n", time.getSec());
this.profilingStartTime = time;
}
public static final int APPTYPE_TIZEN = 0x01;
public static final int APPTYPE_PROCESS = 0x02;
public static final int APPTYPE_COMMON_EXEC = 0x03;
+ public static final int APPTYPE_WEB = 0x04;
/***
* target application type
* 01: tizen native application
import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.PrintWriter;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
public class Communicator30 extends BaseCommunicator {
+ static final boolean PRINT_CONTROL_LOG_TOFILE = true;
+ private PrintWriter printWriter = null;
+
@Override
public HostResult init(DeviceInfo devInfo) {
// connect ecs server
System.out.println("print start message");
ByteUtils.printByteArrayForStart(ret);
+
+ if(PRINT_CONTROL_LOG_TOFILE) {
+ File logPath = new File(
+ AnalyzerPaths.DA_DEBUG_CONTROL_CHANNEL_LOG_PATH);
+ if (logPath.exists()) {
+ logPath.delete();
+ }
+
+ try {
+ printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
// data receive thread create and start
Thread dataThread = new Thread(null, new DataChannelThread(),
ApplicationInst appInst = new ApplicationInst();
String appType = app.getInfo(AppInfo.APPTYPE_INDEX);
- if (appType.contains(AppInfo.APPTYPE_CPP)
- || appType.contains(AppInfo.APPTYPE_WEB)) {
+ if (appType.contains(AppInfo.APPTYPE_CPP)) {
appInst.setApplicationType(ApplicationInfo.APPTYPE_TIZEN);
+ } else if(appType.contains(AppInfo.APPTYPE_WEB)) {
+ appInst.setApplicationType(ApplicationInfo.APPTYPE_WEB);
} else {
appInst.setApplicationType(ApplicationInfo.APPTYPE_COMMON_EXEC);
}
try {
if (null != controlSock && !controlSock.isClosed()) {
+ if(PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+ printWriter.printf("send :");
+ for(int k = 0; k < message.length; k++)
+ printWriter.printf("%02x ", message[k]);
+ printWriter.printf("\n");
+ }
controlSock.getOutputStream().write(message);
}
System.out.println("blocked");
readsize = controlSock.getInputStream().read(cbuf);
blocked = false;
+ if(PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+ printWriter.printf("recv :");
+ for(int k = 0; k < readsize; k++)
+ printWriter.printf("%02x ", cbuf[k]);
+ printWriter.printf("\n");
+ }
+
System.out.println("unblocked");
if (readsize > 0) {
byte[] buf = new byte[readsize];
import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
+import java.io.PrintWriter;
import java.net.Socket;
import java.util.ArrayList;
+import java.util.Formatter;
import java.util.HashMap;
import java.util.List;
import java.util.Timer;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class MessageParser {
+ static final boolean PRINT_DATA_LOG_TOFILE = false;
static final int MSG_ID_INDEX = 0;
static final int MSG_LENGTH_INDEX = 1;
.getNano();
if (0 == startSec && 0 == startNano) {
- startTime.setSec(sec);
- startTime.setNano(nano);
+ startTime.setSec(ByteUtils.toInt(data, 8));
+ startTime.setNano(ByteUtils.toInt(data, 12));
AnalyzerManager.getProject().setProfileStartTime(startTime);
- startSec = sec;
- startNano = nano;
}
pInfo.setPid(pid);
public void startMessageParsing(Socket dataSocket) {
InputStream inputStream = null;
+ PrintWriter printWriter = null;
try {
inputStream = dataSocket.getInputStream();
} catch (IOException e1) {
e1.printStackTrace();
}
+
+ if(PRINT_DATA_LOG_TOFILE) {
+ File logPath = new File(
+ AnalyzerPaths.DA_DEBUG_DATA_CHANNEL_LOG_PATH);
+ if (logPath.exists()) {
+ logPath.delete();
+ }
+
+ try {
+ printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
startTimer();
System.arraycopy(header, 0, buffer, 0, MSG_HEADER_SIZE);
System.arraycopy(payload, 0, buffer, MSG_HEADER_SIZE,
payloadSize);
+
+ if(PRINT_DATA_LOG_TOFILE && printWriter != null) {
+ printWriter.printf("%d %d %d %d %d :", id, ByteUtils.toInt(header, 4), ByteUtils.toInt(header, 8), ByteUtils.toInt(header, 12), payloadSize);
+ for(int k = 0; k < payloadSize; k++)
+ printWriter.printf("%02x ", payload[k]);
+ printWriter.printf("\n");
+ }
processMessage(buffer);
if (id == DataChannelConstants.MSG_DATA_TERMINATE) {
int id = log.getId();
int seqNum = log.getSeq();
if (log instanceof SystemData) {
+ System.out.println("=========systemData is slicing===========\n");
pushLog(log, logPack);
} else if (log instanceof ProfileData) {
if (!AnalyzerManager.isProcessInfoArrived()) {
String baseAddr = Long.toString(processInfo.getLowestAddress());
String pcStr = Long.toString(pcAddr);
BinaryInfo binInfo = processInfo.getTargetBinary(pcAddr);
- String localPath = binInfo.getTempBinaryPath();
- boolean isPieBuild = true;
- if (binInfo.getType() != 1) {
- isPieBuild = false;
+ if(binInfo != null) {
+ String localPath = binInfo.getTempBinaryPath();
+ boolean isPieBuild = true;
+ if (binInfo.getType() != 1) {
+ isPieBuild = false;
+ }
+ functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
+ baseAddr);
}
- functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
- baseAddr);
if (null == functionName || functionName.isEmpty()
|| functionName.equals("_end")) { //$NON-NLS-1$
functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;