Skip to content

Commit

Permalink
[feenkcom/gtoolkit#4254] Include the GT image version number in Pharo…
Browse files Browse the repository at this point in the history
…Debug.log
  • Loading branch information
akgrant43 committed Dec 19, 2024
1 parent 89275bb commit 9a21ade
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/GToolkit-Utility-System/Context.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
Extension { #name : #Context }

{ #category : #'*GToolkit-Utility-System' }
Context >> errorReportOn: stream [
"Write a detailed error report on the stack (above me) on a
stream. For both the error file, and emailing a bug report.
Suppress any errors while getting printStrings. Limit the length."
| stackDepth aContext maxDetailedStackDepth maxFullStackDepth|

stream print: Date today; space; print: Time now; cr.
stream cr.
stream nextPutAll: 'VM: ';
nextPutAll: Smalltalk os name asString;
nextPutAll: ' - ';
nextPutAll: Smalltalk os subtype asString;
nextPutAll: ' - ';
nextPutAll: Smalltalk os version asString;
nextPutAll: ' - ';
nextPutAll: Smalltalk vm version asString;
cr.
stream nextPutAll: 'GT Image: ';
nextPutAll: GtImage version versionString;
cr.
stream nextPutAll: 'Pharo Image: ';
nextPutAll: SystemVersion current version asString;
nextPutAll: ' [';
nextPutAll: Smalltalk lastUpdateString asString;
nextPutAll: ']';
cr.
stream cr.
"Note: The following is an open-coded version of Context>>stackOfSize: since this method may be called during a low space condition and we might run out of space for allocating the full stack."
stackDepth := 0.
aContext := self.
maxDetailedStackDepth := 80.
maxFullStackDepth := 400.
[ aContext notNil and: [ (stackDepth := stackDepth + 1) < maxDetailedStackDepth ]]
whileTrue: [
"variable values"
aContext printDetails: stream.
stream cr.
aContext := aContext sender ].
stream cr; nextPutAll: '--- The full stack ---'; cr.
aContext := self.
stackDepth := 0.
[ aContext == nil ] whileFalse: [
stackDepth := stackDepth + 1.
stackDepth = maxDetailedStackDepth ifTrue: [ stream nextPutAll: ' - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -'; cr ].
"just class>>selector"
stream print: aContext; cr.
stackDepth > maxFullStackDepth ifTrue: [
stream nextPutAll: '-- and more not shown --'.
^ self ].
aContext := aContext sender ]
]

{ #category : #'*GToolkit-Utility-System' }
Context >> message [
"Answer the receiver's selector and arguments as a Message"
Expand Down

0 comments on commit 9a21ade

Please sign in to comment.