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 198281 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 with launch preference and multi-thread JUnit tests 2
z1.patch (text/plain), 64.60 KB, created by
Marc Khouzam
on 2011-06-20 15:05:26 EDT
(
hide
)
Description:
Patch for fast tracepoints with launch preference and multi-thread JUnit tests 2
Filename:
MIME Type:
Creator:
Marc Khouzam
Created:
2011-06-20 15:05:26 EDT
Size:
64.60 KB
patch
obsolete
>diff --git src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java >index 9b256bd..e7d68ee 100644 >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/GdbDebuggerPage.java >@@ -30,9 +30,11 @@ > import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.FileDialog; > import org.eclipse.swt.widgets.Label; >@@ -53,6 +55,14 @@ > protected Button fReverseCheckBox; > protected Button fUpdateThreadlistOnSuspend; > protected Button fDebugOnFork; >+ >+ /** >+ * A combo box to let the user choose if fast tracepoints should be used or not. >+ */ >+ protected Combo fTracepointModeCombo; >+ protected static final String TP_FAST_ONLY = LaunchUIMessages.getString("GDBDebuggerPage.tracepoint_mode_fast"); //$NON-NLS-1$ >+ protected static final String TP_SLOW_ONLY = LaunchUIMessages.getString("GDBDebuggerPage.tracepoint_mode_slow"); //$NON-NLS-1$ >+ protected static final String TP_AUTOMATIC = LaunchUIMessages.getString("GDBDebuggerPage.tracepoint_mode_auto"); //$NON-NLS-1$ > > private IMILaunchConfigurationComponent fSolibBlock; > private boolean fIsInitializing = false; >@@ -82,6 +92,8 @@ > IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT); > configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK, > IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT); >+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, >+ IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT); > > if (fSolibBlock != null) > fSolibBlock.setDefaults(configuration); >@@ -142,9 +154,43 @@ > fUpdateThreadlistOnSuspend.setSelection(updateThreadsOnSuspend); > fDebugOnFork.setSelection(debugOnFork); > >+ updateTracepointModeFromConfig(configuration); >+ > setInitializing(false); > } >+ >+ protected void updateTracepointModeFromConfig(ILaunchConfiguration config) { >+ if (fTracepointModeCombo != null) { >+ String tracepointMode = getStringAttr(config, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, >+ IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT); > >+ if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_SLOW_ONLY)) { >+ fTracepointModeCombo.setText(TP_SLOW_ONLY); >+ } else if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY)) { >+ fTracepointModeCombo.setText(TP_FAST_ONLY); >+ } else if (tracepointMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_SLOW)) { >+ fTracepointModeCombo.setText(TP_AUTOMATIC); >+ } else { >+ assert false : "Unknown Tracepoint Mode: " + tracepointMode; //$NON-NLS-1$ >+ fTracepointModeCombo.setText(TP_SLOW_ONLY); >+ } >+ } >+ } >+ >+ protected String getSelectedTracepointMode() { >+ int selectedIndex = fTracepointModeCombo.getSelectionIndex(); >+ if (fTracepointModeCombo.getItem(selectedIndex).equals(TP_SLOW_ONLY)) { >+ return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_SLOW_ONLY; >+ } else if (fTracepointModeCombo.getItem(selectedIndex).equals(TP_FAST_ONLY)) { >+ return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY; >+ } else if (fTracepointModeCombo.getItem(selectedIndex).equals(TP_AUTOMATIC)) { >+ return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_SLOW; >+ } else { >+ assert false : "Unknown Tracepoint mode: " + fTracepointModeCombo.getItem(selectedIndex); //$NON-NLS-1$ >+ return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT; >+ } >+ } >+ > public void performApply(ILaunchConfigurationWorkingCopy configuration) { > configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, > fGDBCommandText.getText().trim()); >@@ -158,6 +204,9 @@ > fUpdateThreadlistOnSuspend.getSelection()); > configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK, > fDebugOnFork.getSelection()); >+ configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, >+ getSelectedTracepointMode()); >+ > if (fSolibBlock != null) > fSolibBlock.performApply(configuration); > } >@@ -307,6 +356,31 @@ > PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateThreadlistOnSuspend, GdbUIPlugin.PLUGIN_ID + ".update_threadlist_button_context"); //$NON-NLS-1$ > > fDebugOnFork = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.Automatically_debug_forked_processes")); //$NON-NLS-1$ >+ >+ createTracepointModeCombo(subComp); >+ } >+ >+ protected void createTracepointModeCombo(Composite parent) { >+ // Add a combo to choose the type of tracepoint mode to use >+ Label label = ControlFactory.createLabel(parent, LaunchUIMessages.getString("CMainTab.Post_mortem_file_type")); //$NON-NLS-1$ >+ label.setLayoutData(new GridData()); >+ >+ fTracepointModeCombo = new Combo(parent, SWT.READ_ONLY | SWT.DROP_DOWN); >+ fTracepointModeCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1)); >+ fTracepointModeCombo.add(TP_SLOW_ONLY); >+ fTracepointModeCombo.add(TP_FAST_ONLY); >+ fTracepointModeCombo.add(TP_AUTOMATIC); >+ >+ fTracepointModeCombo.addSelectionListener(new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ updateLaunchConfigurationDialog(); >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ } >+ }); >+ fTracepointModeCombo.select(0); >+ > } > > public void createSolibTab(TabFolder tabFolder) { >diff --git src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties >index 5262c15..a7f011a 100644 >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/launching/LaunchUIMessages.properties >@@ -25,6 +25,9 @@ > GDBDebuggerPage.reverse_Debugging=Enable Reverse Debugging at startup (Note: Requires Reverse GDB) > GDBDebuggerPage.update_thread_list_on_suspend=Force thread list update on suspend > GDBDebuggerPage.Automatically_debug_forked_processes=Automatically debug forked processes (Note: Requires Multi Process GDB) >+GDBDebuggerPage.tracepoint_mode_fast=Fast >+GDBDebuggerPage.tracepoint_mode_slow=Slow >+GDBDebuggerPage.tracepoint_mode_auto=Automatic > StandardGDBDebuggerPage.0=Debugger executable must be specified. > StandardGDBDebuggerPage.1=GDB Debugger Options > StandardGDBDebuggerPage.2=Main >diff --git src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java >index be64807..e4184e7 100644 >--- src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java >+++ src/org/eclipse/cdt/dsf/gdb/internal/ui/tracepointactions/TracepointActionsList.java >@@ -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); >diff --git src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java >index 54233ba..9bc2cd6 100644 >--- src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java >+++ src/org/eclipse/cdt/dsf/gdb/IGDBLaunchConfigurationConstants.java >@@ -105,6 +105,11 @@ > */ > public static final String ATTR_DEBUGGER_DEBUG_ON_FORK = GdbPlugin.PLUGIN_ID + ".DEBUG_ON_FORK"; //$NON-NLS-1$ > >+ /** >+ * Launch configuration attribute key. The value is a String specifying the type of Tracepoint mode >+ * that should be used for this launch. >+ */ >+ public static final String ATTR_DEBUGGER_TRACEPOINT_MODE = GdbPlugin.PLUGIN_ID + ".TRACEPOINT_MODE"; //$NON-NLS-1$ > > /** > * Launch configuration attribute value. The key is ATTR_DEBUG_NAME. >@@ -174,6 +179,29 @@ > * @since 4.0 > */ > public static final boolean DEBUGGER_DEBUG_ON_FORK_DEFAULT = false; >+ >+ /** >+ * Possible attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE. >+ * Indicates that only slow tracepoints should be used. >+ */ >+ public static final String DEBUGGER_TRACEPOINT_SLOW_ONLY = "TP_SLOW_ONLY"; //$NON-NLS-1$ >+ >+ /** >+ * Possible attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE. >+ * Indicates that only fast tracepoints should be used. >+ */ >+ public static final String DEBUGGER_TRACEPOINT_FAST_ONLY = "TP_FAST_ONLY"; //$NON-NLS-1$ >+ >+ /** >+ * Possible attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE. >+ * Indicates that slow tracepoints should be used whenever a fast tracepoint >+ * cannot be inserted. >+ */ >+ public static final String DEBUGGER_TRACEPOINT_FAST_THEN_SLOW = "TP_FAST_THEN_SLOW"; //$NON-NLS-1$ > >+ /** >+ * Default attribute value for the key is ATTR_DEBUGGER_TRACEPOINT_MODE. >+ */ >+ public static final String DEBUGGER_TRACEPOINT_MODE_DEFAULT = DEBUGGER_TRACEPOINT_SLOW_ONLY; > > } >diff --git src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java >index cb415e7..a96b74b 100644 >--- src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java >+++ src/org/eclipse/cdt/dsf/gdb/internal/tracepointactions/TracepointActionManager.java >@@ -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() { >diff --git src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java >index 0d23014..92d975b 100644 >--- src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java >@@ -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(); >diff --git src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java >new file mode 0 >index 0000000..9e0ebc7 0 >--- /dev/null >+++ src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java >@@ -0,0 +1,210 @@ >+/******************************************************************************* >+ * 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.IGDBLaunchConfigurationConstants; >+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.CoreException; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.core.ILaunch; >+ >+/** >+ * Breakpoint service for GDB 7.2. >+ * It support MI for tracepoints as well as fast vs slow tracepoints. >+ * >+ * @since 4.0 >+ */ >+public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0 >+{ >+ private IMICommandControl fConnection; >+ >+ private enum TracepointMode { FAST_THEN_SLOW, FAST_ONLY, SLOW_ONLY }; >+ >+ private TracepointMode fTracepointMode = TracepointMode.SLOW_ONLY; >+ >+ 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); >+ >+ setTracepointMode(); >+ >+ // 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); >+ } >+ >+ private void setTracepointMode() { >+ ILaunch launch = (ILaunch)getSession().getModelAdapter(ILaunch.class); >+ String tpMode = IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT; >+ try { >+ tpMode = launch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, >+ IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT); >+ } catch (CoreException e) { >+ } >+ >+ if (tpMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY)) { >+ fTracepointMode = TracepointMode.FAST_ONLY; >+ } else if (tpMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_SLOW_ONLY)) { >+ fTracepointMode = TracepointMode.SLOW_ONLY; >+ } else if (tpMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_SLOW)) { >+ fTracepointMode = TracepointMode.FAST_THEN_SLOW; >+ } else { >+ assert false : "Invalid tracepoint mode: " + tpMode; //$NON-NLS-1$ >+ fTracepointMode = TracepointMode.SLOW_ONLY; >+ } >+ } >+ >+ 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 = fTracepointMode != TracepointMode.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 (fTracepointMode == TracepointMode.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(); >+ } >+ } >+ }); >+ } >+} >diff --git src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java >index b013aae..dd55433 100644 >--- src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java >+++ src/org/eclipse/cdt/dsf/gdb/service/GdbDebugServicesFactory.java >@@ -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); > } >diff --git src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java >index ab7d87c..1063152 100644 >--- src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java >+++ src/org/eclipse/cdt/dsf/mi/service/command/output/MIBreakpoint.java >@@ -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()); > } > } >diff --git data/launch/src/TracepointTestApp.cc data/launch/src/TracepointTestApp.cc >index 1c6802d..026ab80 100644 >--- data/launch/src/TracepointTestApp.cc >+++ data/launch/src/TracepointTestApp.cc >@@ -1,4 +1,12 @@ >+#ifdef __MINGW32__ >+ #include <process.h> // MinGW has no POSIX support; use MSVC runtime >+#else >+ #include <pthread.h> >+#endif > #include <stdio.h> >+#include <stdlib.h> >+#include "Sleep.h" >+#define NUM_THREADS 5 > > int gIntVar = 543; > double gDoubleVar = 543.543; >@@ -52,8 +60,21 @@ > Z z; > }; > >-void testTracepoints() { >- printf("Running TracepointTest App\n"); >+#ifdef __MINGW32__ >+typedef unsigned int TID; >+#else >+typedef pthread_t TID; >+#endif >+ >+ >+#ifdef __MINGW32__ >+unsigned int __stdcall testTracepoints(void *threadid) >+#else >+void *testTracepoints(void *threadid) >+#endif >+{ >+ int tid = (int)threadid; >+ printf("Hello World! It's me, thread #%d!\n", tid); > > int lIntVar = 12345; > double lDoubleVar = 12345.12345; >@@ -81,16 +102,52 @@ > counter++; > } > >- counter = 185; >+ printf("counter is now #%d!\n", counter); > > // Large loop >- for (counter=0; counter<10000;) { >+ for (; counter<10000;) { > counter++; > } >+ >+ SLEEP(2); // keep this thread around for a bit; the tests will check for its existence while the main thread is stopped at a breakpoint >+ >+#ifdef __MINGW32__ >+ return 0; >+#else >+ pthread_exit(NULL); >+#endif > } > >-int main() { >- testTracepoints(); >+int main() >+{ >+ TID threads[NUM_THREADS]; >+ int t; >+ for(t=0; t < NUM_THREADS; t++) >+ { >+ printf("In main: creating thread %d\n", t); >+#ifdef __MINGW32__ >+ { >+ uintptr_t rc = _beginthreadex(NULL, 0, testTracepoints, (void*)t, 0, &threads[t]); >+ SLEEP(1); // debugger should for sure receive thread creation event after stepping over this sleep; not guaranteed to happen simply stepping over the thread creation call >+ if (rc == 0) >+ { >+ printf("ERROR; _beginthreadex() failed. errno = %d\n", errno); >+ exit(-1); >+ } >+ } >+#else >+ { >+ int rc = pthread_create(&threads[t], NULL, testTracepoints, (void *)t); >+ SLEEP(1); // debugger should for sure receive thread creation event after stepping over this sleep; not guaranteed to happen simply stepping over the thread creation call >+ if (rc) >+ { >+ printf("ERROR; return code from pthread_create() is %d\n", rc); >+ exit(-1); >+ } >+ } >+#endif >+ } >+ >+ SLEEP(2); // keep this thread around for a bit > return 0; > } >- >diff --git src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java >index 5370d37..705a367 100644 >--- src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java >+++ src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java >@@ -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; >@@ -58,6 +61,10 @@ > // GDB tracepoints are only supported on a remote target (e.g., using gdbserver) > setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, > IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); >+ >+ // To test both fast and slow tracepoint we just the FAST_THEN_SLOW setting >+ setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE, >+ IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_SLOW); > } > > private DsfSession fSession; >@@ -69,56 +76,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 = 97; >+ private static final int LINE_NUMBER_2 = 75; >+ private static final int LINE_NUMBER_3 = 76; >+ private static final int LINE_NUMBER_4 = 85; >+ private static final int LINE_LOOP_2 = 109; >+ private static final String NO_CONDITION = ""; >+ private static final String NO_COMMANDS = ""; >+// private static final int LAST_LINE_NUMBER = 94; >+// >+// private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000; >+ > private final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0}; >+ private final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"}; > >-// private static CollectAction COLLECT_ACTION_1; >-// private static CollectAction COLLECT_ACTION_2; >-// private static CollectAction COLLECT_ACTION_3; >-// private static EvalAction EVAL_ACTION_1; >-// private static EvalAction EVAL_ACTION_2; >-// private static EvalAction EVAL_ACTION_3; >-// private static WhileSteppingAction STEPPING_ACTION_1; >-// private static WhileSteppingAction STEPPING_ACTION_2; >-// private static WhileSteppingAction STEPPING_ACTION_3; >+ private static CollectAction[] COLLECT_ACTIONS = new CollectAction[10]; >+ private static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10]; >+// private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3]; > > >-// static { >-// 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 >-// >-// } >+ 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 +538,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 +579,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 +588,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 +631,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 +661,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; >@@ -648,7 +679,7 @@ > + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); > clearEventCounters(); > >- // Second tracepoint (will be a fast tracepoint) >+ // Second tracepoint (will be a slow tracepoint) > attributes = new HashMap<String, Object>(); > attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); > attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >@@ -662,11 +693,11 @@ > + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); > clearEventCounters(); > >- // Third tracepoint (will be a slow tracepoint) >+ // Third tracepoint (will be a fast tracepoint) > attributes = new HashMap<String, Object>(); > attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); > attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >- attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_1); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_4); > fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); > > waitForBreakpointEvent(); >@@ -705,11 +736,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, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >@@ -718,8 +749,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 +767,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 +779,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, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, false, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >@@ -761,8 +792,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 +804,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, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >@@ -786,8 +817,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 >@@ -795,54 +826,413 @@ > if (fTracepoints[i] == null) break; > if (PASS_COUNTS[i] == 0) continue; > delta.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]); >+ updateBreakpoint(fTracepoints[i], delta); >+ } >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, PASS_COUNTS[2], true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, NO_COMMANDS, false)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test sets 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, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, CONDITIONS[2], 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[3], 0, true, NO_COMMANDS, true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[4], 0, true, NO_COMMANDS, false)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ >+ } >+ >+ /** >+ * This test sets the different types of tracepoints and then sets some actions >+ */ >+ @Test >+ public void tracepointActions() throws Throwable { >+ createTracepoints(); >+ >+ Map<String, Object> delta = new HashMap<String, Object>(); >+ // Set conditions for all tracepoints >+ for (int i=0; i<fTracepoints.length; i++) { >+ if (fTracepoints[i] == null) break; >+ if (COLLECT_ACTIONS[i].equals(NO_COMMANDS)) continue; >+ delta.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName()); > updateBreakpoint(fTracepoints[i], delta); > } >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, COLLECT_ACTIONS[2].toString(), true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[3].toString(), true)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[4].toString(), false)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ >+ } >+ >+ /** >+ * This test creates a tracepoint that starts disabled >+ */ >+ @Test >+ public void createTracepointDisabled() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates a tracepoint that starts with a passcount >+ */ >+ @Test >+ public void createTracepointWithPasscount() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates a tracepoint that starts with a condition >+ */ >+ @Test >+ public void createTracepointWithCondition() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], 0, true, NO_COMMANDS, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], 0, true, NO_COMMANDS, true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates tracepoints that start a command >+ */ >+ @Test >+ public void createTracepointWithCommand() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ >+ /** >+ * This test creates tracepoints that start with more than one command >+ */ >+ @Test >+ public void createTracepointWithMultipleCommands() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); >+ String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].getName(); >+ String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].toString(); >+ attributes.put(MIBreakpoints.COMMANDS, commandsNames1); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].getName(); >+ String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + >+ COLLECT_ACTIONS[1].toString(); >+ attributes.put(MIBreakpoints.COMMANDS, commandsNames2); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); > > ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >- dataArray.add(new TracepointData(SOURCE_FILE, LINE_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_LOOP_2, NO_CONDITION, 0, true, commandsResult1, false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, commandsResult2, true)); > > checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } >+ >+ /** >+ * This test creates an enabled tracepoint that starts with commands, condition and passcount >+ */ >+ @Test >+ public void createTracepointEnabledWithCommandsConditionPasscount() throws Throwable { >+ Map<String, Object> attributes = null; >+ int index = 0; >+ >+ // First tracepoint will be a slow tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); >+ attributes.put(MIBreakpoints.IS_ENABLED, true); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); >+ attributes.put(MIBreakpoints.IS_ENABLED, true); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); > >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], true, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], true, COLLECT_ACTIONS[1].toString(), true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >+ } >+ > /** >- * This test 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_2); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ // Second tracepoint will be a fast tracepoint >+ attributes = new HashMap<String, Object>(); >+ attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); >+ attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); >+ attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); >+ attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); >+ attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); >+ attributes.put(MIBreakpoints.IS_ENABLED, false); >+ attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); >+ fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); >+ >+ waitForBreakpointEvent(); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " >+ + fBreakpointEventCount, fBreakpointEventCount == 1); >+ assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " >+ + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); >+ clearEventCounters(); >+ >+ ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], false, COLLECT_ACTIONS[0].toString(), false)); >+ dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], false, COLLECT_ACTIONS[1].toString(), true)); >+ >+ checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); > } > > >-// private void testActions(String[] actions) throws Throwable { >-// Map<String, Object> delta = new HashMap<String, Object>(); >-// ArrayList<TracepointData> dataArray = new ArrayList<TracepointData>(); >-// >-// for (int i=0; i<actions.length; i++) { >-// delta.put(MIBreakpoints.COMMANDS, actions[i]); >-// updateBreakpoint(fTracepoints[i], delta); >-// dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, actions[i], false)); >-// } >-// >-// checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); >-// } >-// >-// /** >-// * This test sets the different types of tracepoints and then sets some collect actions >-// */ >-// @Test >-// public void testCollectActions() throws Throwable { >-// final String ACTIONS1 = COLLECT_ACTION_1.getName()+","+COLLECT_ACTION_2.getName()+","+COLLECT_ACTION_3.getName(); >-// final String ACTIONS2 = COLLECT_ACTION_1.getName()+","+COLLECT_ACTION_3.getName(); >-// final String ACTIONS3 = COLLECT_ACTION_3.getName(); >-// >-// testCreateTracepoints(); >-// testActions(new String[] {ACTIONS1, ACTIONS2, ACTIONS3, ""}); >-// } >-// > // /** > // * This test sets the different types of tracepoints and then sets some eval actions > // */ >diff --git src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java >index 4149ed7..f65d390 100644 >--- src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java >+++ src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/GDBRemoteTracepointsTest_7_2.java >@@ -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