Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-03-11 19:25:30 +0000
committereutarass2011-03-11 19:25:30 +0000
commitbb922e5aaf1e188d081387840f606e3e3e4336c1 (patch)
treeb2bb433dce3f0b67562ef920c25f67a5219b0094 /plugins
parentd0f40750a0eebc1c492b0d1e77e579affe0b9a86 (diff)
downloadorg.eclipse.tcf-bb922e5aaf1e188d081387840f606e3e3e4336c1.tar.gz
org.eclipse.tcf-bb922e5aaf1e188d081387840f606e3e3e4336c1.tar.xz
org.eclipse.tcf-bb922e5aaf1e188d081387840f606e3e3e4336c1.zip
Bug 339674: [cdt] Add support for CDT function breakpoints
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml24
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java73
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java6
3 files changed, 103 insertions, 0 deletions
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml
index da24f11fe..837e2d741 100644
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml
+++ b/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml
@@ -262,5 +262,29 @@
plugin="org.eclipse.tm.tcf.cdt.core">
</statusHandler>
</extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.debug.ui.category.run"
+ defaultHandler="org.eclipse.tm.internal.tcf.cdt.ui.commands.AddFunctionBreakointHandler"
+ description="Allows to add a new function breakpoint on an arbitrary symbol"
+ id="org.eclipse.tm.tcf.cdt.ui.add_function_breakpoint"
+ name="Add Function Breakpoint">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.debug.ui.BreakpointView?after=additions">
+ <command
+ commandId="org.eclipse.tm.tcf.cdt.ui.add_function_breakpoint"
+ icon="icons/obj16/funbrkp_obj.gif"
+ id="org.eclipse.tm.tcf.cdt.ui.add_function_breakpoint"
+ label="Add Function Breakpoint (C/C++)..."
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java
new file mode 100644
index 000000000..b07ee6661
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf.cdt.ui.commands;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpointType;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Command handler to add a CDT function breakpoint on an arbitrary symbol.
+ */
+public class AddFunctionBreakointHandler extends AbstractHandler {
+
+ private static class AddFunctionBreakpointDialog extends InputDialog {
+ public AddFunctionBreakpointDialog(Shell parentShell, String initialValue) {
+ super(parentShell, "Add Function Breakpoint", "Enter symbol:", initialValue, null);
+ }
+ }
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell shell = HandlerUtil.getActiveShell(event);
+ AddFunctionBreakpointDialog dialog = new AddFunctionBreakpointDialog(shell, "");
+ if (dialog.open() == Window.OK) {
+ final String symbol = dialog.getValue();
+ Job job = new WorkspaceJob("Create Function Breakpoint") {
+ @Override
+ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot();
+ CDIDebugModel.createFunctionBreakpoint(
+ null,
+ resource,
+ ICBreakpointType.REGULAR,
+ symbol,
+ -1,
+ -1,
+ -1,
+ true,
+ -1,
+ null,
+ true);
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java
index 8acbc4f73..5a4ce1d7a 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java
@@ -431,6 +431,12 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana
m.put(IBreakpoints.PROP_LOCATION, "&(" + expr + ')');
}
}
+ else if ("org.eclipse.cdt.debug.core.cFunctionBreakpointMarker".equals(type)) {
+ String expr = (String)p.get("org.eclipse.cdt.debug.core.function");
+ if (expr != null && expr.length() != 0) {
+ m.put(IBreakpoints.PROP_LOCATION, expr);
+ }
+ }
else if (file == null) {
String address = (String)p.get("org.eclipse.cdt.debug.core.address");
if (address != null && address.length() > 0) m.put(IBreakpoints.PROP_LOCATION, address);

Back to the top