mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Implementation of watchpoints.
This commit is contained in:
parent
0ab86c77d5
commit
fe4c884ab4
2 changed files with 37 additions and 3 deletions
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.core.CDebugModel;
|
|||
import org.eclipse.cdt.debug.core.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.ICSourceLocator;
|
||||
import org.eclipse.cdt.debug.core.ICWatchpoint;
|
||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
||||
import org.eclipse.cdt.debug.core.IFormattedMemoryRetrieval;
|
||||
import org.eclipse.cdt.debug.core.IRestart;
|
||||
|
@ -44,6 +45,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
|||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||
import org.eclipse.cdt.debug.internal.core.CSourceLocator;
|
||||
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
|
||||
import org.eclipse.core.resources.IMarkerDelta;
|
||||
|
@ -545,6 +547,10 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
setLineBreakpoint( (ICLineBreakpoint)breakpoint );
|
||||
}
|
||||
else if ( breakpoint instanceof ICWatchpoint )
|
||||
{
|
||||
setWatchpoint( (ICWatchpoint)breakpoint );
|
||||
}
|
||||
}
|
||||
catch( DebugException e )
|
||||
{
|
||||
|
@ -1485,6 +1491,33 @@ public class CDebugTarget extends CDebugElement
|
|||
}
|
||||
}
|
||||
|
||||
private void setWatchpoint( ICWatchpoint watchpoint ) throws DebugException
|
||||
{
|
||||
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
|
||||
try
|
||||
{
|
||||
ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() );
|
||||
int accessType = 0;
|
||||
accessType |= ( watchpoint.isWriteType() ) ? ICDIWatchpoint.WRITE : 0;
|
||||
accessType |= ( watchpoint.isReadType() ) ? ICDIWatchpoint.READ : 0;
|
||||
String expression = watchpoint.getExpression();
|
||||
ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
|
||||
if ( !getBreakpoints().containsKey( watchpoint ) )
|
||||
{
|
||||
getBreakpoints().put( watchpoint, cdiWatchpoint );
|
||||
((CBreakpoint)watchpoint).incrementInstallCount();
|
||||
}
|
||||
}
|
||||
catch( CoreException ce )
|
||||
{
|
||||
requestFailed( "Operation failed. Reason: ", ce );
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
requestFailed( "Operation failed. Reason: ", e );
|
||||
}
|
||||
}
|
||||
|
||||
private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint )
|
||||
{
|
||||
return (ICDIBreakpoint)getBreakpoints().get( breakpoint );
|
||||
|
|
|
@ -344,9 +344,10 @@ public class BreakpointManager extends SessionObject implements ICDIBreakpointMa
|
|||
*/
|
||||
public ICDIWatchpoint setWatchpoint( int type, int watchType, String expression,
|
||||
ICDICondition condition) throws CDIException {
|
||||
boolean access = (type == ICDIWatchpoint.WRITE);
|
||||
boolean read = (type == ICDIWatchpoint.READ);
|
||||
|
||||
boolean access = ( (watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE &&
|
||||
(watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ );
|
||||
boolean read = ( !((watchType & ICDIWatchpoint.WRITE) == ICDIWatchpoint.WRITE) &&
|
||||
(watchType & ICDIWatchpoint.READ) == ICDIWatchpoint.READ );
|
||||
boolean state = suspendInferior();
|
||||
CSession s = getCSession();
|
||||
CommandFactory factory = s.getMISession().getCommandFactory();
|
||||
|
|
Loading…
Add table
Reference in a new issue