<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <font face="Georgia">In a much older Squeak, I just stepped though
      code like the debugger and recorded every PC that was executed. I
      could then pretty-print every method and color the parts executed
      or not differently. Was rather slow and did have trouble trying to
      step through primitives, but could yield nice results. The guts of
      it was this:<br>
      <br>
      tallyCoverageInner: aBlock<br>
      <br>
      &nbsp;&nbsp;&nbsp; | tick str list smallSteps bigSteps incr prevContext |<br>
      <br>
      &nbsp;&nbsp;&nbsp; SequentialEventManager classNow: 0.<br>
      &nbsp;&nbsp;&nbsp; smallSteps _ bigSteps _ 0.<br>
      &nbsp;&nbsp;&nbsp; incr _ 200000.<br>
      &nbsp;&nbsp;&nbsp; tick _ Time millisecondClockValue.<br>
      &nbsp;&nbsp;&nbsp; byteCodeTallies _ IdentityDictionary new: 10000.<br>
      &nbsp;&nbsp;&nbsp; prevContext _ nil.<br>
      &nbsp;&nbsp;&nbsp; thisContext sender<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; runSimulated: aBlock<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; contextAtEachStep: [ :current |<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; smallSteps _ smallSteps + 1.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; smallSteps &gt;= incr ifTrue: [<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; smallSteps _ 0.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bigSteps _ bigSteps + 1.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; str _ (Time millisecondClockValue - tick / 1000)
      rounded asString,' ',<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (bigSteps * incr) asStringWithCommas,' ..
      ',byteCodeTallies size asString,'&nbsp;&nbsp;&nbsp; ',<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (SequentialEventManager classNow ifNil: [0])
      ddhhmm,'&nbsp; ',<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (self who: current method) asString,'&nbsp;&nbsp;&nbsp; '.<br>
      <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Summary add: str.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; str displayAt: 0@0.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; prevContext == current ifFalse: [<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; prevContext _ current.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; list _ byteCodeTallies <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; at: current method <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifAbsentPut: [ByteArray new: current method
      endPC + 1].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; list at: current pc + 1 put: 1.<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; "bigSteps &gt; 3 ifTrue: [^byteCodeTallies]."<br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].<br>
      &nbsp;&nbsp;&nbsp; ^byteCodeTallies<br>
      <br>
    </font>
    <div class="moz-cite-prefix">On 2/21/13 2:52 PM, Eliot Miranda
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAC20JE35H0t3Uxuoa_xiWQ8UuvVD7ZCeyyrUC6ozLm=7_3pERw@mail.gmail.com"
      type="cite">
      <pre wrap="">Hi All,

     anyone have any bytecode-to-bytecode transformation tools for
doing basic-block resolution coverage?
</pre>
    </blockquote>
    <br>
  </body>
</html>