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 159245 Details for
Bug 248606
[menu][breakpoints][cdi] Add support for toggling watchpoints in the variables and expressions views.
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]
Solution
patch_248606 (text/plain), 16.19 KB, created by
John Cortell
on 2010-02-16 16:14:47 EST
(
hide
)
Description:
Solution
Filename:
MIME Type:
Creator:
John Cortell
Created:
2010-02-16 16:14:47 EST
Size:
16.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.core >Index: src/org/eclipse/cdt/debug/internal/core/CRequest.java >=================================================================== >RCS file: src/org/eclipse/cdt/debug/internal/core/CRequest.java >diff -N src/org/eclipse/cdt/debug/internal/core/CRequest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/debug/internal/core/CRequest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+package org.eclipse.cdt.debug.internal.core; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.debug.core.IRequest; >+ >+/** >+ * Base class for request objects used in asynchronous calls in base CDT >+ * (non-DSF). This is used in base features that delegate a task to a backend >+ * that is either DSF or CDI. Since DSF is highly asynchronous, the base logic >+ * has to use asynchronous APIs. >+ */ >+public class CRequest implements IRequest { >+ private IStatus fStatus; >+ private boolean fCanceled; >+ /* >+ * @see org.eclipse.debug.core.IRequest#cancel() >+ */ >+ public void cancel() { >+ fCanceled= true; >+ } >+ >+ /* >+ * @see org.eclipse.debug.core.IRequest#done() >+ */ >+ public void done() { >+ } >+ >+ /* >+ * @see org.eclipse.debug.core.IRequest#getStatus() >+ */ >+ public IStatus getStatus() { >+ return fStatus; >+ } >+ >+ /* >+ * @see org.eclipse.debug.core.IRequest#isCanceled() >+ */ >+ public boolean isCanceled() { >+ return fCanceled; >+ } >+ >+ /* >+ * @see org.eclipse.debug.core.IRequest#setStatus(org.eclipse.core.runtime.IStatus) >+ */ >+ public void setStatus(IStatus status) { >+ fStatus= status; >+ } >+} >Index: src/org/eclipse/cdt/debug/internal/core/IWatchpointTarget.java >=================================================================== >RCS file: src/org/eclipse/cdt/debug/internal/core/IWatchpointTarget.java >diff -N src/org/eclipse/cdt/debug/internal/core/IWatchpointTarget.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/debug/internal/core/IWatchpointTarget.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Freescale Semiconductor 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: >+ * Freescale Semiconductor - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.debug.internal.core; >+ >+/** >+ * View model types for which the "Add Watchpoint (C/C++)" action is applicable >+ * should implement this interface. The action is a popupMenu/objectContribution >+ * that targets this type. >+ */ >+public interface IWatchpointTarget { >+ >+ /** IRequest object used in the asynchronous method {@link IWatchpointTarget#getSize()} */ >+ static class GetSizeRequest extends CRequest { >+ int fSize; >+ >+ public int getSize() { >+ return fSize; >+ } >+ >+ public void setSize(int size) { >+ fSize = size; >+ } >+ }; >+ >+ /** >+ * Get the expression or the name of the variable >+ */ >+ String getExpression(); >+ >+ /** >+ * Asynchronous method to retrieve the size of the variable/expression, in >+ * bytes. >+ * >+ * @param request >+ * the async request object >+ */ >+ void getSize(GetSizeRequest request); >+} >Index: src/org/eclipse/cdt/debug/internal/core/model/CVariable.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java,v >retrieving revision 1.103 >diff -u -r1.103 CVariable.java >--- src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 24 Nov 2009 12:46:35 -0000 1.103 >+++ src/org/eclipse/cdt/debug/internal/core/model/CVariable.java 16 Feb 2010 21:14:02 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.cdt.debug.core.model.ICType; > import org.eclipse.cdt.debug.core.model.ICValue; > import org.eclipse.cdt.debug.internal.core.CSettingsManager; >+import org.eclipse.cdt.debug.internal.core.IWatchpointTarget; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.DebugEvent; > import org.eclipse.debug.core.DebugException; >@@ -72,7 +73,7 @@ > /** > * Represents a variable in the CDI model. > */ >-public abstract class CVariable extends AbstractCVariable implements ICDIEventListener { >+public abstract class CVariable extends AbstractCVariable implements ICDIEventListener, IWatchpointTarget { > > interface IInternalVariable { > IInternalVariable createShadow( int start, int length ) throws DebugException; >@@ -878,4 +879,24 @@ > // even if the initial setup fails, we still want the complete creation to be successful > } > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getExpression() >+ */ >+ public String getExpression() { >+ try { >+ return getExpressionString(); >+ } catch (DebugException e) { >+ return ""; //$NON-NLS-1$ >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getSize() >+ */ >+ public void getSize(IWatchpointTarget.GetSizeRequest request) { >+ // CDI has synchronous APIs, so this is easy... >+ request.setSize(sizeof()); >+ request.done(); >+ } > } >#P org.eclipse.cdt.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/plugin.xml,v >retrieving revision 1.228 >diff -u -r1.228 plugin.xml >--- plugin.xml 1 Feb 2010 16:23:32 -0000 1.228 >+++ plugin.xml 16 Feb 2010 21:14:02 -0000 >@@ -724,6 +724,19 @@ > </action> > </objectContribution> > <objectContribution >+ objectClass="org.eclipse.cdt.debug.internal.core.IWatchpointTarget" >+ id="org.eclipse.cdt.debug.ui.WatchpointActions"> >+ <action >+ class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >+ enablesFor="1" >+ icon="icons/elcl16/watchpoint_co.gif" >+ id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >+ label="%AddWatchpoint.label" >+ menubarPath="additions" >+ tooltip="%AddWatchpoint.tooltip"> >+ </action> >+ </objectContribution> >+ <objectContribution > objectClass="org.eclipse.cdt.core.model.IVariable" > id="org.eclipse.cdt.debug.ui.WatchpointActions"> > <action >@@ -808,20 +821,6 @@ > class="org.eclipse.cdt.debug.core.model.ICVariable"> > </selection> > </action> >- <action >- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >- enablesFor="1" >- icon="icons/elcl16/watchpoint_co.gif" >- id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >- label="%AddWatchpoint.label" >- menubarPath="additions" >- tooltip="%AddWatchpoint.tooltip"> >- <enablement> >- <pluginState >- value="activated" >- id="org.eclipse.cdt.debug.ui"/> >- </enablement> >- </action> > </viewerContribution> > <viewerContribution > targetID="org.eclipse.debug.ui.RegisterView" >Index: src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java,v >retrieving revision 1.3 >diff -u -r1.3 AddWatchpointOnVariableActionDelegate.java >--- src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java 11 Jun 2008 15:48:38 -0000 1.3 >+++ src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java 16 Feb 2010 21:14:02 -0000 >@@ -11,66 +11,92 @@ > package org.eclipse.cdt.debug.internal.ui.actions; > > >-import org.eclipse.cdt.debug.internal.core.model.CVariable; >-import org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointDialog; >+import org.eclipse.cdt.debug.internal.core.IWatchpointTarget; > import org.eclipse.cdt.debug.ui.CDebugUIPlugin; >-import org.eclipse.debug.core.DebugException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.TreeSelection; > import org.eclipse.jface.window.Window; >-import org.eclipse.ui.IActionDelegate; > import org.eclipse.ui.IObjectActionDelegate; > import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.progress.WorkbenchJob; > >- >-public class AddWatchpointOnVariableActionDelegate extends AddWatchpointActionDelegate { >+/** >+ * Invoked when user right clicks on an element in the Variables or Expressions >+ * view and selects 'Add Watchpoint (C/C++)' >+ */ >+public class AddWatchpointOnVariableActionDelegate extends AddWatchpointActionDelegate implements IObjectActionDelegate { > > /** >- * Constructor for Action1. >+ * The target variable/expression >+ */ >+ private IWatchpointTarget fVar; >+ >+ /** >+ * Constructor > */ > public AddWatchpointOnVariableActionDelegate() { > super(); > } > >- /** >- * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) > */ >- public void setActivePart(IAction action, IWorkbenchPart targetPart) {} >+ public void setActivePart(IAction action, IWorkbenchPart targetPart) { >+ // Don't care. Our logic is agnostic to the view we're invoked from. >+ } > >- /** >- * @see IActionDelegate#run(IAction) >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointActionDelegate#run(org.eclipse.jface.action.IAction) > */ > public void run(IAction action) { >- IStructuredSelection selection = getSelection(); >- >- if (selection == null || selection.isEmpty()) { >+ if (fVar == null) { > return; > } > >- Object obj = ((TreeSelection)selection).getFirstElement(); >- if (obj != null && obj instanceof CVariable) { >- CVariable var = (CVariable)obj; >- >- String expr = ""; >- >- try { >- expr = var.getExpressionString(); >- } catch (DebugException e) {} >- >- AddWatchpointDialog dlg = new AddWatchpointDialog(CDebugUIPlugin.getActiveWorkbenchShell(), >- getMemorySpaceManagement()); //$NON-NLS-1$ >- dlg.setExpression(expr); >- dlg.initializeRange(false, Integer.toString(var.sizeof())); >- if (dlg.open() == Window.OK) { >- addWatchpoint(dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange()); >- } >+ final String expr = fVar.getExpression(); >+ if (expr == null) { >+ assert false : "how are we getting an empty expression?"; //$NON-NLS-1$ >+ return; > } >+ >+ // Getting the size of the variable/expression is an asynchronous >+ // operation...or at least the API is (the CDI implementation reacts >+ // synchronously) >+ final IWatchpointTarget.GetSizeRequest request = new IWatchpointTarget.GetSizeRequest() { >+ public void done() { >+ // Now that we have the size, put up a dialog to create the watchpoint >+ final int size = getSize(); >+ assert size > 0 : "unexpected variale/expression size"; //$NON-NLS-1$ >+ WorkbenchJob job = new WorkbenchJob("open watchpoint dialog") { //$NON-NLS-1$ >+ @Override >+ public IStatus runInUIThread(IProgressMonitor monitor) { >+ AddWatchpointDialog dlg = new AddWatchpointDialog(CDebugUIPlugin.getActiveWorkbenchShell(), >+ getMemorySpaceManagement()); >+ dlg.setExpression(expr); >+ dlg.initializeRange(false, Integer.toString(size)); >+ if (dlg.open() == Window.OK) { >+ addWatchpoint(dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange()); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job.setSystem(true); >+ job.schedule(); >+ } >+ }; >+ fVar.getSize(request); > } >- >+ > /** >- * @see IActionDelegate#selectionChanged(IAction, ISelection) >+ * Record the target variable/expression. >+ * >+ * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, >+ * org.eclipse.jface.viewers.ISelection) > */ > public void selectionChanged(IAction action, ISelection selection) { > if (selection == null || selection.isEmpty()) { >@@ -79,16 +105,20 @@ > } > if (selection instanceof TreeSelection) { > Object obj = ((TreeSelection)selection).getFirstElement(); >- if (obj != null && obj instanceof CVariable) { >- action.setEnabled(true); >- } else { >- action.setEnabled(false); >+ action.setEnabled(obj instanceof IWatchpointTarget); >+ if (obj instanceof IWatchpointTarget) { >+ fVar = (IWatchpointTarget)obj; >+ return; > } >+ assert false : "action installed in unexpected type of object"; //$NON-NLS-1$ > } >+ else if (selection instanceof StructuredSelection) { >+ // Not sure why, but sometimes we get an extraneous empty StructuredSelection. Seems harmless enough >+ assert ((StructuredSelection)selection).getFirstElement() == null : "action installed in unexpected type of view/part"; //$NON-NLS-1$ >+ } >+ else { >+ assert false : "action installed in unexpected type of view/part"; //$NON-NLS-1$ >+ } >+ action.setEnabled(false); > } >- >- private IStructuredSelection getSelection() { >- return (IStructuredSelection)getView().getViewSite().getSelectionProvider().getSelection(); >- } >- > } >Index: src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java,v >retrieving revision 1.1 >diff -u -r1.1 IDisassemblyRetrieval.java >--- src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java 15 Feb 2010 15:34:31 -0000 1.1 >+++ src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java 16 Feb 2010 21:14:02 -0000 >@@ -14,57 +14,16 @@ > import java.math.BigInteger; > > import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.debug.core.IRequest; >+import org.eclipse.cdt.debug.internal.core.CRequest; > import org.eclipse.debug.core.model.IStackFrame; > > /** > */ > public interface IDisassemblyRetrieval { >- /** >- */ >- public static class Request implements IRequest { >- private IStatus fStatus; >- private boolean fCanceled; >- /* >- * @see org.eclipse.debug.core.IRequest#cancel() >- */ >- public void cancel() { >- fCanceled= true; >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#done() >- */ >- public void done() { >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#getStatus() >- */ >- public IStatus getStatus() { >- return fStatus; >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#isCanceled() >- */ >- public boolean isCanceled() { >- return fCanceled; >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#setStatus(org.eclipse.core.runtime.IStatus) >- */ >- public void setStatus(IStatus status) { >- fStatus= status; >- } >- >- } > > /** > */ >- public static class AddressRequest extends Request { >+ public static class AddressRequest extends CRequest { > private BigInteger fAddress; > /** > * @return the address >@@ -81,7 +40,7 @@ > } > } > >- public static class DisassemblyRequest extends Request { >+ public static class DisassemblyRequest extends CRequest { > IDisassemblyBlock fDisassemblyBlock; > > /**
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:
john.cortell
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 248606
:
159245
|
159459
|
159500
|
159725
|
159821