Creating an analysis for senders of halt in GT packages

Halts in the code using Object>>#halt halt "This is the typical message to use for inserting breakpoints during debugging." <debuggerCompleteToSender> Halt now (or other halt specific selectors) are one way to open a debugger during execution. However, most of the times we want to remove them afterwards.

This page describes a step-by-step analysis for finding senders of halt within GT packages.

The constraint GtSendersOfHaltSelectorsInGtPackagesConstraint GtPharoConstraint subclass: #GtSendersOfHaltSelectorsInGtPackagesConstraint instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-Constraints' implements this check.

We can start with a first search to get an ide of how many halts are there

#halt gtSenders
  

There are multiple ways to do a halt. We want to search for all those selectors.

haltSelectors := #(#halt #halt: #haltIf: #haltOnce #haltIfNil #haltOnCount:).
  
haltFilters := haltSelectors collect: [ :aSelector |
	aSelector gtSenders ].
haltFilter := haltFilters copyWithoutFirst
	inject: haltFilters first
	into: [ :compinedFilter :aFilter |
		compinedFilter | aFilter ].
  

In this case we are interested just in halts comming from GT packages.

gtPackages := BaselineOfGToolkit gtRlAllValidRPackages
  
sendersInGtPackages:= haltFilter select: [ :aMethod |
	gtPackages includes: aMethod package ] 
  

We can also perform another operation in the results, like groping them by package

((sendersInGtPackages contents groupedBy: [ :aCompiledMethod | 
	aCompiledMethod package ]) associations 
		sorted: [ :assoc | assoc key name ] ascending) asOrderedDictionary