Current line number

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Current line number

Gwenaël Casaccio
Hi,

while debugging the expression 1 printNl. I've seen some
unexpected behavior with the current line number. It returns
the line 0 which means that the IP is not correct.

Here is a patch that should I hope fix that issue.

Gwen


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

0001-Fix-an-issue-in-the-current-line-number.patch (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Current line number

Paolo Bonzini-2
Il 16/10/2013 20:45, Gwenaël Casaccio ha scritto:
> Hi,
>
> while debugging the expression 1 printNl. I've seen some
> unexpected behavior with the current line number. It returns
> the line 0 which means that the IP is not correct.
>
> Here is a patch that should I hope fix that issue.

Looks good.  Thanks!

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Current line number

Gwenaël Casaccio
On 17/10/2013 01:22, Paolo Bonzini wrote:

> Il 16/10/2013 20:45, Gwenaël Casaccio ha scritto:
>> Hi,
>>
>> while debugging the expression 1 printNl. I've seen some
>> unexpected behavior with the current line number. It returns
>> the line 0 which means that the IP is not correct.
>>
>> Here is a patch that should I hope fix that issue.
> Looks good.  Thanks!
>
> Paolo
>
Here is an updated version with an error message and a missing
DebugTools file

Gwen


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

0001-Fix-an-issue-in-the-current-line-number.patch (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Current line number

Holger Freyther
On Fri, Oct 18, 2013 at 09:21:28AM +0200, Gwenaël Casaccio wrote:

Dear Gwenaël,

>      sourceCodeMap [
> - "Answer an array which maps bytecode indices to source code
> - line numbers.  0 values represent invalid instruction
> - pointer indices."
> -
> - <category: 'testing accesses'>
> - | map line first |
> - map := ByteArray new: self size.
> - line := 1.
> - first := true.
> - self allByteCodeIndicesDo:
> - [:each :byte :operand |
> - (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
> -    ifTrue:
> - [first ifFalse: [line := operand].
> - first := false.
> - operand > 255 ifTrue: [map := map asArray]].
> - map at: each put: line].
> - ^map
> +        "Answer an array which maps bytecode indices to source code
> +         line numbers.  0 values represent invalid instruction
> +         pointer indices."
> +
> +        <category: 'testing accesses'>
> +        | map line first next |
> +        map := ByteArray new: self size.
> +        next := -1.
> +        line := 1.
> +        first := true.
> +        self allByteCodeIndicesDo:
> +            [ :each :byte :operand |
> +                (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
> +                    ifTrue:
> +                        [ first ifFalse: [ next := operand ].
> +                          first := false.
> +                          operand > 255 ifTrue: [ map := map asArray ] ].
> +                map at: each put: line.
> +                next = -1 ifFalse: [ line := next.
> +                                     next := -1. ] ].
> +        ^ map

I hope you agree that this is very difficult to read to actually find the
few lines that have changed. It would be nice if you could continue to use
tabs in sourcecode that is already using tabs or separate the part that is
changing the code to spaces from the semantic change.


> +        res := self method sourceCodeMap at: self ip + 1.
> +        ^ res = 0 ifTrue: [ self error: 'IP is not correct' ]

For text messages it is always nice to have the actual number inside.
E.g. IP(%1) is not correct. I am merging the patch like this right now
but I would be happy to receive a follow up patch.

thanks!

        holger

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Current line number

Gwenaël Casaccio
On 19/10/2013 12:47, Holger Hans Peter Freyther wrote:

> On Fri, Oct 18, 2013 at 09:21:28AM +0200, Gwenaël Casaccio wrote:
>
> Dear Gwenaël,
>
>>       sourceCodeMap [
>> - "Answer an array which maps bytecode indices to source code
>> - line numbers.  0 values represent invalid instruction
>> - pointer indices."
>> -
>> - <category: 'testing accesses'>
>> - | map line first |
>> - map := ByteArray new: self size.
>> - line := 1.
>> - first := true.
>> - self allByteCodeIndicesDo:
>> - [:each :byte :operand |
>> - (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
>> -    ifTrue:
>> - [first ifFalse: [line := operand].
>> - first := false.
>> - operand > 255 ifTrue: [map := map asArray]].
>> - map at: each put: line].
>> - ^map
>> +        "Answer an array which maps bytecode indices to source code
>> +         line numbers.  0 values represent invalid instruction
>> +         pointer indices."
>> +
>> +        <category: 'testing accesses'>
>> +        | map line first next |
>> +        map := ByteArray new: self size.
>> +        next := -1.
>> +        line := 1.
>> +        first := true.
>> +        self allByteCodeIndicesDo:
>> +            [ :each :byte :operand |
>> +                (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
>> +                    ifTrue:
>> +                        [ first ifFalse: [ next := operand ].
>> +                          first := false.
>> +                          operand > 255 ifTrue: [ map := map asArray ] ].
>> +                map at: each put: line.
>> +                next = -1 ifFalse: [ line := next.
>> +                                     next := -1. ] ].
>> +        ^ map
> I hope you agree that this is very difficult to read to actually find the
> few lines that have changed. It would be nice if you could continue to use
> tabs in sourcecode that is already using tabs or separate the part that is
> changing the code to spaces from the semantic change.
>
I agree and will do that the next time!

>> +        res := self method sourceCodeMap at: self ip + 1.
>> +        ^ res = 0 ifTrue: [ self error: 'IP is not correct' ]
> For text messages it is always nice to have the actual number inside.
> E.g. IP(%1) is not correct. I am merging the patch like this right now
> but I would be happy to receive a follow up patch.
>
> thanks!
>
> holger

Gwen


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

0001-Print-IP-value-in-the-error-message.patch (1K) Download Attachment