help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] ContextPart>>printOn: prints incorrect line


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] ContextPart>>printOn: prints incorrect line
Date: Wed, 27 Jul 2011 12:54:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 07/15/2011 06:33 PM, Paolo Bonzini wrote:
> On 07/15/2011 06:03 PM, Ladislav Marek wrote:
>> Patch should be applied in DebugTools package too (just saying to be 
>> sure).
>>
>> diff --git a/packages/debug/DebugTools.st b/packages/debug/DebugTools.st
>> index cb41c3b..f7f8695 100644
>> --- a/packages/debug/DebugTools.st
>> +++ b/packages/debug/DebugTools.st
>> @@ -48,7 +48,7 @@ pointer bytecodes to line numbers.'>
>> ifTrue: [MethodLineMapCache := WeakKeyIdentityDictionary new].
>> lineMap := MethodLineMapCache at: method
>> ifAbsentPut: [method sourceCodeMap].
>> - ^lineMap at: aContext ip + 1 ifAbsent: [1]
>> + ^lineMap at: aContext ip - 1 ifAbsent: [1]
>> ]
>>
>> Debugger class>> on: aProcess [
>>
> 
> Right, thanks!

Actually, the following fix is needed:

diff --git a/kernel/ContextPart.st b/kernel/ContextPart.st
index dc11dd3..9f69d60 100644
--- a/kernel/ContextPart.st
+++ b/kernel/ContextPart.st
@@ -125,7 +125,7 @@ methods that can be used in inspection or debugging.'>
         thus making the implementation faster."
 
        <category: 'debugging'>
-       ^self method sourceCodeMap at: self ip - 1 ifAbsent: [1]
+       ^self method sourceCodeMap at: (self ip - 1 max: 1) ifAbsent: [1]
     ]
 
     debugger [
diff --git a/packages/debug/DebugTools.st b/packages/debug/DebugTools.st
index f7f8695..49033bd 100644
--- a/packages/debug/DebugTools.st
+++ b/packages/debug/DebugTools.st
@@ -48,7 +48,7 @@ pointer bytecodes to line numbers.'>
            ifTrue: [MethodLineMapCache := WeakKeyIdentityDictionary new].
        lineMap := MethodLineMapCache at: method
                    ifAbsentPut: [method sourceCodeMap].
-       ^lineMap at: aContext ip - 1 ifAbsent: [1]
+       ^lineMap at: (aContext ip - 1 max: 1) ifAbsent: [1]
     ]
 
     Debugger class >> on: aProcess [


Otherwise the DebugTools testsuite (correctly) fails.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]