1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Fix for PR 39936: GDB hits modified conditional breakpoints when condition not satisfied.

This is a work around for GDB PR MI/1289.
This commit is contained in:
Mikhail Khodjaiants 2003-07-17 21:59:18 +00:00
parent ef2a5f83f2
commit 6dbda36f90
2 changed files with 23 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2003-07-17 Mikhail Khodjaiants
Fix for PR 39936: GDB hits modified conditional breakpoints when condition not satisfied.
This is a work around for GDB PR MI/1289.
* CDebugTarget.java
2003-07-17 Mikhail Khodjaiants 2003-07-17 Mikhail Khodjaiants
Automatically update the list of source locations when the list of the referenced Automatically update the list of source locations when the list of the referenced
projects is modified. projects is modified.

View file

@ -1886,6 +1886,7 @@ public class CDebugTarget extends CDebugElement
{ {
cdiBreakpoint.setEnabled( false ); cdiBreakpoint.setEnabled( false );
} }
setBreakpointCondition( breakpoint );
} }
catch( CoreException ce ) catch( CoreException ce )
{ {
@ -1901,8 +1902,7 @@ public class CDebugTarget extends CDebugElement
{ {
ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() ); ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
getBreakpoints().put( breakpoint, cdiBreakpoint ); getBreakpoints().put( breakpoint, cdiBreakpoint );
return cdiBreakpoint; return cdiBreakpoint;
} }
@ -1921,6 +1921,7 @@ public class CDebugTarget extends CDebugElement
{ {
cdiBreakpoint.setEnabled( false ); cdiBreakpoint.setEnabled( false );
} }
setBreakpointCondition( breakpoint );
} }
catch( CoreException ce ) catch( CoreException ce )
{ {
@ -1940,8 +1941,7 @@ public class CDebugTarget extends CDebugElement
{ {
ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) ); ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
getBreakpoints().put( breakpoint, cdiBreakpoint ); getBreakpoints().put( breakpoint, cdiBreakpoint );
return cdiBreakpoint; return cdiBreakpoint;
} }
@ -1960,6 +1960,7 @@ public class CDebugTarget extends CDebugElement
{ {
cdiBreakpoint.setEnabled( false ); cdiBreakpoint.setEnabled( false );
} }
setBreakpointCondition( breakpoint );
} }
catch( CoreException ce ) catch( CoreException ce )
{ {
@ -1981,8 +1982,7 @@ public class CDebugTarget extends CDebugElement
String function = breakpoint.getFunction(); String function = breakpoint.getFunction();
String fileName = ( function != null && function.indexOf( "::" ) == -1 ) ? breakpoint.getFileName() : null; String fileName = ( function != null && function.indexOf( "::" ) == -1 ) ? breakpoint.getFileName() : null;
ICDILocation location = bm.createLocation( fileName, function, -1 ); ICDILocation location = bm.createLocation( fileName, function, -1 );
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() ); ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
getBreakpoints().put( breakpoint, cdiBreakpoint ); getBreakpoints().put( breakpoint, cdiBreakpoint );
return cdiBreakpoint; return cdiBreakpoint;
} }
@ -2015,16 +2015,25 @@ public class CDebugTarget extends CDebugElement
private synchronized ICDIWatchpoint setWatchpoint0( ICWatchpoint watchpoint ) throws CDIException, CoreException private synchronized ICDIWatchpoint setWatchpoint0( ICWatchpoint watchpoint ) throws CDIException, CoreException
{ {
ICDIBreakpointManager bm = getCDISession().getBreakpointManager(); ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDICondition condition = bm.createCondition( watchpoint.getIgnoreCount(), watchpoint.getCondition() );
int accessType = 0; int accessType = 0;
accessType |= ( watchpoint.isWriteType() ) ? ICDIWatchpoint.WRITE : 0; accessType |= ( watchpoint.isWriteType() ) ? ICDIWatchpoint.WRITE : 0;
accessType |= ( watchpoint.isReadType() ) ? ICDIWatchpoint.READ : 0; accessType |= ( watchpoint.isReadType() ) ? ICDIWatchpoint.READ : 0;
String expression = watchpoint.getExpression(); String expression = watchpoint.getExpression();
ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition ); ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, null );
getBreakpoints().put( watchpoint, cdiWatchpoint ); getBreakpoints().put( watchpoint, cdiWatchpoint );
return cdiWatchpoint; return cdiWatchpoint;
} }
private void setBreakpointCondition( ICBreakpoint breakpoint ) throws CoreException, CDIException
{
ICDIBreakpoint cdiBreakpoint = findCDIBreakpoint( breakpoint );
if ( cdiBreakpoint == null )
return;
ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
cdiBreakpoint.setCondition( condition );
}
private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint ) private ICDIBreakpoint findCDIBreakpoint( IBreakpoint breakpoint )
{ {
return (ICDIBreakpoint)getBreakpoints().get( breakpoint ); return (ICDIBreakpoint)getBreakpoints().get( breakpoint );