@@ -697,23 +697,27 @@ int IDebugPendingBreakpoint2.SetPassCount(BP_PASSCOUNT bpPassCount)
697697 }
698698 }
699699
700- // Re-send -break-after to GDB with the updated ignore count, accounting
701- // for the current hit count so the breakpoint fires at the right time .
702- if ( bp != null && bpPassCount . stylePassCount != enum_BP_PASSCOUNT_STYLE . BP_PASSCOUNT_NONE )
700+ // When the pass count is cleared (NONE), send ignore count 0 to clear
701+ // any stale GDB ignore count from the previous condition .
702+ if ( bp != null )
703703 {
704- uint currentHits = 0 ;
705- lock ( _boundBreakpoints )
704+ uint ignoreCount = 0 ;
705+ if ( bpPassCount . stylePassCount != enum_BP_PASSCOUNT_STYLE . BP_PASSCOUNT_NONE )
706706 {
707- foreach ( AD7BoundBreakpoint boundBp in _boundBreakpoints )
707+ uint currentHits = 0 ;
708+ lock ( _boundBreakpoints )
708709 {
709- uint hc ;
710- if ( ( ( IDebugBoundBreakpoint2 ) boundBp ) . GetHitCount ( out hc ) == Constants . S_OK && hc > currentHits )
710+ foreach ( AD7BoundBreakpoint boundBp in _boundBreakpoints )
711711 {
712- currentHits = hc ;
712+ uint hc ;
713+ if ( ( ( IDebugBoundBreakpoint2 ) boundBp ) . GetHitCount ( out hc ) == Constants . S_OK && hc > currentHits )
714+ {
715+ currentHits = hc ;
716+ }
713717 }
714718 }
719+ ignoreCount = ComputeIgnoreCount ( bpPassCount . stylePassCount , bpPassCount . dwPassCount , currentHits ) ;
715720 }
716- uint ignoreCount = ComputeIgnoreCount ( bpPassCount . stylePassCount , bpPassCount . dwPassCount , currentHits ) ;
717721 _engine . DebuggedProcess . WorkerThread . RunOperation ( ( ) =>
718722 {
719723 _engine . DebuggedProcess . AddInternalBreakAction (
@@ -724,6 +728,28 @@ int IDebugPendingBreakpoint2.SetPassCount(BP_PASSCOUNT bpPassCount)
724728 return Constants . S_OK ;
725729 }
726730
731+ /// <summary>
732+ /// Re-sends -break-after to GDB after a hit count reset.
733+ /// </summary>
734+ internal void RecomputeBreakAfter ( uint currentHits )
735+ {
736+ if ( _bp == null
737+ || ( _bpRequestInfo . dwFields & enum_BPREQI_FIELDS . BPREQI_PASSCOUNT ) == 0
738+ || _bpRequestInfo . bpPassCount . stylePassCount == enum_BP_PASSCOUNT_STYLE . BP_PASSCOUNT_NONE )
739+ {
740+ return ;
741+ }
742+
743+ PendingBreakpoint bp = _bp ;
744+ uint ignoreCount = ComputeIgnoreCount ( _bpRequestInfo . bpPassCount . stylePassCount , _bpRequestInfo . bpPassCount . dwPassCount , currentHits ) ;
745+ _engine . DebuggedProcess . WorkerThread . RunOperation ( ( ) =>
746+ {
747+ _engine . DebuggedProcess . AddInternalBreakAction (
748+ ( ) => bp . SetBreakAfterAsync ( ignoreCount , _engine . DebuggedProcess )
749+ ) ;
750+ } ) ;
751+ }
752+
727753 // Toggles the virtualized state of this pending breakpoint. When a pending breakpoint is virtualized,
728754 // the debug engine will attempt to bind it every time new code loads into the program.
729755 // The sample engine will does not support this.
0 commit comments