Print arguments and locals from home contexts as well in stacktrace jv
authorJan Vrany <jan.vrany@labware.com>
Tue, 02 Jun 2020 11:46:28 +0100
branchjv
changeset 565 80afdfe990f9
parent 564 089cc2fa6c6c
child 566 030aa8306eda
Print arguments and locals from home contexts as well in stacktrace This helps with debugging.
reports/Builder__TestReportFormat.st
--- a/reports/Builder__TestReportFormat.st	Tue Jun 02 11:32:35 2020 +0100
+++ b/reports/Builder__TestReportFormat.st	Tue Jun 02 11:46:28 2020 +0100
@@ -119,15 +119,13 @@
     vars := context vars.
     rcvr := context receiver.
     argAndVarNames := context argAndVarNames.
+
     s nextPutAll:'args: '; cr.
+    self writeContextArgs: context on: s.
 
-    args keysAndValuesDo:[:idx :eachArg |
-        self writeVariable: (argAndVarNames at: idx ifAbsent:['???']) index: idx value: eachArg on: s. 
-    ].
     s nextPutAll:'vars: '; cr.
-    vars keysAndValuesDo:[:idx :eachVar |
-        self writeVariable: (argAndVarNames at: idx + args size ifAbsent:['???']) index: idx value: eachVar on: s. 
-    ].
+    self writeContextVars: context on: s.
+
     s nextPutAll:'inst: '; cr.
     rcvr class allInstVarNames keysAndValuesDo:[ :idx :eachNam |
         self writeVariable: eachNam index: idx value: (rcvr instVarNamed: eachNam) on: s.         
@@ -193,7 +191,48 @@
 
     "Created: / 03-08-2011 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 15-03-2016 / 14:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-06-2020 / 11:00:29 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 02-06-2020 / 11:37:16 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+writeContextArgs: context on: s
+    | current |
+
+    current := context.
+    [ current notNil ] whileTrue:[
+        | args names |
+
+        args := current args.
+        names := current argAndVarNames.
+
+        args keysAndValuesDo:[:idx :eachArg |
+            self writeVariable: (names at: idx ifAbsent:['???']) index: idx value: eachArg on: s. 
+        ].
+        current := current home.
+        current notNil ifTrue:[ s cr ].
+    ]
+
+    "Created: / 02-06-2020 / 11:33:55 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+writeContextVars: context on: s
+    | current |
+
+    current := context.
+    [ current notNil ] whileTrue:[
+        | vars names nargs |
+
+        vars := current vars.
+        names := current argAndVarNames.
+        nargs := current numArgs.
+
+        vars keysAndValuesDo:[:idx :eachArg |
+            self writeVariable: (names at: idx + nargs ifAbsent:['???']) index: idx value: eachArg on: s. 
+        ].
+        current := current home.
+        current notNil ifTrue:[ s cr ].
+    ]
+
+    "Created: / 02-06-2020 / 11:36:29 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 writeStackTrace:err of:aTestCase on: str