[Pkg] The Trunk: Kernel-nice.811.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 25 21:02:36 UTC 2013


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.811.mcz

==================== Summary ====================

Name: Kernel-nice.811
Author: nice
Time: 25 September 2013, 11:01:08.496 pm
UUID: d8e4e28f-1d3d-49f1-a3d5-51b75f95b99e
Ancestors: Kernel-nice.810

Make squeakDebug.log report length a setting.

=============== Diff against Kernel-nice.810 ===============

Item was changed:
  InstructionStream subclass: #ContextPart
  	instanceVariableNames: 'stackp'
+ 	classVariableNames: 'MaxLengthForASingleDebugLogReport MaxStackDepthForASingleDebugLogReport PrimitiveFailToken QuickStep'
- 	classVariableNames: 'PrimitiveFailToken QuickStep'
  	poolDictionaries: ''
  	category: 'Kernel-Methods'!
  
  !ContextPart commentStamp: '<historical>' prior: 0!
  To the instruction parsing ability of InstructionStream I add the actual semantics for execution. The execution state is stored in the indexable fields of my subclasses. This includes temporary variables and a stack of values used in evaluating expressions. The actual semantics of execution can be found in my category "system simulation" and "instruction decode". These methods exactly parallel the operation of the Smalltalk machine itself.
  	
  The simulator is a group of my methods that do what the Smalltalk interpreter does: execute Smalltalk bytecodes. By adding code to the simulator, you may take statistics on the running of Smalltalk methods. For example,
  	Transcript show: (ContextPart runSimulated: [3 factorial]) printString.!

Item was added:
+ ----- Method: ContextPart class>>maxLengthForASingleDebugLogReport (in category 'preferences') -----
+ maxLengthForASingleDebugLogReport
+ 	<preference: 'Max. Debug Report Length'
+ 		category: 'debug'
+ 		description: 'The description of an Exception stack will be truncated so as to not exceed this value'
+ 		type: #Number>
+ 	^MaxLengthForASingleDebugLogReport ifNil: [40000]!

Item was added:
+ ----- Method: ContextPart class>>maxLengthForASingleDebugLogReport: (in category 'preferences') -----
+ maxLengthForASingleDebugLogReport: anInteger
+ 	MaxLengthForASingleDebugLogReport := anInteger!

Item was added:
+ ----- Method: ContextPart class>>maxStackDepthForASingleDebugLogReport (in category 'preferences') -----
+ maxStackDepthForASingleDebugLogReport
+ 	<preference: 'Max. Debug Report Stack Depth'
+ 		category: 'debug'
+ 		description: 'In an exception stack, any sender deeper than this value will not be logged.'
+ 		type: #Number>
+ 	^MaxStackDepthForASingleDebugLogReport ifNil: [60]!

Item was added:
+ ----- Method: ContextPart class>>maxStackDepthForASingleDebugLogReport: (in category 'preferences') -----
+ maxStackDepthForASingleDebugLogReport: anInteger
+ 	MaxStackDepthForASingleDebugLogReport := anInteger!

Item was changed:
  ----- Method: ContextPart>>errorReportOn: (in category 'debugger access') -----
  errorReportOn: strm
  	"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."
  
  	| cnt aContext startPos |
   	strm print: Date today; space; print: Time now; cr.
  	strm cr.
  	strm nextPutAll: 'VM: ';
  		nextPutAll:  Smalltalk platformName asString;
  		nextPutAll: ' - ';
  		nextPutAll: Smalltalk asString;
  		cr.
  	strm nextPutAll: 'Image: ';
  		nextPutAll:  SystemVersion current version asString;
  		nextPutAll: ' [';
  		nextPutAll: Smalltalk lastUpdateString asString;
  		nextPutAll: ']';
  		cr.
  	strm cr.
  	SecurityManager default printStateOn: strm.
  	
  	"Note: The following is an open-coded version of ContextPart>>stackOfSize: since this method may be called during a low space condition and we might run out of space for allocating the full stack."
  	cnt := 0.  startPos := strm position.
  	aContext := self.
  	[aContext notNil and: [(cnt := cnt + 1) < 20]] whileTrue:
  		[aContext printDetails: strm.	"variable values"
  		strm cr.
  		aContext := aContext sender].
  
  	strm cr; nextPutAll: '--- The full stack ---'; cr.
  	aContext := self.
  	cnt := 0.
  	[aContext == nil] whileFalse:
  		[cnt := cnt + 1.
  		cnt = 20 ifTrue: [strm nextPutAll: ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'; cr].
  		strm print: aContext; cr.  "just class>>selector"	
  
+ 		"exit early if too long..."
+ 		strm position > (startPos+ self class maxLengthForASingleDebugLogReport) ifTrue: [strm nextPutAll: '...etc...'.	^ self]. 		cnt > self class maxStackDepthForASingleDebugLogReport ifTrue: [strm nextPutAll: '-- and more not shown --'.	^ self].
- 		strm position > (startPos+40000) ifTrue: [strm nextPutAll: '...etc...'.
- 			^ self]. 	"exit early"
- 		cnt > 60 ifTrue: [strm nextPutAll: '-- and more not shown --'.  ^ self].
  		aContext := aContext sender].
  !



More information about the Packages mailing list