Right now we had to keep the old mapping API so there is a method named�rangeForPC:contextIsActiveContext:�that has a boolean as second argument. With this boolean you know if you need to look for the range of the current pc (first argument) of the previous pc of the first argument. On the old mapping, they needed the exact pc for their pc to�abstract�pc mapping. So they needed a method�previousPCFor:�to handle the case of multiple byte code instructions. But we don�t care, as the pc will be used in the scan of�instructionForPC:, so we just need to do pc � 1.
The result is :
DebuggerMethodMapOpal>>#rangeForPC:�aPC�contextIsActiveContext:contextIsActive
"return the debug highlight for aPC"
| pc |
pc := contextIsActive ifTrue: [aPC] ifFalse: [aPC - 1].
^ (methodNode sourceNodeForPC: pc) debugHighlightRange
RBMethodNode>>#sourceNodeForPC:�anInteger
^ (self ir instructionForPC: anInteger) sourceNode
IRMethod>>#instructionForPC:�aPC
0 to: -3 by: -1 do: [ : off |
(self firstInstructionMatching: [:ir | ir bytecodeOffset = (aPC - off) ]) ifNotNil: [:it |^it]]
On 27 janv. 2014, at 08:44, Marcus Denker <marcus.denker@inria.fr> wrote:On 26 Jan 2014, at 10:08, Camille Teruel <camille.teruel@gmail.com> wrote:[ [ �] ]�prints:[ ]�instead of:�[ [ ] ]and[ :arg | [ arg ] ]prints:DoIt^ [ :arg | [ arg ] ] yourselfinstead of:�[ :arg | [ arg ] ]Apparently it's the print that is not correct because of problem in #sourceNode.Any clue? Marcus? Cl�ment?Other than �the devil is in the details� (this is all far too complex for my taste, implementation wise�)Can you add an issue? My problem is that i have no time right now to even think about it��My problem is that I found a fix with try-and-fail without really understanding the code.I just found that problematic examples were passing through that condition whereas non problematic examples were not.I looked at the versions and though that you may have left this line by error.I removed it and so far, it *seems* to work. So the fix is there but I have no clue if it's correct or not.Here it the case:�https://pharo.fogbugz.com/f/cases/12732/sourceNode-brokenMarcus