|
Lines 30-35
Link Here
|
| 30 |
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsUpdatedEvent; |
30 |
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsUpdatedEvent; |
| 31 |
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; |
31 |
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; |
| 32 |
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; |
32 |
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; |
|
|
33 |
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.CollectAction; |
| 34 |
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.EvaluateAction; |
| 35 |
import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager; |
| 33 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; |
36 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; |
| 34 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; |
37 |
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; |
| 35 |
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; |
38 |
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; |
|
Lines 58-63
Link Here
|
| 58 |
// GDB tracepoints are only supported on a remote target (e.g., using gdbserver) |
61 |
// GDB tracepoints are only supported on a remote target (e.g., using gdbserver) |
| 59 |
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, |
62 |
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, |
| 60 |
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); |
63 |
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); |
|
|
64 |
|
| 65 |
// To test both fast and slow tracepoint we just the FAST_THEN_SLOW setting |
| 66 |
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, |
| 67 |
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_SLOW); |
| 61 |
} |
68 |
} |
| 62 |
|
69 |
|
| 63 |
private DsfSession fSession; |
70 |
private DsfSession fSession; |
|
Lines 69-124
Link Here
|
| 69 |
|
76 |
|
| 70 |
// private int fTotalTracingBufferSize = 0; |
77 |
// private int fTotalTracingBufferSize = 0; |
| 71 |
|
78 |
|
|
|
79 |
|
| 80 |
private static final String SOURCE_FILE = "TracepointTestApp.cc"; |
| 81 |
private static final String METHOD_NAME = "testTracepoints"; |
| 82 |
private static final int LINE_NUMBER_1 = 97; |
| 83 |
private static final int LINE_NUMBER_2 = 75; |
| 84 |
private static final int LINE_NUMBER_3 = 76; |
| 85 |
private static final int LINE_NUMBER_4 = 85; |
| 86 |
private static final int LINE_LOOP_2 = 109; |
| 87 |
private static final String NO_CONDITION = ""; |
| 88 |
private static final String NO_COMMANDS = ""; |
| 89 |
// private static final int LAST_LINE_NUMBER = 94; |
| 90 |
// |
| 91 |
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000; |
| 92 |
|
| 72 |
private final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0}; |
93 |
private final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0}; |
|
|
94 |
private final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"}; |
| 73 |
|
95 |
|
| 74 |
// private static CollectAction COLLECT_ACTION_1; |
96 |
private static CollectAction[] COLLECT_ACTIONS = new CollectAction[10]; |
| 75 |
// private static CollectAction COLLECT_ACTION_2; |
97 |
private static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10]; |
| 76 |
// private static CollectAction COLLECT_ACTION_3; |
98 |
// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3]; |
| 77 |
// private static EvalAction EVAL_ACTION_1; |
|
|
| 78 |
// private static EvalAction EVAL_ACTION_2; |
| 79 |
// private static EvalAction EVAL_ACTION_3; |
| 80 |
// private static WhileSteppingAction STEPPING_ACTION_1; |
| 81 |
// private static WhileSteppingAction STEPPING_ACTION_2; |
| 82 |
// private static WhileSteppingAction STEPPING_ACTION_3; |
| 83 |
|
99 |
|
| 84 |
|
100 |
|
| 85 |
// static { |
101 |
static { |
| 86 |
// BreakpointActionManager breakpointActionMgr = CDebugCorePlugin.getDefault().getBreakpointActionManager(); |
102 |
TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance(); |
| 87 |
// |
103 |
|
| 88 |
// COLLECT_ACTION_1 = new CollectAction(); |
104 |
int index = 0; |
| 89 |
// COLLECT_ACTION_1.setCollectString("$locals, counter"); |
105 |
COLLECT_ACTIONS[index] = new CollectAction(); |
| 90 |
// COLLECT_ACTION_1.setName("CollectAction1"); |
106 |
COLLECT_ACTIONS[index].setCollectString("$locals"); |
| 91 |
// breakpointActionMgr.addAction(COLLECT_ACTION_1); |
107 |
COLLECT_ACTIONS[index].setName("Collect locals"); |
| 92 |
// |
108 |
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); |
| 93 |
// COLLECT_ACTION_2 = new CollectAction(); |
109 |
index++; |
| 94 |
// COLLECT_ACTION_2.setCollectString("$reg"); |
110 |
|
| 95 |
// COLLECT_ACTION_2.setName("CollectAction2"); |
111 |
COLLECT_ACTIONS[index] = new CollectAction(); |
| 96 |
// breakpointActionMgr.addAction(COLLECT_ACTION_2); |
112 |
COLLECT_ACTIONS[index].setCollectString("gIntVar"); |
| 97 |
// |
113 |
COLLECT_ACTIONS[index].setName("Collect gIntVar"); |
| 98 |
// COLLECT_ACTION_3 = new CollectAction(); |
114 |
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); |
| 99 |
// COLLECT_ACTION_3.setCollectString("$myTraceVariable"); |
115 |
index++; |
| 100 |
// COLLECT_ACTION_3.setName("CollectAction3"); |
116 |
|
| 101 |
// breakpointActionMgr.addAction(COLLECT_ACTION_3); |
117 |
COLLECT_ACTIONS[index] = new CollectAction(); |
| 102 |
// |
118 |
COLLECT_ACTIONS[index].setCollectString("$locals, counter, $reg"); |
| 103 |
// |
119 |
COLLECT_ACTIONS[index].setName("Collect locals, counter and reg"); |
| 104 |
// EVAL_ACTION_1 = new EvalAction(); |
120 |
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); |
| 105 |
// EVAL_ACTION_1.setEvalString("$count=$count+1"); |
121 |
index++; |
| 106 |
// EVAL_ACTION_1.setName("EvalAction1"); |
122 |
|
| 107 |
// breakpointActionMgr.addAction(EVAL_ACTION_1); |
123 |
COLLECT_ACTIONS[index] = new CollectAction(); |
| 108 |
// |
124 |
COLLECT_ACTIONS[index].setCollectString("$reg"); |
| 109 |
// EVAL_ACTION_2 = new EvalAction(); |
125 |
COLLECT_ACTIONS[index].setName("Collect reg"); |
| 110 |
// EVAL_ACTION_2.setEvalString("$count2=$count2+2"); |
126 |
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); |
| 111 |
// EVAL_ACTION_2.setName("EvalAction2"); |
127 |
index++; |
| 112 |
// breakpointActionMgr.addAction(EVAL_ACTION_2); |
128 |
|
| 113 |
// |
129 |
COLLECT_ACTIONS[index] = new CollectAction(); |
| 114 |
// EVAL_ACTION_3 = new EvalAction(); |
130 |
COLLECT_ACTIONS[index].setCollectString("counter, $locals"); |
| 115 |
// EVAL_ACTION_3.setEvalString("$count3=$count3+3"); |
131 |
COLLECT_ACTIONS[index].setName("Collect counter, locals"); |
| 116 |
// EVAL_ACTION_3.setName("EvalAction3"); |
132 |
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); |
| 117 |
// breakpointActionMgr.addAction(EVAL_ACTION_3); |
133 |
index++; |
| 118 |
// |
134 |
|
| 119 |
// //TODO do while stepping actions |
135 |
COLLECT_ACTIONS[index] = new CollectAction(); |
| 120 |
// |
136 |
COLLECT_ACTIONS[index].setCollectString("$myTraceVariable"); |
| 121 |
// } |
137 |
COLLECT_ACTIONS[index].setName("Collect myTraceVariable"); |
|
|
138 |
tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); |
| 139 |
index++; |
| 140 |
|
| 141 |
index=0; |
| 142 |
EVAL_ACTIONS[index] = new EvaluateAction(); |
| 143 |
EVAL_ACTIONS[index].setEvalString("$count=$count+1"); |
| 144 |
EVAL_ACTIONS[index].setName("Eval increment count"); |
| 145 |
tracepointActionMgr.addAction(EVAL_ACTIONS[index]); |
| 146 |
index++; |
| 147 |
|
| 148 |
EVAL_ACTIONS[index] = new EvaluateAction(); |
| 149 |
EVAL_ACTIONS[index].setEvalString("$count2=$count2+2"); |
| 150 |
EVAL_ACTIONS[index].setName("Eval increment count2 by 2"); |
| 151 |
tracepointActionMgr.addAction(EVAL_ACTIONS[index]); |
| 152 |
index++; |
| 153 |
|
| 154 |
EVAL_ACTIONS[index] = new EvaluateAction(); |
| 155 |
EVAL_ACTIONS[index].setEvalString("$count3=$count3+3"); |
| 156 |
EVAL_ACTIONS[index].setName("Eval increment count3 by 3"); |
| 157 |
tracepointActionMgr.addAction(EVAL_ACTIONS[index]); |
| 158 |
index++; |
| 159 |
|
| 160 |
//TODO do while stepping actions |
| 161 |
index=0; |
| 162 |
|
| 163 |
} |
| 122 |
|
164 |
|
| 123 |
@Before |
165 |
@Before |
| 124 |
public void initialTest() throws Exception { |
166 |
public void initialTest() throws Exception { |
|
Lines 496-512
Link Here
|
| 496 |
// Below are the tests for the control of tracepoints. |
538 |
// Below are the tests for the control of tracepoints. |
| 497 |
// ********************************************************************* |
539 |
// ********************************************************************* |
| 498 |
|
540 |
|
| 499 |
private static final String SOURCE_FILE = "TracepointTestApp.cc"; |
|
|
| 500 |
private static final String METHOD_NAME = "testTracepoints"; |
| 501 |
private static final int LINE_NUMBER_1 = 84; |
| 502 |
private static final int LINE_NUMBER_2 = 55; |
| 503 |
private static final int LINE_NUMBER_3 = 56; |
| 504 |
private static final int LINE_LOOP_1 = 81; |
| 505 |
private static final int LINE_LOOP_2 = 88; |
| 506 |
private static final String NO_CONDITION = ""; |
| 507 |
// private static final int LAST_LINE_NUMBER = 94; |
| 508 |
// |
| 509 |
// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000; |
| 510 |
|
541 |
|
| 511 |
|
542 |
|
| 512 |
private IBreakpointDMContext[] fTracepoints = null; |
543 |
private IBreakpointDMContext[] fTracepoints = null; |
|
Lines 548-554
Link Here
|
| 548 |
// checkTraceStatus(supported, active, frames, null, null); |
579 |
// checkTraceStatus(supported, active, frames, null, null); |
| 549 |
// } |
580 |
// } |
| 550 |
|
581 |
|
| 551 |
// GDB 7.0 does not support fast tracepoints, but GDB 7.1 will |
582 |
// GDB 7.0 does not support fast tracepoints, but GDB 7.2 will |
| 552 |
protected boolean fastTracepointsSupported() { return false; } |
583 |
protected boolean fastTracepointsSupported() { return false; } |
| 553 |
|
584 |
|
| 554 |
private class TracepointData { |
585 |
private class TracepointData { |
|
Lines 557-572
Link Here
|
| 557 |
String condition; |
588 |
String condition; |
| 558 |
int passcount; |
589 |
int passcount; |
| 559 |
boolean enabled; |
590 |
boolean enabled; |
| 560 |
String actions; |
591 |
String commands; |
| 561 |
boolean isFastTp; |
592 |
boolean isFastTp; |
| 562 |
|
593 |
|
| 563 |
public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String acts, boolean fast) { |
594 |
public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String cmds, boolean fast) { |
| 564 |
sourceFile = file; |
595 |
sourceFile = file; |
| 565 |
lineNumber = line; |
596 |
lineNumber = line; |
| 566 |
condition = cond; |
597 |
condition = cond; |
| 567 |
passcount = pass; |
598 |
passcount = pass; |
| 568 |
enabled = isEnabled; |
599 |
enabled = isEnabled; |
| 569 |
actions = acts; |
600 |
commands = cmds; |
| 570 |
if (fastTracepointsSupported()) { |
601 |
if (fastTracepointsSupported()) { |
| 571 |
isFastTp = fast; |
602 |
isFastTp = fast; |
| 572 |
} else { |
603 |
} else { |
|
Lines 600-609
Link Here
|
| 600 |
tp.getCondition().equals(data.condition)); |
631 |
tp.getCondition().equals(data.condition)); |
| 601 |
assertTrue("tracepoint "+i+" mismatch (wrong pass count) got " + tp.getPassCount(), |
632 |
assertTrue("tracepoint "+i+" mismatch (wrong pass count) got " + tp.getPassCount(), |
| 602 |
tp.getPassCount() == data.passcount); |
633 |
tp.getPassCount() == data.passcount); |
| 603 |
assertTrue("tracepoint "+i+" mismatch (wrong state) got " + tp.isEnabled(), |
634 |
assertTrue("tracepoint "+i+" mismatch (wrong enablement) got " + tp.isEnabled(), |
| 604 |
tp.isEnabled() == data.enabled); |
635 |
tp.isEnabled() == data.enabled); |
| 605 |
assertTrue("tracepoint mismatch (wrong actions) got " + tp.getCommands(), |
636 |
assertTrue("tracepoint "+i+" mismatch (wrong actions) got " + tp.getCommands(), |
| 606 |
tp.getCommands().equals(data.actions)); |
637 |
tp.getCommands().equals(data.commands)); |
| 607 |
|
638 |
|
| 608 |
assertTrue("tracepoint "+i+" mismatch", |
639 |
assertTrue("tracepoint "+i+" mismatch", |
| 609 |
tp.equals((MIBreakpointDMData)getBreakpoint(tracepoints[i]))); |
640 |
tp.equals((MIBreakpointDMData)getBreakpoint(tracepoints[i]))); |
|
Lines 630-636
Link Here
|
| 630 |
* It also set a fast tracepoint by |
661 |
* It also set a fast tracepoint by |
| 631 |
*/ |
662 |
*/ |
| 632 |
@Test |
663 |
@Test |
| 633 |
public void testCreateTracepoints() throws Throwable { |
664 |
public void createTracepoints() throws Throwable { |
| 634 |
|
665 |
|
| 635 |
Map<String, Object> attributes = null; |
666 |
Map<String, Object> attributes = null; |
| 636 |
int index = 0; |
667 |
int index = 0; |
|
Lines 648-654
Link Here
|
| 648 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
679 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 649 |
clearEventCounters(); |
680 |
clearEventCounters(); |
| 650 |
|
681 |
|
| 651 |
// Second tracepoint (will be a fast tracepoint) |
682 |
// Second tracepoint (will be a slow tracepoint) |
| 652 |
attributes = new HashMap<String, Object>(); |
683 |
attributes = new HashMap<String, Object>(); |
| 653 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
684 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 654 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
685 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
|
Lines 662-672
Link Here
|
| 662 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
693 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 663 |
clearEventCounters(); |
694 |
clearEventCounters(); |
| 664 |
|
695 |
|
| 665 |
// Third tracepoint (will be a slow tracepoint) |
696 |
// Third tracepoint (will be a fast tracepoint) |
| 666 |
attributes = new HashMap<String, Object>(); |
697 |
attributes = new HashMap<String, Object>(); |
| 667 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
698 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 668 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
699 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 669 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); |
700 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_4); |
| 670 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
701 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 671 |
|
702 |
|
| 672 |
waitForBreakpointEvent(); |
703 |
waitForBreakpointEvent(); |
|
Lines 705-715
Link Here
|
| 705 |
clearEventCounters(); |
736 |
clearEventCounters(); |
| 706 |
|
737 |
|
| 707 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
738 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 708 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, "", false)); |
739 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); |
| 709 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, "", true)); |
740 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, false)); |
| 710 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, "", false)); |
741 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true)); |
| 711 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, "", true)); |
742 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); |
| 712 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, "", false)); |
743 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); |
| 713 |
|
744 |
|
| 714 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
745 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 715 |
} |
746 |
} |
|
Lines 718-725
Link Here
|
| 718 |
* This test sets the different types of tracepoints and then deletes them |
749 |
* This test sets the different types of tracepoints and then deletes them |
| 719 |
*/ |
750 |
*/ |
| 720 |
@Test |
751 |
@Test |
| 721 |
public void testDeleteTracepoints() throws Throwable { |
752 |
public void deleteTracepoints() throws Throwable { |
| 722 |
testCreateTracepoints(); |
753 |
createTracepoints(); |
| 723 |
// Delete all tracepoints |
754 |
// Delete all tracepoints |
| 724 |
for (IBreakpointDMContext tp : fTracepoints) { |
755 |
for (IBreakpointDMContext tp : fTracepoints) { |
| 725 |
if (tp == null) break; |
756 |
if (tp == null) break; |
|
Lines 736-743
Link Here
|
| 736 |
* This test sets the different types of tracepoints and then disables them |
767 |
* This test sets the different types of tracepoints and then disables them |
| 737 |
*/ |
768 |
*/ |
| 738 |
@Test |
769 |
@Test |
| 739 |
public void testDisableTracepoints() throws Throwable { |
770 |
public void disableTracepoints() throws Throwable { |
| 740 |
testCreateTracepoints(); |
771 |
createTracepoints(); |
| 741 |
|
772 |
|
| 742 |
Map<String, Object> delta = new HashMap<String, Object>(); |
773 |
Map<String, Object> delta = new HashMap<String, Object>(); |
| 743 |
delta.put(MIBreakpoints.IS_ENABLED, false); |
774 |
delta.put(MIBreakpoints.IS_ENABLED, false); |
|
Lines 748-758
Link Here
|
| 748 |
} |
779 |
} |
| 749 |
|
780 |
|
| 750 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
781 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 751 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, "", false)); |
782 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); |
| 752 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, "", true)); |
783 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, NO_COMMANDS, false)); |
| 753 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, false, "", false)); |
784 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, false, NO_COMMANDS, true)); |
| 754 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, "", true)); |
785 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); |
| 755 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, "", false)); |
786 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); |
| 756 |
|
787 |
|
| 757 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
788 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 758 |
} |
789 |
} |
|
Lines 761-768
Link Here
|
| 761 |
* This test sets, disables the different types of tracepoints and then enables them |
792 |
* This test sets, disables the different types of tracepoints and then enables them |
| 762 |
*/ |
793 |
*/ |
| 763 |
@Test |
794 |
@Test |
| 764 |
public void testEnableTracepoints() throws Throwable { |
795 |
public void enableTracepoints() throws Throwable { |
| 765 |
testDisableTracepoints(); |
796 |
disableTracepoints(); |
| 766 |
|
797 |
|
| 767 |
Map<String, Object> delta = new HashMap<String, Object>(); |
798 |
Map<String, Object> delta = new HashMap<String, Object>(); |
| 768 |
delta.put(MIBreakpoints.IS_ENABLED, true); |
799 |
delta.put(MIBreakpoints.IS_ENABLED, true); |
|
Lines 773-783
Link Here
|
| 773 |
} |
804 |
} |
| 774 |
|
805 |
|
| 775 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
806 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 776 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, "", false)); |
807 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); |
| 777 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, "", true)); |
808 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, false)); |
| 778 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, "", false)); |
809 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true)); |
| 779 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, "", true)); |
810 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); |
| 780 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, "", false)); |
811 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); |
| 781 |
|
812 |
|
| 782 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
813 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 783 |
} |
814 |
} |
|
Lines 786-793
Link Here
|
| 786 |
* This test sets the different types of tracepoints and then sets their passcount |
817 |
* This test sets the different types of tracepoints and then sets their passcount |
| 787 |
*/ |
818 |
*/ |
| 788 |
@Test |
819 |
@Test |
| 789 |
public void testTracepointPasscount() throws Throwable { |
820 |
public void tracepointPasscount() throws Throwable { |
| 790 |
testCreateTracepoints(); |
821 |
createTracepoints(); |
| 791 |
|
822 |
|
| 792 |
Map<String, Object> delta = new HashMap<String, Object>(); |
823 |
Map<String, Object> delta = new HashMap<String, Object>(); |
| 793 |
// Set passcount for all tracepoints |
824 |
// Set passcount for all tracepoints |
|
Lines 795-848
Link Here
|
| 795 |
if (fTracepoints[i] == null) break; |
826 |
if (fTracepoints[i] == null) break; |
| 796 |
if (PASS_COUNTS[i] == 0) continue; |
827 |
if (PASS_COUNTS[i] == 0) continue; |
| 797 |
delta.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]); |
828 |
delta.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]); |
|
|
829 |
updateBreakpoint(fTracepoints[i], delta); |
| 830 |
} |
| 831 |
|
| 832 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 833 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); |
| 834 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, false)); |
| 835 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, PASS_COUNTS[2], true, NO_COMMANDS, true)); |
| 836 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, NO_COMMANDS, true)); |
| 837 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, NO_COMMANDS, false)); |
| 838 |
|
| 839 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 840 |
} |
| 841 |
|
| 842 |
/** |
| 843 |
* This test sets the different types of tracepoints and then sets some conditions |
| 844 |
*/ |
| 845 |
@Test |
| 846 |
public void tracepointCondition() throws Throwable { |
| 847 |
createTracepoints(); |
| 848 |
|
| 849 |
Map<String, Object> delta = new HashMap<String, Object>(); |
| 850 |
// Set conditions for all tracepoints |
| 851 |
for (int i=0; i<fTracepoints.length; i++) { |
| 852 |
if (fTracepoints[i] == null) break; |
| 853 |
if (CONDITIONS[i].equals(NO_CONDITION)) continue; |
| 854 |
delta.put(MIBreakpoints.CONDITION, CONDITIONS[i]); |
| 855 |
updateBreakpoint(fTracepoints[i], delta); |
| 856 |
} |
| 857 |
|
| 858 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 859 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, CONDITIONS[0], 0, true, NO_COMMANDS, false)); |
| 860 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[1], 0, true, NO_COMMANDS, false)); |
| 861 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, CONDITIONS[2], 0, true, NO_COMMANDS, true)); |
| 862 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[3], 0, true, NO_COMMANDS, true)); |
| 863 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[4], 0, true, NO_COMMANDS, false)); |
| 864 |
|
| 865 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 866 |
|
| 867 |
} |
| 868 |
|
| 869 |
/** |
| 870 |
* This test sets the different types of tracepoints and then sets some actions |
| 871 |
*/ |
| 872 |
@Test |
| 873 |
public void tracepointActions() throws Throwable { |
| 874 |
createTracepoints(); |
| 875 |
|
| 876 |
Map<String, Object> delta = new HashMap<String, Object>(); |
| 877 |
// Set conditions for all tracepoints |
| 878 |
for (int i=0; i<fTracepoints.length; i++) { |
| 879 |
if (fTracepoints[i] == null) break; |
| 880 |
if (COLLECT_ACTIONS[i].equals(NO_COMMANDS)) continue; |
| 881 |
delta.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName()); |
| 798 |
updateBreakpoint(fTracepoints[i], delta); |
882 |
updateBreakpoint(fTracepoints[i], delta); |
| 799 |
} |
883 |
} |
|
|
884 |
|
| 885 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 886 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); |
| 887 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), false)); |
| 888 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, COLLECT_ACTIONS[2].toString(), true)); |
| 889 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[3].toString(), true)); |
| 890 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[4].toString(), false)); |
| 891 |
|
| 892 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 893 |
|
| 894 |
} |
| 895 |
|
| 896 |
/** |
| 897 |
* This test creates a tracepoint that starts disabled |
| 898 |
*/ |
| 899 |
@Test |
| 900 |
public void createTracepointDisabled() throws Throwable { |
| 901 |
Map<String, Object> attributes = null; |
| 902 |
int index = 0; |
| 903 |
|
| 904 |
// First tracepoint will be a slow tracepoint |
| 905 |
attributes = new HashMap<String, Object>(); |
| 906 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 907 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 908 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 909 |
attributes.put(MIBreakpoints.IS_ENABLED, false); |
| 910 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 911 |
|
| 912 |
waitForBreakpointEvent(); |
| 913 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 914 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 915 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 916 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 917 |
clearEventCounters(); |
| 918 |
|
| 919 |
// Second tracepoint will be a fast tracepoint |
| 920 |
attributes = new HashMap<String, Object>(); |
| 921 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 922 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 923 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 924 |
attributes.put(MIBreakpoints.IS_ENABLED, false); |
| 925 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 926 |
|
| 927 |
waitForBreakpointEvent(); |
| 928 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 929 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 930 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 931 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 932 |
clearEventCounters(); |
| 933 |
|
| 934 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 935 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); |
| 936 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); |
| 937 |
|
| 938 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 939 |
} |
| 940 |
|
| 941 |
/** |
| 942 |
* This test creates a tracepoint that starts with a passcount |
| 943 |
*/ |
| 944 |
@Test |
| 945 |
public void createTracepointWithPasscount() throws Throwable { |
| 946 |
Map<String, Object> attributes = null; |
| 947 |
int index = 0; |
| 948 |
|
| 949 |
// First tracepoint will be a slow tracepoint |
| 950 |
attributes = new HashMap<String, Object>(); |
| 951 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 952 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 953 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 954 |
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); |
| 955 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 956 |
|
| 957 |
waitForBreakpointEvent(); |
| 958 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 959 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 960 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 961 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 962 |
clearEventCounters(); |
| 963 |
|
| 964 |
// Second tracepoint will be a fast tracepoint |
| 965 |
attributes = new HashMap<String, Object>(); |
| 966 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 967 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 968 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 969 |
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); |
| 970 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 971 |
|
| 972 |
waitForBreakpointEvent(); |
| 973 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 974 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 975 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 976 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 977 |
clearEventCounters(); |
| 978 |
|
| 979 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 980 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); |
| 981 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, true)); |
| 982 |
|
| 983 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 984 |
} |
| 985 |
|
| 986 |
/** |
| 987 |
* This test creates a tracepoint that starts with a condition |
| 988 |
*/ |
| 989 |
@Test |
| 990 |
public void createTracepointWithCondition() throws Throwable { |
| 991 |
Map<String, Object> attributes = null; |
| 992 |
int index = 0; |
| 993 |
|
| 994 |
// First tracepoint will be a slow tracepoint |
| 995 |
attributes = new HashMap<String, Object>(); |
| 996 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 997 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 998 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 999 |
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); |
| 1000 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1001 |
|
| 1002 |
waitForBreakpointEvent(); |
| 1003 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1004 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1005 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1006 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1007 |
clearEventCounters(); |
| 1008 |
|
| 1009 |
// Second tracepoint will be a fast tracepoint |
| 1010 |
attributes = new HashMap<String, Object>(); |
| 1011 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1012 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1013 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 1014 |
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); |
| 1015 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1016 |
|
| 1017 |
waitForBreakpointEvent(); |
| 1018 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1019 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1020 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1021 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1022 |
clearEventCounters(); |
| 1023 |
|
| 1024 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 1025 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], 0, true, NO_COMMANDS, false)); |
| 1026 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], 0, true, NO_COMMANDS, true)); |
| 1027 |
|
| 1028 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 1029 |
} |
| 1030 |
|
| 1031 |
/** |
| 1032 |
* This test creates tracepoints that start a command |
| 1033 |
*/ |
| 1034 |
@Test |
| 1035 |
public void createTracepointWithCommand() throws Throwable { |
| 1036 |
Map<String, Object> attributes = null; |
| 1037 |
int index = 0; |
| 1038 |
|
| 1039 |
// First tracepoint will be a slow tracepoint |
| 1040 |
attributes = new HashMap<String, Object>(); |
| 1041 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1042 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1043 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 1044 |
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); |
| 1045 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1046 |
|
| 1047 |
waitForBreakpointEvent(); |
| 1048 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1049 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1050 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1051 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1052 |
clearEventCounters(); |
| 1053 |
|
| 1054 |
// Second tracepoint will be a fast tracepoint |
| 1055 |
attributes = new HashMap<String, Object>(); |
| 1056 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1057 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1058 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 1059 |
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); |
| 1060 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1061 |
|
| 1062 |
waitForBreakpointEvent(); |
| 1063 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1064 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1065 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1066 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1067 |
clearEventCounters(); |
| 1068 |
|
| 1069 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 1070 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); |
| 1071 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), true)); |
| 1072 |
|
| 1073 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 1074 |
} |
| 1075 |
|
| 1076 |
/** |
| 1077 |
* This test creates tracepoints that start with more than one command |
| 1078 |
*/ |
| 1079 |
@Test |
| 1080 |
public void createTracepointWithMultipleCommands() throws Throwable { |
| 1081 |
Map<String, Object> attributes = null; |
| 1082 |
int index = 0; |
| 1083 |
|
| 1084 |
// First tracepoint will be a slow tracepoint |
| 1085 |
attributes = new HashMap<String, Object>(); |
| 1086 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1087 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1088 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 1089 |
String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1090 |
COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1091 |
COLLECT_ACTIONS[2].getName(); |
| 1092 |
String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1093 |
COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1094 |
COLLECT_ACTIONS[2].toString(); |
| 1095 |
attributes.put(MIBreakpoints.COMMANDS, commandsNames1); |
| 1096 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1097 |
|
| 1098 |
waitForBreakpointEvent(); |
| 1099 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1100 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1101 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1102 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1103 |
clearEventCounters(); |
| 1104 |
|
| 1105 |
// Second tracepoint will be a fast tracepoint |
| 1106 |
attributes = new HashMap<String, Object>(); |
| 1107 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1108 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1109 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 1110 |
String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1111 |
COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1112 |
COLLECT_ACTIONS[1].getName(); |
| 1113 |
String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1114 |
COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + |
| 1115 |
COLLECT_ACTIONS[1].toString(); |
| 1116 |
attributes.put(MIBreakpoints.COMMANDS, commandsNames2); |
| 1117 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1118 |
|
| 1119 |
waitForBreakpointEvent(); |
| 1120 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1121 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1122 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1123 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1124 |
clearEventCounters(); |
| 800 |
|
1125 |
|
| 801 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
1126 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 802 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, "", false)); |
1127 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, commandsResult1, false)); |
| 803 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, "", true)); |
1128 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, commandsResult2, true)); |
| 804 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, PASS_COUNTS[2], true, "", false)); |
|
|
| 805 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, "", true)); |
| 806 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, "", false)); |
| 807 |
|
1129 |
|
| 808 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
1130 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 809 |
} |
1131 |
} |
|
|
1132 |
|
| 1133 |
/** |
| 1134 |
* This test creates an enabled tracepoint that starts with commands, condition and passcount |
| 1135 |
*/ |
| 1136 |
@Test |
| 1137 |
public void createTracepointEnabledWithCommandsConditionPasscount() throws Throwable { |
| 1138 |
Map<String, Object> attributes = null; |
| 1139 |
int index = 0; |
| 1140 |
|
| 1141 |
// First tracepoint will be a slow tracepoint |
| 1142 |
attributes = new HashMap<String, Object>(); |
| 1143 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1144 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1145 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 1146 |
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); |
| 1147 |
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); |
| 1148 |
attributes.put(MIBreakpoints.IS_ENABLED, true); |
| 1149 |
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); |
| 1150 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1151 |
|
| 1152 |
waitForBreakpointEvent(); |
| 1153 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1154 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1155 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1156 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1157 |
clearEventCounters(); |
| 1158 |
|
| 1159 |
// Second tracepoint will be a fast tracepoint |
| 1160 |
attributes = new HashMap<String, Object>(); |
| 1161 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1162 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1163 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 1164 |
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); |
| 1165 |
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); |
| 1166 |
attributes.put(MIBreakpoints.IS_ENABLED, true); |
| 1167 |
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); |
| 1168 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1169 |
|
| 1170 |
waitForBreakpointEvent(); |
| 1171 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1172 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1173 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1174 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1175 |
clearEventCounters(); |
| 810 |
|
1176 |
|
|
|
1177 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 1178 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], true, COLLECT_ACTIONS[0].toString(), false)); |
| 1179 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], true, COLLECT_ACTIONS[1].toString(), true)); |
| 1180 |
|
| 1181 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 1182 |
} |
| 1183 |
|
| 811 |
/** |
1184 |
/** |
| 812 |
* This test sets a tracepoint and then gives it a condition |
1185 |
* This test creates a disabled tracepoint that starts with commands, condition and passcount |
| 813 |
*/ |
1186 |
*/ |
| 814 |
//@Test |
1187 |
@Test |
| 815 |
public void testTracepointCondition() throws Throwable { |
1188 |
public void createTracepointDisabledWithCommandsConditionPasscount() throws Throwable { |
| 816 |
// Use trace state variables and stuff |
1189 |
Map<String, Object> attributes = null; |
|
|
1190 |
int index = 0; |
| 1191 |
|
| 1192 |
// First tracepoint will be a slow tracepoint |
| 1193 |
attributes = new HashMap<String, Object>(); |
| 1194 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1195 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1196 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); |
| 1197 |
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); |
| 1198 |
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); |
| 1199 |
attributes.put(MIBreakpoints.IS_ENABLED, false); |
| 1200 |
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); |
| 1201 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1202 |
|
| 1203 |
waitForBreakpointEvent(); |
| 1204 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1205 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1206 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1207 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1208 |
clearEventCounters(); |
| 1209 |
|
| 1210 |
// Second tracepoint will be a fast tracepoint |
| 1211 |
attributes = new HashMap<String, Object>(); |
| 1212 |
attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); |
| 1213 |
attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); |
| 1214 |
attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); |
| 1215 |
attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); |
| 1216 |
attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); |
| 1217 |
attributes.put(MIBreakpoints.IS_ENABLED, false); |
| 1218 |
attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); |
| 1219 |
fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); |
| 1220 |
|
| 1221 |
waitForBreakpointEvent(); |
| 1222 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " |
| 1223 |
+ fBreakpointEventCount, fBreakpointEventCount == 1); |
| 1224 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " |
| 1225 |
+ getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); |
| 1226 |
clearEventCounters(); |
| 1227 |
|
| 1228 |
ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 1229 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], false, COLLECT_ACTIONS[0].toString(), false)); |
| 1230 |
dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], false, COLLECT_ACTIONS[1].toString(), true)); |
| 1231 |
|
| 1232 |
checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 817 |
} |
1233 |
} |
| 818 |
|
1234 |
|
| 819 |
|
1235 |
|
| 820 |
// private void testActions(String[] actions) throws Throwable { |
|
|
| 821 |
// Map<String, Object> delta = new HashMap<String, Object>(); |
| 822 |
// ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); |
| 823 |
// |
| 824 |
// for (int i=0; i<actions.length; i++) { |
| 825 |
// delta.put(MIBreakpoints.COMMANDS, actions[i]); |
| 826 |
// updateBreakpoint(fTracepoints[i], delta); |
| 827 |
// dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, actions[i], false)); |
| 828 |
// } |
| 829 |
// |
| 830 |
// checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); |
| 831 |
// } |
| 832 |
// |
| 833 |
// /** |
| 834 |
// * This test sets the different types of tracepoints and then sets some collect actions |
| 835 |
// */ |
| 836 |
// @Test |
| 837 |
// public void testCollectActions() throws Throwable { |
| 838 |
// final String ACTIONS1 = COLLECT_ACTION_1.getName()+","+COLLECT_ACTION_2.getName()+","+COLLECT_ACTION_3.getName(); |
| 839 |
// final String ACTIONS2 = COLLECT_ACTION_1.getName()+","+COLLECT_ACTION_3.getName(); |
| 840 |
// final String ACTIONS3 = COLLECT_ACTION_3.getName(); |
| 841 |
// |
| 842 |
// testCreateTracepoints(); |
| 843 |
// testActions(new String[] {ACTIONS1, ACTIONS2, ACTIONS3, ""}); |
| 844 |
// } |
| 845 |
// |
| 846 |
// /** |
1236 |
// /** |
| 847 |
// * This test sets the different types of tracepoints and then sets some eval actions |
1237 |
// * This test sets the different types of tracepoints and then sets some eval actions |
| 848 |
// */ |
1238 |
// */ |