1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Implementation of watchpoints.

This commit is contained in:
Mikhail Khodjaiants 2002-09-04 20:50:20 +00:00
parent b5af571676
commit b4632f88d2
11 changed files with 264 additions and 10 deletions

View file

@ -102,6 +102,12 @@
<attribute
name="org.eclipse.cdt.debug.core.expression">
</attribute>
<attribute
name="org.eclipse.cdt.debug.core.write">
</attribute>
<attribute
name="org.eclipse.cdt.debug.core.read">
</attribute>
</extension>
<extension
point="org.eclipse.debug.core.breakpoints">
@ -120,6 +126,11 @@
class="org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint"
id="cFunctionBreakpoint">
</breakpoint>
<breakpoint
markerType="org.eclipse.cdt.debug.core.cWatchpointMarker"
class="org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint"
id="cWatchpoint">
</breakpoint>
</extension>
</plugin>

View file

@ -32,7 +32,7 @@ public interface ICBreakpoint extends IBreakpoint
public static final String INSTALL_COUNT = "org.eclipse.cdt.debug.core.installCount"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the the conditional expression
* Breakpoint attribute storing the conditional expression
* associated with this breakpoint (value <code>"org.eclipse.cdt.debug.core.condition"</code>).
* This attribute is a <code>String</code>.
*/

View file

@ -0,0 +1,58 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core;
import org.eclipse.core.runtime.CoreException;
/**
*
* A watchpoint specific to the C/C++ debug model.
*
* @since Sep 4, 2002
*/
public interface ICWatchpoint extends ICBreakpoint
{
/**
* Watchpoint attribute storing the expression associated with this
* watchpoint (value <code>"org.eclipse.cdt.debug.core.expression"</code>).
* This attribute is a <code>String</code>.
*/
public static final String EXPRESSION = "org.eclipse.cdt.debug.core.expression"; //$NON-NLS-1$
/**
* Write access watchpoint attribute (value <code>"org.eclipse.cdt.debug.core.write"</code>).
* This attribute is a <code>boolean</code>.
*/
public static final String WRITE = "org.eclipse.cdt.debug.core.write"; //$NON-NLS-1$
/**
* Read access watchpoint attribute (value <code>"org.eclipse.cdt.debug.core.read"</code>).
* This attribute is a <code>boolean</code>.
*/
public static final String READ = "org.eclipse.cdt.debug.core.read"; //$NON-NLS-1$
/**
* Returns whether this watchppoint is a write watchpoint.
*
* @return whether this watchppoint is a write watchpoint
*/
boolean isWriteType() throws CoreException;
/**
* Returns whether this watchppoint is a read watchpoint.
*
* @return whether this watchppoint is a read watchpoint
*/
boolean isReadType() throws CoreException;
/**
* Returns the watchpoint's expression.
*
* @return the expression of this watchpoint
* @throws CDIException if this method fails. Reasons include:
*/
String getExpression() throws CoreException;
}

View file

@ -0,0 +1,76 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map;
import org.eclipse.cdt.debug.core.ICWatchpoint;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
/**
*
* Enter type comment.
*
* @since Sep 4, 2002
*/
public class CWatchpoint extends CBreakpoint implements ICWatchpoint
{
private static final String C_WATCHPOINT = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
/**
* Constructor for CWatchpoint.
*/
public CWatchpoint()
{
}
/**
* Constructor for CWatchpoint.
* @param resource
* @param markerType
* @param attributes
* @param add
* @throws DebugException
*/
public CWatchpoint( IResource resource, Map attributes, boolean add ) throws DebugException
{
super( resource, getMarkerType(), attributes, add );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType()
*/
public boolean isWriteType() throws CoreException
{
return ensureMarker().getAttribute( WRITE, true );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICWatchpoint#isReadType()
*/
public boolean isReadType() throws CoreException
{
return ensureMarker().getAttribute( READ, false );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICWatchpoint#getExpression()
*/
public String getExpression() throws CoreException
{
return ensureMarker().getAttribute( EXPRESSION, "" );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
public static String getMarkerType()
{
return C_WATCHPOINT;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

View file

@ -20,4 +20,5 @@ AddBreakpoint.label=Add/Remove &Breakpoint
EnableBreakpoint.label=T&oggle Breakpoint
BreakpointProperties.label=Breakpoint P&roperties...
ManageBreakpointAction.label=Add/Remove C/C++ Brea&kpoint
BreakpointPropertiesAction.label=P&roperties...
BreakpointPropertiesAction.label=P&roperties...
ManageWatchpointAction.label=Add/Remove C/C++ &Watchpoint

View file

@ -111,6 +111,21 @@
</pluginState>
</enablement>
</action>
<action
label="%ManageWatchpointAction.label"
icon="icons/full/obj16/readwrite_obj.gif"
helpContextId="manage_watchpoint_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageWatchpointActionDelegate"
menubarPath="org.eclipse.ui.run/breakpointGroup"
disabledIcon="icons/full/obj16/readwrite_obj_disabled.gif"
id="org.eclipse.cdt.debug.internal.ui.actions.ManageWatchpointActionDelegate">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
</actionSet>
</extension>
<extension

View file

@ -68,6 +68,7 @@ public class CBreakpointPropertiesDialog extends Dialog
children[i].setSize( rect.width, rect.height );
}
}
public Point computeSize( Composite composite, int wHint, int hHint, boolean force )
{
if ( wHint != SWT.DEFAULT && hHint != SWT.DEFAULT )

View file

@ -0,0 +1,95 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
*
* Action for adding/removing watchpoints at a selection in the active
* C/C++ or assembly editor.
*
* @since Sep 4, 2002
*/
public class ManageWatchpointActionDelegate implements IWorkbenchWindowActionDelegate,
IPartListener
{
/**
* Constructor for ManageWatchpointActionDelegate.
*/
public ManageWatchpointActionDelegate()
{
super();
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose()
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
*/
public void init( IWorkbenchWindow window )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
*/
public void partActivated( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart)
*/
public void partBroughtToTop( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart)
*/
public void partClosed( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
*/
public void partDeactivated( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
*/
public void partOpened( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
}
}

View file

@ -6,9 +6,7 @@
package org.eclipse.cdt.debug.internal.ui.views.registers;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
@ -17,7 +15,6 @@ import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.IMenuManager;
@ -48,7 +45,7 @@ public class RegistersView extends AbstractDebugEventHandlerView
/**
* The model presentation used as the label provider for the tree viewer.
*/
private DelegatingModelPresentation fModelPresentation;
private CDTDebugModelPresentation fModelPresentation;
protected static final String VARIABLES_SELECT_ALL_ACTION = SELECT_ALL_ACTION + ".Registers"; //$NON-NLS-1$
@ -57,7 +54,7 @@ public class RegistersView extends AbstractDebugEventHandlerView
*/
protected Viewer createViewer( Composite parent )
{
fModelPresentation = new DelegatingModelPresentation();
fModelPresentation = new CDTDebugModelPresentation();
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
// add tree viewer
@ -132,7 +129,7 @@ public class RegistersView extends AbstractDebugEventHandlerView
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(DebugException)
*/
public void handleException(DebugException e)
public void handleException( DebugException e )
{
}
@ -165,7 +162,7 @@ public class RegistersView extends AbstractDebugEventHandlerView
{
if ( fModelPresentation == null )
{
fModelPresentation = new DelegatingModelPresentation();
fModelPresentation = new CDTDebugModelPresentation();
}
return fModelPresentation;
}