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 uses: TGtTargetPackagesForConstraint instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-Constraints' implements this check.

We can start with a search to get an idea of how many halts there are:

#halt gtSenders
  

There are multiple ways to do a halt. We want to search for all relevant 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 coming from GT packages.

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

We can also perform another operation on the results, like grouping them by package:

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