|
|
|
@ -30,6 +30,9 @@ import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContex
|
|
|
|
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsUpdatedEvent;
|
|
|
|
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
|
|
|
|
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
|
|
|
|
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.CollectAction;
|
|
|
|
|
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.EvaluateAction;
|
|
|
|
|
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager;
|
|
|
|
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
|
|
|
|
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
|
|
|
|
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
|
|
|
|
@ -58,6 +61,10 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
// GDB tracepoints are only supported on a remote target (e.g., using gdbserver)
|
|
|
|
|
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
|
|
|
|
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
|
|
|
|
|
|
|
|
|
// To test both fast and slow tracepoint we just the FAST_THEN_SLOW setting
|
|
|
|
|
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
|
|
|
|
|
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_SLOW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DsfSession fSession;
|
|
|
|
@ -69,56 +76,89 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
|
|
|
|
|
// private int fTotalTracingBufferSize = 0;
|
|
|
|
|
|
|
|
|
|
private static final String SOURCE_FILE = "TracepointTestApp.cc";
|
|
|
|
|
private static final String METHOD_NAME = "testTracepoints";
|
|
|
|
|
private static final int LINE_NUMBER_1 = 97;
|
|
|
|
|
private static final int LINE_NUMBER_2 = 75;
|
|
|
|
|
private static final int LINE_NUMBER_3 = 76;
|
|
|
|
|
private static final int LINE_NUMBER_4 = 85;
|
|
|
|
|
private static final int LINE_LOOP_2 = 109;
|
|
|
|
|
private static final String NO_CONDITION = "";
|
|
|
|
|
private static final String NO_COMMANDS = "";
|
|
|
|
|
// private static final int LAST_LINE_NUMBER = 94;
|
|
|
|
|
//
|
|
|
|
|
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000;
|
|
|
|
|
|
|
|
|
|
private final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0};
|
|
|
|
|
private final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"};
|
|
|
|
|
|
|
|
|
|
// private static CollectAction COLLECT_ACTION_1;
|
|
|
|
|
// private static CollectAction COLLECT_ACTION_2;
|
|
|
|
|
// private static CollectAction COLLECT_ACTION_3;
|
|
|
|
|
// private static EvalAction EVAL_ACTION_1;
|
|
|
|
|
// private static EvalAction EVAL_ACTION_2;
|
|
|
|
|
// private static EvalAction EVAL_ACTION_3;
|
|
|
|
|
// private static WhileSteppingAction STEPPING_ACTION_1;
|
|
|
|
|
// private static WhileSteppingAction STEPPING_ACTION_2;
|
|
|
|
|
// private static WhileSteppingAction STEPPING_ACTION_3;
|
|
|
|
|
private static CollectAction[] COLLECT_ACTIONS = new CollectAction[10];
|
|
|
|
|
private static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10];
|
|
|
|
|
// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3];
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance();
|
|
|
|
|
|
|
|
|
|
// static {
|
|
|
|
|
// BreakpointActionManager breakpointActionMgr = CDebugCorePlugin.getDefault().getBreakpointActionManager();
|
|
|
|
|
//
|
|
|
|
|
// COLLECT_ACTION_1 = new CollectAction();
|
|
|
|
|
// COLLECT_ACTION_1.setCollectString("$locals, counter");
|
|
|
|
|
// COLLECT_ACTION_1.setName("CollectAction1");
|
|
|
|
|
// breakpointActionMgr.addAction(COLLECT_ACTION_1);
|
|
|
|
|
//
|
|
|
|
|
// COLLECT_ACTION_2 = new CollectAction();
|
|
|
|
|
// COLLECT_ACTION_2.setCollectString("$reg");
|
|
|
|
|
// COLLECT_ACTION_2.setName("CollectAction2");
|
|
|
|
|
// breakpointActionMgr.addAction(COLLECT_ACTION_2);
|
|
|
|
|
//
|
|
|
|
|
// COLLECT_ACTION_3 = new CollectAction();
|
|
|
|
|
// COLLECT_ACTION_3.setCollectString("$myTraceVariable");
|
|
|
|
|
// COLLECT_ACTION_3.setName("CollectAction3");
|
|
|
|
|
// breakpointActionMgr.addAction(COLLECT_ACTION_3);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// EVAL_ACTION_1 = new EvalAction();
|
|
|
|
|
// EVAL_ACTION_1.setEvalString("$count=$count+1");
|
|
|
|
|
// EVAL_ACTION_1.setName("EvalAction1");
|
|
|
|
|
// breakpointActionMgr.addAction(EVAL_ACTION_1);
|
|
|
|
|
//
|
|
|
|
|
// EVAL_ACTION_2 = new EvalAction();
|
|
|
|
|
// EVAL_ACTION_2.setEvalString("$count2=$count2+2");
|
|
|
|
|
// EVAL_ACTION_2.setName("EvalAction2");
|
|
|
|
|
// breakpointActionMgr.addAction(EVAL_ACTION_2);
|
|
|
|
|
//
|
|
|
|
|
// EVAL_ACTION_3 = new EvalAction();
|
|
|
|
|
// EVAL_ACTION_3.setEvalString("$count3=$count3+3");
|
|
|
|
|
// EVAL_ACTION_3.setName("EvalAction3");
|
|
|
|
|
// breakpointActionMgr.addAction(EVAL_ACTION_3);
|
|
|
|
|
//
|
|
|
|
|
// //TODO do while stepping actions
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
int index = 0;
|
|
|
|
|
COLLECT_ACTIONS[index] = new CollectAction();
|
|
|
|
|
COLLECT_ACTIONS[index].setCollectString("$locals");
|
|
|
|
|
COLLECT_ACTIONS[index].setName("Collect locals");
|
|
|
|
|
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
COLLECT_ACTIONS[index] = new CollectAction();
|
|
|
|
|
COLLECT_ACTIONS[index].setCollectString("gIntVar");
|
|
|
|
|
COLLECT_ACTIONS[index].setName("Collect gIntVar");
|
|
|
|
|
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
COLLECT_ACTIONS[index] = new CollectAction();
|
|
|
|
|
COLLECT_ACTIONS[index].setCollectString("$locals, counter, $reg");
|
|
|
|
|
COLLECT_ACTIONS[index].setName("Collect locals, counter and reg");
|
|
|
|
|
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
COLLECT_ACTIONS[index] = new CollectAction();
|
|
|
|
|
COLLECT_ACTIONS[index].setCollectString("$reg");
|
|
|
|
|
COLLECT_ACTIONS[index].setName("Collect reg");
|
|
|
|
|
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
COLLECT_ACTIONS[index] = new CollectAction();
|
|
|
|
|
COLLECT_ACTIONS[index].setCollectString("counter, $locals");
|
|
|
|
|
COLLECT_ACTIONS[index].setName("Collect counter, locals");
|
|
|
|
|
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
COLLECT_ACTIONS[index] = new CollectAction();
|
|
|
|
|
COLLECT_ACTIONS[index].setCollectString("$myTraceVariable");
|
|
|
|
|
COLLECT_ACTIONS[index].setName("Collect myTraceVariable");
|
|
|
|
|
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
index=0;
|
|
|
|
|
EVAL_ACTIONS[index] = new EvaluateAction();
|
|
|
|
|
EVAL_ACTIONS[index].setEvalString("$count=$count+1");
|
|
|
|
|
EVAL_ACTIONS[index].setName("Eval increment count");
|
|
|
|
|
tracepointActionMgr.addAction(EVAL_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
EVAL_ACTIONS[index] = new EvaluateAction();
|
|
|
|
|
EVAL_ACTIONS[index].setEvalString("$count2=$count2+2");
|
|
|
|
|
EVAL_ACTIONS[index].setName("Eval increment count2 by 2");
|
|
|
|
|
tracepointActionMgr.addAction(EVAL_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
EVAL_ACTIONS[index] = new EvaluateAction();
|
|
|
|
|
EVAL_ACTIONS[index].setEvalString("$count3=$count3+3");
|
|
|
|
|
EVAL_ACTIONS[index].setName("Eval increment count3 by 3");
|
|
|
|
|
tracepointActionMgr.addAction(EVAL_ACTIONS[index]);
|
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
//TODO do while stepping actions
|
|
|
|
|
index=0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
|
public void initialTest() throws Exception {
|
|
|
|
@ -496,19 +536,6 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
// Below are the tests for the control of tracepoints.
|
|
|
|
|
// *********************************************************************
|
|
|
|
|
|
|
|
|
|
private static final String SOURCE_FILE = "TracepointTestApp.cc";
|
|
|
|
|
private static final String METHOD_NAME = "testTracepoints";
|
|
|
|
|
private static final int LINE_NUMBER_1 = 84;
|
|
|
|
|
private static final int LINE_NUMBER_2 = 55;
|
|
|
|
|
private static final int LINE_NUMBER_3 = 56;
|
|
|
|
|
private static final int LINE_LOOP_1 = 81;
|
|
|
|
|
private static final int LINE_LOOP_2 = 88;
|
|
|
|
|
private static final String NO_CONDITION = "";
|
|
|
|
|
// private static final int LAST_LINE_NUMBER = 94;
|
|
|
|
|
//
|
|
|
|
|
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private IBreakpointDMContext[] fTracepoints = null;
|
|
|
|
|
|
|
|
|
|
// private void checkTraceStatus(boolean supported, boolean active, int frames,
|
|
|
|
@ -548,7 +575,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
// checkTraceStatus(supported, active, frames, null, null);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// GDB 7.0 does not support fast tracepoints, but GDB 7.1 will
|
|
|
|
|
// GDB 7.0 does not support fast tracepoints, but GDB 7.2 will
|
|
|
|
|
protected boolean fastTracepointsSupported() { return false; }
|
|
|
|
|
|
|
|
|
|
private class TracepointData {
|
|
|
|
@ -557,16 +584,16 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
String condition;
|
|
|
|
|
int passcount;
|
|
|
|
|
boolean enabled;
|
|
|
|
|
String actions;
|
|
|
|
|
String commands;
|
|
|
|
|
boolean isFastTp;
|
|
|
|
|
|
|
|
|
|
public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String acts, boolean fast) {
|
|
|
|
|
public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String cmds, boolean fast) {
|
|
|
|
|
sourceFile = file;
|
|
|
|
|
lineNumber = line;
|
|
|
|
|
condition = cond;
|
|
|
|
|
passcount = pass;
|
|
|
|
|
enabled = isEnabled;
|
|
|
|
|
actions = acts;
|
|
|
|
|
commands = cmds;
|
|
|
|
|
if (fastTracepointsSupported()) {
|
|
|
|
|
isFastTp = fast;
|
|
|
|
|
} else {
|
|
|
|
@ -600,10 +627,10 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
tp.getCondition().equals(data.condition));
|
|
|
|
|
assertTrue("tracepoint "+i+" mismatch (wrong pass count) got " + tp.getPassCount(),
|
|
|
|
|
tp.getPassCount() == data.passcount);
|
|
|
|
|
assertTrue("tracepoint "+i+" mismatch (wrong state) got " + tp.isEnabled(),
|
|
|
|
|
assertTrue("tracepoint "+i+" mismatch (wrong enablement) got " + tp.isEnabled(),
|
|
|
|
|
tp.isEnabled() == data.enabled);
|
|
|
|
|
assertTrue("tracepoint mismatch (wrong actions) got " + tp.getCommands(),
|
|
|
|
|
tp.getCommands().equals(data.actions));
|
|
|
|
|
assertTrue("tracepoint "+i+" mismatch (wrong actions) got " + tp.getCommands(),
|
|
|
|
|
tp.getCommands().equals(data.commands));
|
|
|
|
|
|
|
|
|
|
assertTrue("tracepoint "+i+" mismatch",
|
|
|
|
|
tp.equals((MIBreakpointDMData)getBreakpoint(tracepoints[i])));
|
|
|
|
@ -630,7 +657,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
* It also set a fast tracepoint by
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testCreateTracepoints() throws Throwable {
|
|
|
|
|
public void createTracepoints() throws Throwable {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
@ -648,7 +675,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint (will be a fast tracepoint)
|
|
|
|
|
// Second tracepoint (will be a slow tracepoint)
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
@ -662,11 +689,11 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Third tracepoint (will be a slow tracepoint)
|
|
|
|
|
// Third tracepoint (will be a fast tracepoint)
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_4);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
@ -705,11 +732,11 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
@ -718,8 +745,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
* This test sets the different types of tracepoints and then deletes them
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testDeleteTracepoints() throws Throwable {
|
|
|
|
|
testCreateTracepoints();
|
|
|
|
|
public void deleteTracepoints() throws Throwable {
|
|
|
|
|
createTracepoints();
|
|
|
|
|
// Delete all tracepoints
|
|
|
|
|
for (IBreakpointDMContext tp : fTracepoints) {
|
|
|
|
|
if (tp == null) break;
|
|
|
|
@ -736,8 +763,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
* This test sets the different types of tracepoints and then disables them
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testDisableTracepoints() throws Throwable {
|
|
|
|
|
testCreateTracepoints();
|
|
|
|
|
public void disableTracepoints() throws Throwable {
|
|
|
|
|
createTracepoints();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> delta = new HashMap<String, Object>();
|
|
|
|
|
delta.put(MIBreakpoints.IS_ENABLED, false);
|
|
|
|
@ -748,11 +775,11 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, false, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, false, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
@ -761,8 +788,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
* This test sets, disables the different types of tracepoints and then enables them
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testEnableTracepoints() throws Throwable {
|
|
|
|
|
testDisableTracepoints();
|
|
|
|
|
public void enableTracepoints() throws Throwable {
|
|
|
|
|
disableTracepoints();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> delta = new HashMap<String, Object>();
|
|
|
|
|
delta.put(MIBreakpoints.IS_ENABLED, true);
|
|
|
|
@ -773,11 +800,11 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
@ -786,8 +813,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
* This test sets the different types of tracepoints and then sets their passcount
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testTracepointPasscount() throws Throwable {
|
|
|
|
|
testCreateTracepoints();
|
|
|
|
|
public void tracepointPasscount() throws Throwable {
|
|
|
|
|
createTracepoints();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> delta = new HashMap<String, Object>();
|
|
|
|
|
// Set passcount for all tracepoints
|
|
|
|
@ -799,50 +826,408 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, PASS_COUNTS[2], true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, "", true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, "", false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, PASS_COUNTS[2], true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, NO_COMMANDS, false));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test sets a tracepoint and then gives it a condition
|
|
|
|
|
* This test sets the different types of tracepoints and then sets some conditions
|
|
|
|
|
*/
|
|
|
|
|
//@Test
|
|
|
|
|
public void testTracepointCondition() throws Throwable {
|
|
|
|
|
// Use trace state variables and stuff
|
|
|
|
|
@Test
|
|
|
|
|
public void tracepointCondition() throws Throwable {
|
|
|
|
|
createTracepoints();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> delta = new HashMap<String, Object>();
|
|
|
|
|
// Set conditions for all tracepoints
|
|
|
|
|
for (int i=0; i<fTracepoints.length; i++) {
|
|
|
|
|
if (fTracepoints[i] == null) break;
|
|
|
|
|
if (CONDITIONS[i].equals(NO_CONDITION)) continue;
|
|
|
|
|
delta.put(MIBreakpoints.CONDITION, CONDITIONS[i]);
|
|
|
|
|
updateBreakpoint(fTracepoints[i], delta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, CONDITIONS[0], 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[1], 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, CONDITIONS[2], 0, true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[3], 0, true, NO_COMMANDS, true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[4], 0, true, NO_COMMANDS, false));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test sets the different types of tracepoints and then sets some actions
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void tracepointActions() throws Throwable {
|
|
|
|
|
createTracepoints();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> delta = new HashMap<String, Object>();
|
|
|
|
|
// Set conditions for all tracepoints
|
|
|
|
|
for (int i=0; i<fTracepoints.length; i++) {
|
|
|
|
|
if (fTracepoints[i] == null) break;
|
|
|
|
|
if (COLLECT_ACTIONS[i].equals(NO_COMMANDS)) continue;
|
|
|
|
|
delta.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName());
|
|
|
|
|
updateBreakpoint(fTracepoints[i], delta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, COLLECT_ACTIONS[2].toString(), true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[3].toString(), true));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[4].toString(), false));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates a tracepoint that starts disabled
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointDisabled() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
attributes.put(MIBreakpoints.IS_ENABLED, false);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
attributes.put(MIBreakpoints.IS_ENABLED, false);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates a tracepoint that starts with a passcount
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointWithPasscount() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates a tracepoint that starts with a condition
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointWithCondition() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], 0, true, NO_COMMANDS, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], 0, true, NO_COMMANDS, true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates tracepoints that start a command
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointWithCommand() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName());
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName());
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates tracepoints that start with more than one command
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointWithMultipleCommands() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[2].getName();
|
|
|
|
|
String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[2].toString();
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, commandsNames1);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[1].getName();
|
|
|
|
|
String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER +
|
|
|
|
|
COLLECT_ACTIONS[1].toString();
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, commandsNames2);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, commandsResult1, false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, commandsResult2, true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates an enabled tracepoint that starts with commands, condition and passcount
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointEnabledWithCommandsConditionPasscount() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName());
|
|
|
|
|
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]);
|
|
|
|
|
attributes.put(MIBreakpoints.IS_ENABLED, true);
|
|
|
|
|
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName());
|
|
|
|
|
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]);
|
|
|
|
|
attributes.put(MIBreakpoints.IS_ENABLED, true);
|
|
|
|
|
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], true, COLLECT_ACTIONS[0].toString(), false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], true, COLLECT_ACTIONS[1].toString(), true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This test creates a disabled tracepoint that starts with commands, condition and passcount
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void createTracepointDisabledWithCommandsConditionPasscount() throws Throwable {
|
|
|
|
|
Map<String, Object> attributes = null;
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
|
|
|
|
// First tracepoint will be a slow tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2);
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName());
|
|
|
|
|
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]);
|
|
|
|
|
attributes.put(MIBreakpoints.IS_ENABLED, false);
|
|
|
|
|
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
// Second tracepoint will be a fast tracepoint
|
|
|
|
|
attributes = new HashMap<String, Object>();
|
|
|
|
|
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
|
|
|
|
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE);
|
|
|
|
|
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1);
|
|
|
|
|
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName());
|
|
|
|
|
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]);
|
|
|
|
|
attributes.put(MIBreakpoints.IS_ENABLED, false);
|
|
|
|
|
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]);
|
|
|
|
|
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes);
|
|
|
|
|
|
|
|
|
|
waitForBreakpointEvent();
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
|
|
|
|
|
+ fBreakpointEventCount, fBreakpointEventCount == 1);
|
|
|
|
|
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received "
|
|
|
|
|
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1);
|
|
|
|
|
clearEventCounters();
|
|
|
|
|
|
|
|
|
|
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], false, COLLECT_ACTIONS[0].toString(), false));
|
|
|
|
|
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], false, COLLECT_ACTIONS[1].toString(), true));
|
|
|
|
|
|
|
|
|
|
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private void testActions(String[] actions) throws Throwable {
|
|
|
|
|
// Map<String, Object> delta = new HashMap<String, Object>();
|
|
|
|
|
// ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>();
|
|
|
|
|
//
|
|
|
|
|
// for (int i=0; i<actions.length; i++) {
|
|
|
|
|
// delta.put(MIBreakpoints.COMMANDS, actions[i]);
|
|
|
|
|
// updateBreakpoint(fTracepoints[i], delta);
|
|
|
|
|
// dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, actions[i], false));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()]));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * This test sets the different types of tracepoints and then sets some collect actions
|
|
|
|
|
// */
|
|
|
|
|
// @Test
|
|
|
|
|
// public void testCollectActions() throws Throwable {
|
|
|
|
|
// final String ACTIONS1 = COLLECT_ACTION_1.getName()+","+COLLECT_ACTION_2.getName()+","+COLLECT_ACTION_3.getName();
|
|
|
|
|
// final String ACTIONS2 = COLLECT_ACTION_1.getName()+","+COLLECT_ACTION_3.getName();
|
|
|
|
|
// final String ACTIONS3 = COLLECT_ACTION_3.getName();
|
|
|
|
|
//
|
|
|
|
|
// testCreateTracepoints();
|
|
|
|
|
// testActions(new String[] {ACTIONS1, ACTIONS2, ACTIONS3, ""});
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * This test sets the different types of tracepoints and then sets some eval actions
|
|
|
|
|
// */
|
|
|
|
|