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