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
>From 9bdf19f2184b9a1752df58c7ef888c8b06afe297 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio <mrg...@gmail.com>
Date: Mon, 21 Oct 2013 10:53:25 +0200
Subject: [PATCH] Print IP value in the error message
---
ChangeLog | 5 +++++
kernel/ContextPart.st | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index d291f9d..e70f8b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-21 Gwenael Casaccio <gwenael.casac...@gmail.com>
+
+ * kernel/ContextPart.st: Print the instruction pointer value in the
+ exception message.
+
2013-10-15 Gwenael Casaccio <gwenael.casac...@gmail.com>
* kernel/ContextPart.st: Fix >>#currentLine, the previous
diff --git a/kernel/ContextPart.st b/kernel/ContextPart.st
index 55411c6..acccc48 100644
--- a/kernel/ContextPart.st
+++ b/kernel/ContextPart.st
@@ -251,7 +251,7 @@ methods that can be used in inspection or debugging.'>
<category: 'debugging'>
| res |
res := self method sourceCodeMap at: self ip + 1.
- ^ res = 0 ifTrue: [ self error: 'IP is not correct' ]
+ ^ res = 0 ifTrue: [ self error: 'IP(%1) is not correct' % {(self ip + 1) displayString} ]
ifFalse: [ res ]
]
--
1.8.3.2
_______________________________________________
help-smalltalk mailing list
help-smalltalk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-smalltalk