# HG changeset patch # User Jan Vrany # Date 1453110082 0 # Node ID 4c26321be573d2f0b68060e9dc2001d5e91d5ffa # Parent 4dd4d4b67e42a3f262fb7ffe4b35028794111e23 Test report: show also a bytecode for each method on the stack ...if available. This is a (temporary) measure debug some strange failing stx:libjava tests where a funny native implementation is called. diff -r 4dd4d4b67e42 -r 4c26321be573 reports/Builder__TestReportFormat.st --- a/reports/Builder__TestReportFormat.st Mon Jan 18 09:39:21 2016 +0000 +++ b/reports/Builder__TestReportFormat.st Mon Jan 18 09:41:22 2016 +0000 @@ -97,19 +97,24 @@ writeContext: context on: s - |home mthd src| + |home mthd src vars args argAndVarNames | [ context printOn: s. s cr. s nextPutAll:'receiver: '. context receiver printOn: s. s cr. - s nextPutAll:'selector: '. context selector printOn: s. s cr. + s nextPutAll:'selector: '. context selector storeOn: s. s cr. + + args := context args. + vars := context vars. + argAndVarNames := context argAndVarNames. s nextPutAll:'args: '; cr. - context args keysAndValuesDo:[:idx :eachArg | - s nextPutAll:' '. idx printOn: s. s nextPutAll:': '. eachArg printOn: s.s cr. + + args keysAndValuesDo:[:idx :eachArg | + s nextPutAll:' '. idx printOn: s leftPaddedTo:2 . s space. (argAndVarNames at: idx ifAbsent:['']) printOn: s paddedTo:12. s nextPutAll:': '. eachArg printOn: s.s cr. ]. s nextPutAll:'vars: '; cr. - context vars keysAndValuesDo:[:idx :eachVar | - s nextPutAll:' '. idx printOn: s. s nextPutAll:': '. + vars keysAndValuesDo:[:idx :eachVar | + s nextPutAll:' '. idx printOn: s leftPaddedTo:2. s space. (argAndVarNames at: idx + args size ifAbsent:['']) printOn: s paddedTo:12. s nextPutAll:': '. eachVar isString ifTrue:[ eachVar storeOn: s. ] ifFalse:[ @@ -117,11 +122,25 @@ ]. s cr. ]. + home := context methodHome. + mthd := home method. + + s nextPutAll:'bytecode: '; cr. + mthd notNil ifTrue:[ + (mthd isJavaMethod and:[mthd class ~~ JavaNativeMethod]) ifFalse:[ + Decompiler decompile: mthd to: s. + ] ifTrue:[ + (Smalltalk at: #JavaByteCodeDisassembler) notNil ifTrue:[ + (Smalltalk at: #JavaByteCodeDisassembler) diassemble: mthd to: s. + ] ifFalse:[ + s nextPutAll: ' ** no JavaByteCodeDisassembler **' + ]. + ]. + ]. + + s cr. s nextPutAll:'source: '; cr. - [ - home := context methodHome. - mthd := home method. mthd isNil ifTrue:[ s nextPutAll: '** no source **'. s cr. s cr. ^ self. @@ -153,9 +172,14 @@ s cr; nextPutAll:'!!!!!!ERROR WHEN GETTING STACK TRACE!!!!!!'; cr; nextPutAll: ex description; cr - ] + ]. + + " + String streamContents:[ :s | Builder::TestReportFormat basicNew writeContext: thisContext on: s ] + " "Created: / 03-08-2011 / 14:53:52 / Jan Vrany " + "Modified: / 18-01-2016 / 08:12:56 / Jan Vrany " ! writeStackTrace:err of:aTestCase on: str @@ -701,6 +725,11 @@ ^ '$Header$' ! +version_HG + + ^ '$Changeset: $' +! + version_SVN ^ '$Id$' ! !