Eliot Miranda uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-eem.821.mcz ==================== Summary ==================== Name: Tools-eem.821 Author: eem Time: 16 June 2018, 2:35:48.93167 pm UUID: bfb6adeb-a9c8-44a3-bd7e-fe35f317872d Ancestors: Tools-eem.820 Correct pc range computation for full blocks. "self method" answers the home metyhod, and hence confuses things horribly when using full blocks. This is a slip; I had added the method argument but not used it in all cases. Doh! =============== Diff against Tools-eem.820 =============== Item was removed: - ----- Method: DebuggerMethodMap>>rangeForPC:contextIsActiveContext: (in category 'private but obsolete') ----- - rangeForPC: contextsConcretePC contextIsActiveContext: contextIsActiveContext - "Answer the indices in the source code for the supplied pc. - If the context is the actve context (is at the hot end of the stack) - then its pc is the current pc. But if the context isn't, because it is - suspended sending a message, then its current pc is the previous pc." - - | pc i end | - pc := self method abstractPCForConcretePC: (contextIsActiveContext - ifTrue: [contextsConcretePC] - ifFalse: [(self method pcPreviousTo: contextsConcretePC) - ifNotNil: [:prevpc| prevpc] - ifNil: [contextsConcretePC]]). - (self abstractSourceMap includesKey: pc) ifTrue: - [^self abstractSourceMap at: pc]. - sortedSourceMap ifNil: - [sortedSourceMap := self abstractSourceMap associations - replace: [ :each | each copy ]; - sort]. - sortedSourceMap isEmpty ifTrue: [^1 to: 0]. - i := sortedSourceMap findNearbyBinaryIndex: [:assoc| pc - assoc key]. - i < 1 ifTrue: [^1 to: 0]. - i > sortedSourceMap size ifTrue: - [end := sortedSourceMap inject: 0 into: - [:prev :this | prev max: this value last]. - ^end+1 to: end]. - ^(sortedSourceMap at: i) value - - "| method source scanner map | - method := DebuggerMethodMap compiledMethodAt: #rangeForPC:contextIsActiveContext:. - source := method getSourceFromFile asString. - scanner := InstructionStream on: method. - map := method debuggerMap. - Array streamContents: - [:ranges| - [scanner atEnd] whileFalse: - [| range | - range := map rangeForPC: scanner pc contextIsActiveContext: true. - ((map abstractSourceMap includesKey: scanner abstractPC) - and: [range first ~= 0]) ifTrue: - [ranges nextPut: (source copyFrom: range first to: range last)]. - scanner interpretNextInstructionFor: InstructionClient new]]"! Item was changed: ----- Method: DebuggerMethodMap>>rangeForPC:in:contextIsActiveContext: (in category 'source mapping') ----- rangeForPC: contextsConcretePC in: method contextIsActiveContext: contextIsActiveContext "Answer the indices in the source code for the supplied pc. If the context is the actve context (is at the hot end of the stack) then its pc is the current pc. But if the context isn't, because it is suspended sending a message, then its current pc is the previous pc." | pc i end | + pc := method abstractPCForConcretePC: (contextIsActiveContext - pc := self method abstractPCForConcretePC: (contextIsActiveContext ifTrue: [contextsConcretePC] + ifFalse: [(method pcPreviousTo: contextsConcretePC) - ifFalse: [(self method pcPreviousTo: contextsConcretePC) ifNotNil: [:prevpc| prevpc] ifNil: [contextsConcretePC]]). (self abstractSourceMap includesKey: pc) ifTrue: [^self abstractSourceMap at: pc]. sortedSourceMap ifNil: [sortedSourceMap := self abstractSourceMap associations replace: [ :each | each copy ]; sort]. sortedSourceMap isEmpty ifTrue: [^1 to: 0]. i := sortedSourceMap findNearbyBinaryIndex: [:assoc| pc - assoc key]. i < 1 ifTrue: [^1 to: 0]. i > sortedSourceMap size ifTrue: [end := sortedSourceMap inject: 0 into: [:prev :this | prev max: this value last]. ^end+1 to: end]. ^(sortedSourceMap at: i) value "| method source scanner map | method := DebuggerMethodMap compiledMethodAt: #rangeForPC:in:contextIsActiveContext:. source := method getSourceFromFile asString. scanner := InstructionStream on: method. map := method debuggerMap. Array streamContents: [:ranges| [scanner atEnd] whileFalse: [| range | range := map rangeForPC: scanner pc in: method contextIsActiveContext: true. ((map abstractSourceMap includesKey: scanner abstractPC) and: [range first ~= 0]) ifTrue: [ranges nextPut: (source copyFrom: range first to: range last)]. scanner interpretNextInstructionFor: InstructionClient new]]"! Item was changed: ----- Method: DebuggerMethodMapForFullBlockCompiledMethods>>rangeForPC:in:contextIsActiveContext: (in category 'source mapping') ----- rangeForPC: contextsConcretePC in: method contextIsActiveContext: contextIsActiveContext "Answer the indices in the source code for the supplied pc. If the context is the actve context (is at the hot end of the stack) then its pc is the current pc. But if the context isn't, because it is suspended sending a message, then its current pc is the previous pc." | pc i end mapForMethod sortedMap | + pc := method abstractPCForConcretePC: (contextIsActiveContext - pc := self method abstractPCForConcretePC: (contextIsActiveContext ifTrue: [contextsConcretePC] + ifFalse: [(method pcPreviousTo: contextsConcretePC) - ifFalse: [(self method pcPreviousTo: contextsConcretePC) ifNotNil: [:prevpc| prevpc] ifNil: [contextsConcretePC]]). ((mapForMethod := self abstractSourceMapForMethod: method) includesKey: pc) ifTrue: [^mapForMethod at: pc]. sortedSourceMap ifNil: [sortedSourceMap := IdentityDictionary new]. sortedMap := sortedSourceMap at: method ifAbsentPut: [mapForMethod associations replace: [ :each | each copy ]; sort]. sortedMap isEmpty ifTrue: [^1 to: 0]. i := sortedMap findNearbyBinaryIndex: [:assoc| pc - assoc key]. i < 1 ifTrue: [^1 to: 0]. i > sortedMap size ifTrue: [end := sortedMap inject: 0 into: [:prev :this | prev max: this value last]. ^end+1 to: end]. ^(sortedMap at: i) value "| method source scanner map | method := DebuggerMethodMapForFullBlockCompiledMethods compiledMethodAt: #rangeForPC:in:contextIsActiveContext:. source := method getSourceFromFile asString. scanner := InstructionStream on: method. map := method debuggerMap. Array streamContents: [:ranges| [scanner atEnd] whileFalse: [| range | range := map rangeForPC: scanner pc in: method contextIsActiveContext: true. ((map abstractSourceMap includesKey: scanner abstractPC) and: [range first ~= 0]) ifTrue: [ranges nextPut: (source copyFrom: range first to: range last)]. scanner interpretNextInstructionFor: InstructionClient new]]"! |
Free forum by Nabble | Edit this page |