int start = symbol.indexOf(CommonConstants.OPEN_BRACKET);
int end = symbol.indexOf(CommonConstants.CLOSE_BRACKET);
- byte[] emptyRet = new byte[2];
+ byte[] emptyRet = new byte[3];
emptyRet[0] = 'p';
emptyRet[1] = 0;
+ emptyRet[2] = 'n';
if (start < 0 || end < 0) {
return emptyRet;
}
ret[i + 1] = (byte) getArgType(arg);
}
+ byte[] test = new byte[1];
+ test[0] = 'n';
+ ret = ByteUtils.getByte(ret, test);
return ret;
}
tid = ByteUtils.toInt(data, index);
index += INT_SIZE;
cpuNum = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
}
public long getPcAddr() {
return args;
}
+ public static ArgsInfo parseReturn(byte[] payload, int index) {
+ ArgsInfo args = new ArgsInfo();
+ StringBuffer buffer = new StringBuffer();
+ char c = (char) payload[index];
+ index += 1;
+ switch (c) {
+ case 'c':
+ buffer.append((payload[index]));
+ index += 1;
+ break;
+ case 'd':
+ int iValue = ByteUtils.toInt(payload, index);
+ buffer.append(iValue);
+ index += Integer.SIZE / Byte.SIZE;
+ break;
+ case 'x':
+ long lValue = ByteUtils.toLong(payload, index);
+ buffer.append(lValue);
+ index += LONG_SIZE;
+ break;
+ case 'p':
+ long pValue = ByteUtils.toLong(payload, index);
+ buffer.append(AnalyzerUtil.toHexdecimal(pValue));
+ index += LONG_SIZE;
+ break;
+ case 'f':
+ float fValue = ByteUtils.toFloat(payload, index);
+ buffer.append(fValue);
+ index += FLOAT_SIZE;
+ break;
+ case 'w':
+ double dValue = ByteUtils.toDouble(payload, index);
+ buffer.append(dValue);
+ index += DOUBLE_SIZE;
+ break;
+ case 'b':
+ byte b = payload[index++];
+ if (b == 0) {
+ buffer.append("false");
+ } else {
+ buffer.append("true");
+ }
+ break;
+ case 's':
+ // System.out.println("args payload size : " + payload.length);
+ for (int iii = index; iii < payload.length; iii++) {
+ if (payload[iii] != 0) {
+ buffer.append((char) payload[iii]);
+ } else {
+ index = iii + 1;
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ args.setArgs(buffer.toString());
+ args.setLastIndex(index);
+ return args;
+ }
+
public static int getStringLength(int start, byte[] payload) {
int length = 0;
for (int i = start; i < payload.length; i++, length++) {
import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
import org.tizen.dynamicanalyzer.swap.logparser.MessageParser;
import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class ProbeCommonData extends LogData {
protected int pid = 0;
protected int tid = 0;
protected String args = null;
- protected long ret = 0;
+ protected String ret = null;
protected long errno = 0;
protected int internalCall = 0;
protected long callerAddress = 0;
args = argInfo.getArgs();
index = argInfo.getLastIndex();
- ret = ByteUtils.toLong(data, index);
- index += LONG_SIZE;
+ // ret = ByteUtils.toLong(data, index);
+ // index += LONG_SIZE;
+ ArgsInfo retInfo = LogDataUtils.parseReturn(data, index);
+ ret = retInfo.getArgs();
+ index = retInfo.getLastIndex();
errno = ByteUtils.toLong(data, index);
index += LONG_SIZE;
}
public String getReturn() {
- String retStr = null;
- if (ret < 0x10000000) {
- retStr = Long.toString(ret);
- } else {
- retStr = AnalyzerUtil.toHexdecimal(ret);
- }
- return retStr;
- }
-
- public long getOriginalReturn() {
return ret;
}
- public void setReturn(long ret) {
+ public void setReturn(String ret) {
this.ret = ret;
}
prep.setInt(index++, pid);
prep.setInt(index++, tid);
prep.setString(index++, args);
- prep.setLong(index++, ret);
+ prep.setString(index++, ret);
prep.setLong(index++, errno);
prep.setInt(index++, internalCall);
prep.setLong(index++, callerAddress);
pid = rs.getInt(index++);
tid = rs.getInt(index++);
args = rs.getString(index++);
- ret = rs.getLong(index++);
+ ret = rs.getString(index++);
errno = rs.getLong(index++);
internalCall = rs.getInt(index++);
callerAddress = rs.getLong(index++);
*/
package org.tizen.dynamicanalyzer.swap.model.data;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY;
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT;
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_DATA_SAMPLE;
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_FUNCTION_ENTRY;
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_FUNCTION_EXIT;
-import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
-import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class ProfileData extends LogData {
int tid = 0; // profiling common
int cpuNum = 0; // profiling common
String args = null; // function entry specific
- long ret = 0;
+ String ret = null;
String apiName = null;
int buildType = -1;
index += INT_SIZE;
ArgsInfo info = LogDataUtils.parseArgs(data, index);
args = info.getProfileArgs();
+ index = info.getLastIndex();
break;
case MSG_FUNCTION_EXIT:
logCount++;
index += LONG_SIZE;
cpuNum = ByteUtils.toInt(data, index);
index += INT_SIZE;
- ret = ByteUtils.toLong(data, index);
+ ArgsInfo retInfo = LogDataUtils.parseReturn(data, index);
+ ret = retInfo.getArgs();
+ index = retInfo.getLastIndex();
+ // ret = ByteUtils.toLong(data, index);
break;
case MSG_CONTEXT_SWITCH_ENTRY:
case MSG_CONTEXT_SWITCH_EXIT:
tid = ByteUtils.toInt(data, index);
index += INT_SIZE;
cpuNum = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
break;
case MSG_DATA_SAMPLE:
pid = ByteUtils.toInt(data, index);
tid = ByteUtils.toInt(data, index);
index += INT_SIZE;
cpuNum = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
break;
default:
} else {
libName = binInfo.getTargetBinaryPath();
}
-// System.out.println("plib name : " + libName);
+ // System.out.println("plib name : " + libName);
}
}
}
public String getReturn() {
- String retStr = null;
- if (ret < 0x10000000) {
- retStr = Long.toString(ret);
- } else {
- retStr = AnalyzerUtil.toHexdecimal(ret);
- }
- return retStr;
+ return ret;
}
-
- public String getHexReturn() {
- return AnalyzerUtil.toHexdecimal(ret);
- }
-
- public void setRet(long ret) {
+
+ public void setRet(String ret) {
this.ret = ret;
}
prep.setInt(index++, tid);
prep.setInt(index++, cpuNum);
prep.setString(index++, args);
- prep.setLong(index++, ret);
+ prep.setString(index++, ret);
prep.setString(index++, apiName);
prep.setString(index++, libName);
prep.setString(index++, callstack);
tid = rs.getInt(index++);
cpuNum = rs.getInt(index++);
args = rs.getString(index++);
- ret = rs.getLong(index++);
+ ret = rs.getString(index++);
apiName = rs.getString(index++);
libName = rs.getString(index++);
callstack = rs.getString(index++);
private static String[] dcn = { "APPID", "PID", "TID", "args", "Return",
"Errno", "InternalCall", "CallerPCAddr", "Reserved1", "Reserved2", "LibName" };
- private static Integer[] dct = { I, I, I, T, L, L, I, L, I, I , T};
+ private static Integer[] dct = { I, I, I, T, T, L, I, L, I, I , T};
private static String[] tcn = { "App ID", "PID", "TID", "Args", "Return",
"Errno", "Internal Call", "Caller PCAddr", "Reserved1", "Reserved2", "LibName" };
- private static Integer[] logTypes = { I, I, I, T, L, L, I, L, I, I, T };
+ private static Integer[] logTypes = { I, I, I, T, T, L, I, L, I, I, T };
private static List<String> dbColumnNames = null;
private static List<Integer> dbColumnTypes = null;
String apiName = log.getApiName();
if (apiName.equals(API_NAME_CREATE_CHART)) {
- long chartHandle = log.getOriginalReturn();
+ long chartHandle = Long.parseLong(log.getReturn());
String chartName = log.getName();
chartManager.addCustomChart(new UserCustomChart((int) chartHandle,
chartName));
return;
}
- long seriesHandle = log.getOriginalReturn();
+ long seriesHandle = Long.parseLong(log.getReturn());
int seriesStyle = log.getType();
String seriesName = log.getName();
int colorIndex = log.getColor();
return;
}
- long seriesHandle = log.getOriginalReturn();
+ long seriesHandle = Long.parseLong(log.getReturn());
int colorIndex = chart.getUnusedColorIndex();
String seriesName = log.getName();