Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for PR 39936: GDB hits modified conditional breakpoints when condition not satisfied

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.214
diff -u -r1.214 ChangeLog
--- ChangeLog 17 Jul 2003 20:24:01 -0000 1.214
+++ ChangeLog 17 Jul 2003 21:57:57 -0000
@@ -1,4 +1,9 @@
 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
  Automatically update the list of source locations when the list of the referenced
  projects is modified.
  * ICSourceLocator.java: added new method - 'getProject'
Index: src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java,v
retrieving revision 1.104
diff -u -r1.104 CDebugTarget.java
--- src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 17 Jul 2003 20:24:01 -0000 1.104
+++ src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 17 Jul 2003 21:58:02 -0000
@@ -1886,6 +1886,7 @@
    {
     cdiBreakpoint.setEnabled( false );
    }
+   setBreakpointCondition( breakpoint );
   }
   catch( CoreException ce )
   {
@@ -1901,8 +1902,7 @@
  {
   ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
   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, condition, null );
+  ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null );
   getBreakpoints().put( breakpoint, cdiBreakpoint );
   return cdiBreakpoint;
  }
@@ -1921,6 +1921,7 @@
    {
     cdiBreakpoint.setEnabled( false );
    }
+   setBreakpointCondition( breakpoint );
   }
   catch( CoreException ce )
   {
@@ -1940,8 +1941,7 @@
  {
   ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
   ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
-  ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
-  ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
+  ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null );
   getBreakpoints().put( breakpoint, cdiBreakpoint );
   return cdiBreakpoint;
  }
@@ -1960,6 +1960,7 @@
    {
     cdiBreakpoint.setEnabled( false );
    }
+   setBreakpointCondition( breakpoint );
   }
   catch( CoreException ce )
   {
@@ -1981,8 +1982,7 @@
   String function = breakpoint.getFunction();
   String fileName = ( function != null && function.indexOf( "::" ) == -1  ) ? breakpoint.getFileName() : null;
   ICDILocation location = bm.createLocation( fileName, function, -1 );
-  ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
-  ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, null );
+  ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null );
   getBreakpoints().put( breakpoint, cdiBreakpoint );
   return cdiBreakpoint;
  }
@@ -2015,16 +2015,25 @@
  private synchronized ICDIWatchpoint setWatchpoint0( ICWatchpoint watchpoint ) throws CDIException, CoreException
  {
   ICDIBreakpointManager bm = getCDISession().getBreakpointManager();
-  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 );
+  ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, _expression_, null );
   getBreakpoints().put( watchpoint, 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 )
  {
   return (ICDIBreakpoint)getBreakpoints().get( breakpoint );

Back to the top