<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>
| tick str list smallSteps bigSteps incr prevContext |<br>
<br>
SequentialEventManager classNow: 0.<br>
smallSteps _ bigSteps _ 0.<br>
incr _ 200000.<br>
tick _ Time millisecondClockValue.<br>
byteCodeTallies _ IdentityDictionary new: 10000.<br>
prevContext _ nil.<br>
thisContext sender<br>
runSimulated: aBlock<br>
contextAtEachStep: [ :current |<br>
smallSteps _ smallSteps + 1.<br>
smallSteps >= incr ifTrue: [<br>
smallSteps _ 0.<br>
bigSteps _ bigSteps + 1.<br>
str _ (Time millisecondClockValue - tick / 1000)
rounded asString,' ',<br>
(bigSteps * incr) asStringWithCommas,' ..
',byteCodeTallies size asString,' ',<br>
(SequentialEventManager classNow ifNil: [0])
ddhhmm,' ',<br>
(self who: current method) asString,' '.<br>
<br>
Summary add: str.<br>
str displayAt: 0@0.<br>
].<br>
prevContext == current ifFalse: [<br>
prevContext _ current.<br>
list _ byteCodeTallies <br>
at: current method <br>
ifAbsentPut: [ByteArray new: current method
endPC + 1].<br>
].<br>
list at: current pc + 1 put: 1.<br>
"bigSteps > 3 ifTrue: [^byteCodeTallies]."<br>
].<br>
^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>