Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 197146 Details for
Bug 346320
[tracepoints] Add support for fast tracepoints
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for fast tracepoints and JUnit tests
z.fastTracepoint5.patch (text/plain), 51.21 KB, created by
Marc Khouzam
on 2011-06-01 14:56:51 EDT
(
hide
)
Description:
Patch for fast tracepoints and JUnit tests
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2011-06-01 14:56:51 EDT
Size:
51.21 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java,v >retrieving revision 1.1 >diff -u -r1.1 TracepointActionManager.java >--- src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java 11 Mar 2010 19:09:40 -0000 1.1 >+++ src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java 1 Jun 2011 18:50:14 -0000 >@@ -39,6 +39,10 @@ > private static final String TRACEPOINT_ACTION_DATA = "TracepointActionManager.actionData"; //$NON-NLS-1$ > private static final TracepointActionManager fTracepointActionManager = new TracepointActionManager(); > >+ // We need a delimiter that the user won't type directly. >+ // Bug 346215 >+ public static final String TRACEPOINT_ACTION_DELIMITER = "%_#"; //$NON-NLS-1$ >+ > private ArrayList<ITracepointAction> tracepointActions = null; > > private TracepointActionManager() { >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java,v >retrieving revision 1.10 >diff -u -r1.10 GDBBreakpoints_7_0.java >--- src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java 1 Apr 2011 18:17:41 -0000 1.10 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java 1 Jun 2011 18:50:14 -0000 >@@ -325,7 +325,7 @@ > } > > private ITracepointAction[] generateGdbCommands(String actionStr) { >- String[] actionNames = actionStr.split(","); //$NON-NLS-1$ >+ String[] actionNames = actionStr.split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER); > ITracepointAction[] actions = new ITracepointAction[actionNames.length]; > > TracepointActionManager actionManager = TracepointActionManager.getInstance(); >Index: src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java >diff -N src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,184 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Ericsson and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Ericsson - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.dsf.gdb.service; >+ >+import java.util.HashMap; >+import java.util.Hashtable; >+import java.util.Map; >+ >+import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; >+import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor; >+import org.eclipse.cdt.dsf.concurrent.RequestMonitor; >+import org.eclipse.cdt.dsf.datamodel.IDMContext; >+import org.eclipse.cdt.dsf.debug.service.IBreakpoints; >+import org.eclipse.cdt.dsf.debug.service.IBreakpointsExtension; >+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; >+import org.eclipse.cdt.dsf.mi.service.IMICommandControl; >+import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; >+import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; >+import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; >+import org.eclipse.cdt.dsf.service.DsfSession; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+ >+/** >+ * Breakpoint service for GDB 7.2. >+ * It support MI for tracepoints. >+ * >+ * @since 4.0 >+ */ >+public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 >+{ >+ private IMICommandControl fConnection; >+ >+ private enum TracePointSettingPreference { FAST_THEN_SLOW, FAST_ONLY, SLOW_ONLY }; >+ >+ private TracePointSettingPreference fTracePointSettingPreference = TracePointSettingPreference.FAST_THEN_SLOW; >+ >+ public GDBBreakpoints_7_2(DsfSession session) { >+ super(session); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.dsf.service.AbstractDsfService#initialize(org.eclipse.cdt.dsf.concurrent.RequestMonitor) >+ */ >+ @Override >+ public void initialize(final RequestMonitor rm) { >+ super.initialize(new RequestMonitor(ImmediateExecutor.getInstance(), rm) { >+ @Override >+ protected void handleSuccess() { >+ doInitialize(rm); >+ } >+ }); >+ } >+ >+ private void doInitialize(final RequestMonitor rm) { >+ // Get the services references >+ fConnection = getServicesTracker().getService(IMICommandControl.class); >+ >+ // Register this service >+ register(new String[] { IBreakpoints.class.getName(), >+ IBreakpointsExtension.class.getName(), >+ MIBreakpoints.class.getName(), >+ GDBBreakpoints_7_0.class.getName(), >+ GDBBreakpoints_7_2.class.getName() }, >+ new Hashtable<String, String>()); >+ >+ rm.done(); >+ } >+ >+ @Override >+ public void shutdown(RequestMonitor requestMonitor) { >+ unregister(); >+ super.shutdown(requestMonitor); >+ } >+ >+ protected void sendTracepointCommand(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, boolean isFastTracepoint, final DataRequestMonitor<IBreakpointDMContext> drm) { >+ // Select the context breakpoints map >+ final Map<Integer, MIBreakpointDMData> contextBreakpoints = getBreakpointMap(context); >+ if (contextBreakpoints == null) { >+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); >+ drm.done(); >+ return; >+ } >+ >+ // Extract the relevant parameters (providing default values to avoid potential NPEs) >+ final String location = formatLocation(attributes); >+ if (location.equals(NULL_STRING)) { >+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, UNKNOWN_BREAKPOINT_CONTEXT, null)); >+ drm.done(); >+ return; >+ } >+ >+ final Boolean enabled = (Boolean) getProperty(attributes, MIBreakpoints.IS_ENABLED, true); >+ final String condition = (String) getProperty(attributes, MIBreakpoints.CONDITION, NULL_STRING); >+ >+ fConnection.queueCommand( >+ fConnection.getCommandFactory().createMIBreakInsert(context, false, isFastTracepoint, condition, 0, location, 0, !enabled, true), >+ new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), drm) { >+ @Override >+ protected void handleSuccess() { >+ // With MI, an invalid location won't generate an error >+ if (getData().getMIBreakpoints().length == 0) { >+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); >+ drm.done(); >+ return; >+ } >+ >+ // Create a breakpoint object and store it in the map >+ final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]); >+ int reference = newBreakpoint.getNumber(); >+ if (reference == -1) { >+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); >+ drm.done(); >+ return; >+ } >+ contextBreakpoints.put(reference, newBreakpoint); >+ >+ // Format the return value >+ MIBreakpointDMContext dmc = new MIBreakpointDMContext(GDBBreakpoints_7_2.this, new IDMContext[] { context }, reference); >+ drm.setData(dmc); >+ >+ // Flag the event >+ getSession().dispatchEvent(new BreakpointAddedEvent(dmc), getProperties()); >+ >+ // Tracepoints are created with no passcount (passcount are not >+ // the same thing as ignore-count, which is not supported by >+ // tracepoints). We have to set the passcount manually now. >+ // Same for commands. >+ Map<String,Object> delta = new HashMap<String,Object>(); >+ delta.put(MIBreakpoints.PASS_COUNT, getProperty(attributes, MIBreakpoints.PASS_COUNT, 0)); >+ delta.put(MIBreakpoints.COMMANDS, getProperty(attributes, MIBreakpoints.COMMANDS, "")); //$NON-NLS-1$ >+ modifyBreakpoint(dmc, delta, drm, false); >+ } >+ >+ @Override >+ protected void handleError() { >+ drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); >+ drm.done(); >+ } >+ }); >+ } >+ >+ /** >+ * Add a tracepoint using MI. We have three settings: >+ * 1- set only a fast tracepoint but if it fails, set a slow tracepoint >+ * 2- only set a fast tracepoint even if it fails >+ * 3- only set a slow tracepoint even if a fast tracepoint could have been used >+ */ >+ @Override >+ protected void addTracepoint(final IBreakpointsTargetDMContext context, final Map<String, Object> attributes, final DataRequestMonitor<IBreakpointDMContext> drm) { >+ // Unless we should only set slow tracepoints, we try to set a fast tracepoint. >+ boolean isFastTracepoint = fTracePointSettingPreference != TracePointSettingPreference.SLOW_ONLY; >+ >+ sendTracepointCommand(context, attributes, isFastTracepoint, new DataRequestMonitor<IBreakpointDMContext>(ImmediateExecutor.getInstance(), drm) { >+ @Override >+ protected void handleSuccess() { >+ // Tracepoint was set successfully. >+ drm.setData(getData()); >+ drm.done(); >+ } >+ @Override >+ protected void handleError() { >+ // Tracepoint failed to be set. >+ if (fTracePointSettingPreference == TracePointSettingPreference.FAST_THEN_SLOW) { >+ // In this case, we failed to set a fast tracepoint, but we should try to set a slow one. >+ sendTracepointCommand(context, attributes, false, drm); >+ } else { >+ // We either failed to set a fast tracepoint and we should not try to set a slow one, >+ // or we failed to set a slow one. Either way, we are done. >+ drm.setStatus(getStatus()); >+ drm.done(); >+ } >+ } >+ }); >+ } >+} >Index: src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java,v >retrieving revision 1.16 >diff -u -r1.16 GdbDebugServicesFactory.java >--- src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java 7 Mar 2011 18:05:03 -0000 1.16 >+++ src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java 1 Jun 2011 18:50:15 -0000 >@@ -98,6 +98,11 @@ > > @Override > protected IBreakpoints createBreakpointService(DsfSession session) { >+ // This service is available for GDB 7.2 but there is a pre-release of GDB that >+ // supports the same features and has version of 6.8.50.20090414 >+ if (GDB_7_2_VERSION.compareTo(fVersion) <= 0 || "6.8.50.20090414".equals(fVersion)) { //$NON-NLS-1$ >+ return new GDBBreakpoints_7_2(session); >+ } > if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) { > return new GDBBreakpoints_7_0(session); > } >@@ -184,8 +189,8 @@ > > /** @since 3.0 */ > protected IGDBTraceControl createTraceControlService(DsfSession session, ILaunchConfiguration config) { >- // This service is available for GDB 7.2. But until that GDB is itself available >- // there is a pre-release that has a version of 6.8.50.20090414 >+ // This service is available for GDB 7.2 but there is a pre-release of GDB that >+ // supports the same features and has version of 6.8.50.20090414 > if (GDB_7_2_VERSION.compareTo(fVersion) <= 0 || "6.8.50.20090414".equals(fVersion)) { //$NON-NLS-1$ > return new GDBTraceControl_7_2(session, config); > } >Index: src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java,v >retrieving revision 1.8 >diff -u -r1.8 MIBreakpoint.java >--- src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java 15 Feb 2011 14:34:30 -0000 1.8 >+++ src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java 1 Jun 2011 18:50:15 -0000 >@@ -17,6 +17,8 @@ > > import java.util.StringTokenizer; > >+import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager; >+ > /** > * Contain info about the GDB/MI breakpoint. > * >@@ -498,7 +500,27 @@ > } else if (var.equals("pending")) { //$NON-NLS-1$ > // Only supported starting with GDB 6.8 > pending = true; >+ } else if (var.equals("script")) { //$NON-NLS-1$ >+ if (value instanceof MITuple) { >+ parseCommands((MITuple)value); >+ } >+ } >+ } >+ } >+ >+ void parseCommands(MITuple tuple) { >+ MIValue[] values = tuple.getMIValues(); >+ StringBuffer cmds = new StringBuffer(); >+ for (int i = 0; i < values.length; i++) { >+ MIValue value = values[i]; >+ if (value != null && value instanceof MIConst) { >+ if (i > 0) { >+ // Insert a delimiter >+ cmds.append(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER); >+ } >+ cmds.append(((MIConst)value).getCString()); > } > } >+ setCommands(cmds.toString()); > } > } >#P org.eclipse.cdt.dsf.gdb.ui >Index: src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java,v >retrieving revision 1.1 >diff -u -r1.1 TracepointActionsList.java >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java 11 Mar 2010 19:09:35 -0000 1.1 >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java 1 Jun 2011 18:50:15 -0000 >@@ -132,7 +132,9 @@ > TableItem[] currentItems = table.getItems(); > for (int i = 0; i < currentItems.length; i++) { > if (i > 0) { >- result.append(','); >+ // Keep a delimiter between the different action strings >+ // so we can separate them again. >+ result.append(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER); > } > result.append(((ITracepointAction) currentItems[i].getData()).getName()); > } >@@ -179,7 +181,7 @@ > public void setNames(String actionNames) { > > table.removeAll(); >- String[] names = actionNames.split(","); //$NON-NLS-1$ >+ String[] names = actionNames.split(TracepointActionManager.TRACEPOINT_ACTION_DELIMITER); > > for (String actionName : names) { > ITracepointAction action = TracepointActionManager.getInstance().findAction(actionName); >#P org.eclipse.cdt.tests.dsf.gdb >Index: src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java,v >retrieving revision 1.6 >diff -u -r1.6 GDBRemoteTracepointsTest_7_0.java >--- src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java 5 Feb 2011 04:23:59 -0000 1.6 >+++ src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java 1 Jun 2011 18:50:15 -0000 >@@ -30,6 +30,9 @@ > import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsUpdatedEvent; > import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext; > import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; >+import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.CollectAction; >+import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.EvaluateAction; >+import org.eclipse.cdt.dsf.gdb.internal.tracepointactions.TracepointActionManager; > import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; > import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; > import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; >@@ -69,56 +72,91 @@ > > // private int fTotalTracingBufferSize = 0; > >+ >+ private static final String SOURCE_FILE = "TracepointTestApp.cc"; >+ private static final String METHOD_NAME = "testTracepoints"; >+ private static final int LINE_NUMBER_1 = 84; >+ private static final int LINE_NUMBER_2 = 55; >+ private static final int LINE_NUMBER_3 = 56; >+ private static final int LINE_LOOP_1 = 81; >+ private static final int LINE_LOOP_2 = 88; >+ private static final String NO_CONDITION = ""; >+ private static final String NO_COMMANDS = ""; >+// private static final int LAST_LINE_NUMBER = 94; >+// >+// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000; >+ > private final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0}; >+ private final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"}; > >-// private static CollectAction COLLECT_ACTION_1; >-// private static CollectAction COLLECT_ACTION_2; >-// private static CollectAction COLLECT_ACTION_3; >-// private static EvalAction EVAL_ACTION_1; >-// private static EvalAction EVAL_ACTION_2; >-// private static EvalAction EVAL_ACTION_3; >-// private static WhileSteppingAction STEPPING_ACTION_1; >-// private static WhileSteppingAction STEPPING_ACTION_2; >-// private static WhileSteppingAction STEPPING_ACTION_3; >- >- >-// static { >-// BreakpointActionManager breakpointActionMgr = CDebugCorePlugin.getDefault().getBreakpointActionManager(); >-// >-// COLLECT_ACTION_1 = new CollectAction(); >-// COLLECT_ACTION_1.setCollectString("$locals, counter"); >-// COLLECT_ACTION_1.setName("CollectAction1"); >-// breakpointActionMgr.addAction(COLLECT_ACTION_1); >-// >-// COLLECT_ACTION_2 = new CollectAction(); >-// COLLECT_ACTION_2.setCollectString("$reg"); >-// COLLECT_ACTION_2.setName("CollectAction2"); >-// breakpointActionMgr.addAction(COLLECT_ACTION_2); >-// >-// COLLECT_ACTION_3 = new CollectAction(); >-// COLLECT_ACTION_3.setCollectString("$myTraceVariable"); >-// COLLECT_ACTION_3.setName("CollectAction3"); >-// breakpointActionMgr.addAction(COLLECT_ACTION_3); >-// >-// >-// EVAL_ACTION_1 = new EvalAction(); >-// EVAL_ACTION_1.setEvalString("$count=$count+1"); >-// EVAL_ACTION_1.setName("EvalAction1"); >-// breakpointActionMgr.addAction(EVAL_ACTION_1); >-// >-// EVAL_ACTION_2 = new EvalAction(); >-// EVAL_ACTION_2.setEvalString("$count2=$count2+2"); >-// EVAL_ACTION_2.setName("EvalAction2"); >-// breakpointActionMgr.addAction(EVAL_ACTION_2); >-// >-// EVAL_ACTION_3 = new EvalAction(); >-// EVAL_ACTION_3.setEvalString("$count3=$count3+3"); >-// EVAL_ACTION_3.setName("EvalAction3"); >-// breakpointActionMgr.addAction(EVAL_ACTION_3); >-// >-// //TODO do while stepping actions >-// >-// } >+ private static CollectAction[] COLLECT_ACTIONS = new CollectAction[10]; >+ private static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10]; >+// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3]; >+ >+ >+ static { >+ TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance(); >+ >+ int index = 0; >+ COLLECT_ACTIONS[index] = new CollectAction(); >+ COLLECT_ACTIONS[index].setCollectString("$locals"); >+ COLLECT_ACTIONS[index].setName("Collect locals"); >+ tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); >+ index++; >+ >+ COLLECT_ACTIONS[index] = new CollectAction(); >+ COLLECT_ACTIONS[index].setCollectString("gIntVar"); >+ COLLECT_ACTIONS[index].setName("Collect gIntVar"); >+ tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); >+ index++; >+ >+ COLLECT_ACTIONS[index] = new CollectAction(); >+ COLLECT_ACTIONS[index].setCollectString("$locals, counter, $reg"); >+ COLLECT_ACTIONS[index].setName("Collect locals, counter and reg"); >+ tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); >+ index++; >+ >+ COLLECT_ACTIONS[index] = new CollectAction(); >+ COLLECT_ACTIONS[index].setCollectString("$reg"); >+ COLLECT_ACTIONS[index].setName("Collect reg"); >+ tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); >+ index++; >+ >+ COLLECT_ACTIONS[index] = new CollectAction(); >+ COLLECT_ACTIONS[index].setCollectString("counter, $locals"); >+ COLLECT_ACTIONS[index].setName("Collect counter, locals"); >+ tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); >+ index++; >+ >+ COLLECT_ACTIONS[index] = new CollectAction(); >+ COLLECT_ACTIONS[index].setCollectString("$myTraceVariable"); >+ COLLECT_ACTIONS[index].setName("Collect myTraceVariable"); >+ tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); >+ index++; >+ >+ index=0; >+ EVAL_ACTIONS[index] = new EvaluateAction(); >+ EVAL_ACTIONS[index].setEvalString("$count=$count+1"); >+ EVAL_ACTIONS[index].setName("Eval increment count"); >+ tracepointActionMgr.addAction(EVAL_ACTIONS[index]); >+ index++; >+ >+ EVAL_ACTIONS[index] = new EvaluateAction(); >+ EVAL_ACTIONS[index].setEvalString("$count2=$count2+2"); >+ EVAL_ACTIONS[index].setName("Eval increment count2 by 2"); >+ tracepointActionMgr.addAction(EVAL_ACTIONS[index]); >+ index++; >+ >+ EVAL_ACTIONS[index] = new EvaluateAction(); >+ EVAL_ACTIONS[index].setEvalString("$count3=$count3+3"); >+ EVAL_ACTIONS[index].setName("Eval increment count3 by 3"); >+ tracepointActionMgr.addAction(EVAL_ACTIONS[index]); >+ index++; >+ >+ //TODO do while stepping actions >+ index=0; >+ >+ } > > @Before > public void initialTest() throws Exception { >@@ -496,17 +534,6 @@ > // Below are the tests for the control of tracepoints. > // ********************************************************************* > >- private static final String SOURCE_FILE = "TracepointTestApp.cc"; >- private static final String METHOD_NAME = "testTracepoints"; >- private static final int LINE_NUMBER_1 = 84; >- private static final int LINE_NUMBER_2 = 55; >- private static final int LINE_NUMBER_3 = 56; >- private static final int LINE_LOOP_1 = 81; >- private static final int LINE_LOOP_2 = 88; >- private static final String NO_CONDITION = ""; >-// private static final int LAST_LINE_NUMBER = 94; >-// >-// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000; > > > private IBreakpointDMContext[] fTracepoints = null; >@@ -548,7 +575,7 @@ > // checkTraceStatus(supported, active, frames, null, null); > // } > >- // GDB 7.0 does not support fast tracepoints, but GDB 7.1 will >+ // GDB 7.0 does not support fast tracepoints, but GDB 7.2 will > protected boolean fastTracepointsSupported() { return false; } > > private class TracepointData { >@@ -557,16 +584,16 @@ > String condition; > int passcount; > boolean enabled; >- String actions; >+ String commands; > boolean isFastTp; > >- public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String acts, boolean fast) { >+ public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String cmds, boolean fast) { > sourceFile = file; > lineNumber = line; > condition = cond; > passcount = pass; > enabled = isEnabled; >- actions = acts; >+ commands = cmds; > if (fastTracepointsSupported()) { > isFastTp = fast; > } else { >@@ -600,10 +627,10 @@ > tp.getCondition().equals(data.condition)); > assertTrue("tracepoint "+i+" mismatch (wrong pass count) got " + tp.getPassCount(), > tp.getPassCount() == data.passcount); >- assertTrue("tracepoint "+i+" mismatch (wrong state) got " + tp.isEnabled(), >+ assertTrue("tracepoint "+i+" mismatch (wrong enablement) got " + tp.isEnabled(), > tp.isEnabled() == data.enabled); >- assertTrue("tracepoint mismatch (wrong actions) got " + tp.getCommands(), >- tp.getCommands().equals(data.actions)); >+ assertTrue("tracepoint "+i+" mismatch (wrong actions) got " + tp.getCommands(), >+ tp.getCommands().equals(data.commands)); > > assertTrue("tracepoint "+i+" mismatch", > tp.equals((MIBreakpointDMData)getBreakpoint(tracepoints[i]))); >@@ -630,7 +657,7 @@ > * It also set a fast tracepoint by > */ > @Test >- public void testCreateTracepoints() throws Throwable { >+ public void createTracepoints() throws Throwable { > > Map<String, Object> attributes = null; > int index = 0; >@@ -705,11 +732,11 @@ > clearEventCounters(); > > ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, "", false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >@@ -718,8 +745,8 @@ > * This test sets the different types of tracepoints and then deletes them > */ > @Test >- public void testDeleteTracepoints() throws Throwable { >- testCreateTracepoints(); >+ public void deleteTracepoints() throws Throwable { >+ createTracepoints(); > // Delete all tracepoints > for (IBreakpointDMContext tp : fTracepoints) { > if (tp == null) break; >@@ -736,8 +763,8 @@ > * This test sets the different types of tracepoints and then disables them > */ > @Test >- public void testDisableTracepoints() throws Throwable { >- testCreateTracepoints(); >+ public void disableTracepoints() throws Throwable { >+ createTracepoints(); > > Map<String, Object> delta = new HashMap<String, Object>(); > delta.put(MIBreakpoints.IS_ENABLED, false); >@@ -748,11 +775,11 @@ > } > > ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, false, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, "", false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, false, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >@@ -761,8 +788,8 @@ > * This test sets, disables the different types of tracepoints and then enables them > */ > @Test >- public void testEnableTracepoints() throws Throwable { >- testDisableTracepoints(); >+ public void enableTracepoints() throws Throwable { >+ disableTracepoints(); > > Map<String, Object> delta = new HashMap<String, Object>(); > delta.put(MIBreakpoints.IS_ENABLED, true); >@@ -773,11 +800,11 @@ > } > > ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, "", false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >@@ -786,8 +813,8 @@ > * This test sets the different types of tracepoints and then sets their passcount > */ > @Test >- public void testTracepointPasscount() throws Throwable { >- testCreateTracepoints(); >+ public void tracepointPasscount() throws Throwable { >+ createTracepoints(); > > Map<String, Object> delta = new HashMap<String, Object>(); > // Set passcount for all tracepoints >@@ -799,21 +826,406 @@ > } > > ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, PASS_COUNTS[2], true, "", false)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, "", true)); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, "", false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, PASS_COUNTS[2], true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, NO_COMMANDS, false)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test sets the different types of tracepoints and then sets some conditions >+ */ >+ @Test >+ public void tracepointCondition() throws Throwable { >+ createTracepoints(); >+ >+ Map<String, Object> delta = new HashMap<String, Object>(); >+ // Set conditions for all tracepoints >+ for (int i=0; i<fTracepoints.length; i++) { >+ if (fTracepoints[i] == null) break; >+ if (CONDITIONS[i].equals(NO_CONDITION)) continue; >+ delta.put(MIBreakpoints.CONDITION, CONDITIONS[i]); >+ updateBreakpoint(fTracepoints[i], delta); >+ } >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, CONDITIONS[0], 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[1], 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, CONDITIONS[2], 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[3], 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[4], 0, true, NO_COMMANDS, false)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ >+ } >+ >+ /** >+ * This test sets the different types of tracepoints and then sets some actions >+ */ >+ @Test >+ public void tracepointActions() throws Throwable { >+ createTracepoints(); >+ >+ Map<String, Object> delta = new HashMap<String, Object>(); >+ // Set conditions for all tracepoints >+ for (int i=0; i<fTracepoints.length; i++) { >+ if (fTracepoints[i] == null) break; >+ if (COLLECT_ACTIONS[i].equals(NO_COMMANDS)) continue; >+ delta.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName()); >+ updateBreakpoint(fTracepoints[i], delta); >+ } >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[2].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[3].toString(), true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[4].toString(), false)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ >+ } >+ >+ /** >+ * This test creates a tracepoint that starts disabled >+ */ >+ @Test >+ public void createTracepointDisabled() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, false, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates a tracepoint that starts with a passcount >+ */ >+ @Test >+ public void createTracepointWithPasscount() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates a tracepoint that starts with a condition >+ */ >+ @Test >+ public void createTracepointWithCondition() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, CONDITIONS[0], 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], 0, true, NO_COMMANDS, true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates tracepoints that start a command >+ */ >+ @Test >+ public void createTracepointWithCommand() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates tracepoints that start with more than one command >+ */ >+ @Test >+ public void createTracepointWithMultipleCommands() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].getName(); >+ String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].toString(); >+ attributes.put(MIBreakpoints.COMMANDS, commandsNames1); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].getName(); >+ String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].toString(); >+ attributes.put(MIBreakpoints.COMMANDS, commandsNames2); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, NO_CONDITION, 0, true, commandsResult1, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, commandsResult2, true)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >+ >+ /** >+ * This test creates an enabled tracepoint that starts with commands, condition and passcount >+ */ >+ @Test >+ public void createTracepointEnabledWithCommandsConditionPasscount() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); >+ attributes.put(MIBreakpoints.IS_ENABLED, true); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); > >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); >+ attributes.put(MIBreakpoints.IS_ENABLED, true); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, CONDITIONS[0], PASS_COUNTS[0], true, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], true, COLLECT_ACTIONS[1].toString(), true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ > /** >- * This test sets a tracepoint and then gives it a condition >+ * This test creates a disabled tracepoint that starts with commands, condition and passcount > */ >- //@Test >- public void testTracepointCondition() throws Throwable { >- // Use trace state variables and stuff >+ @Test >+ public void createTracepointDisabledWithCommandsConditionPasscount() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_1, CONDITIONS[0], PASS_COUNTS[0], false, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], false, COLLECT_ACTIONS[1].toString(), true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } > > >Index: src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java,v >retrieving revision 1.1 >diff -u -r1.1 GDBRemoteTracepointsTest_7_2.java >--- src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java 4 Jun 2010 15:46:36 -0000 1.1 >+++ src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java 1 Jun 2011 18:50:15 -0000 >@@ -23,4 +23,8 @@ > public static void beforeClassMethod_7_2() { > setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2); > } >+ >+ @Override >+ protected boolean fastTracepointsSupported() { return true; } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
marc.khouzam
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 346320
:
197146
|
197147
|
197301
|
198277
|
198281
|
200000