The Trunk: Kernel-eem.668.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-eem.668.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.668.mcz

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

Name: Kernel-eem.668
Author: eem
Time: 30 January 2012, 4:07:10.324 pm
UUID: 6d7c03fa-7e34-49ee-af59-08c26564f9ef
Ancestors: Kernel-cmm.667

Rip out the "prevent me debugging myself" primitive 19
from ContextPart>doPrimitive:method:receiver:args:.

=============== Diff against Kernel-cmm.667 ===============

Item was changed:
  ----- Method: ContextPart>>doPrimitive:method:receiver:args: (in category 'private') -----
  doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments
  "Simulate a primitive method whose index is primitiveIndex.  The
  simulated receiver and arguments are given as arguments to this message.
+ If successful, push result and return resuming context, else ^ PrimitiveFailToken.
+ Any primitive which provokes execution needs to be intercepted and simulated
- Any primitive which provikes execution needs to be intercepted and simulated
  to avoid execution running away."
 
  | value |
+ "Judicious use of primitive 19 (a null primitive that doesn't do anything) prevents
+ the debugger from entering various run-away activities such as spawning a new
+ process, etc.  Injudicious use results in the debugger not being able to debug
+ interesting code, such as the debugger itself.  hence use primtiive 19 with care :-)"
+ "SystemNavigation new browseAllSelect: [:m| m primitive = 19]"
+ primitiveIndex = 19 ifTrue:
- <primitive: 19> "Simulation guard"
- "If successful, push result and return resuming context,
- else ^ PrimitiveFailToken"
- (primitiveIndex = 19) ifTrue:
  [ToolSet
  debugContext: self
  label:'Code simulation error'
  contents: nil].
 
  "ContextPart>>blockCopy:; simulated to get startpc right"
  (primitiveIndex = 80 and: [receiver isKindOf: ContextPart])
  ifTrue: [^self push: ((BlockContext newForMethod: receiver method)
  home: receiver home
  startpc: pc + 2
  nargs: (arguments at: 1))].
  (primitiveIndex = 81 and: [receiver isMemberOf: BlockContext]) "BlockContext>>value[:value:...]"
  ifTrue: [^receiver pushArgs: arguments from: self].
  (primitiveIndex = 82 and: [receiver isMemberOf: BlockContext]) "BlockContext>>valueWithArguments:"
  ifTrue: [^receiver pushArgs: arguments first from: self].
  primitiveIndex = 83 "afr 9/11/1998 19:50" "Object>>perform:[with:...]"
  ifTrue: [^self send: arguments first to: receiver
  with: arguments allButFirst
  super: false].
  primitiveIndex = 84 "afr 9/11/1998 19:50" "Object>>perform:withArguments:"
  ifTrue: [^self send: arguments first to: receiver
  with: (arguments at: 2)
  super: false].
  primitiveIndex = 188 ifTrue: [
  arguments size = 2 ifTrue: [ "eem 5/27/2008 11:10 Object>>withArgs:executeMethod:"
  ^MethodContext
  sender: self
  receiver: receiver
  method: (arguments at: 2)
  arguments: (arguments at: 1) ].
  arguments size = 3 ifTrue: [ "CompiledMethod class >> #receiver:withArguments:executeMethod:"
  ^MethodContext
  sender: self
  receiver: (arguments at: 1)
  method: (arguments at: 3)
  arguments: (arguments at: 2) ] ].
  primitiveIndex = 189 ifTrue: [ "Object >> (#with:)*executeMethod"
  ^MethodContext
  sender: self
  receiver: receiver
  method: arguments last
  arguments: arguments allButLast ].
 
  "Closure primitives"
  (primitiveIndex = 200 and: [receiver == self]) ifTrue:
  "ContextPart>>closureCopy:copiedValues:; simulated to get startpc right"
  [^self push: (BlockClosure
  outerContext: receiver
  startpc: pc + 2
  numArgs: arguments first
  copiedValues: arguments last)].
  ((primitiveIndex between: 201 and: 205) "BlockClosure>>value[:value:...]"
  or: [primitiveIndex between: 221 and: 222]) ifTrue: "BlockClosure>>valueNoContextSwitch[:]"
  [^receiver simulateValueWithArguments: arguments caller: self].
  primitiveIndex = 206 ifTrue: "BlockClosure>>valueWithArguments:"
  [^receiver simulateValueWithArguments: arguments first caller: self].
 
  primitiveIndex = 120 ifTrue:[ "FFI method"
  value := meth literals first tryInvokeWithArguments: arguments.
  ] ifFalse:[
  arguments size > 6 ifTrue: [^PrimitiveFailToken].
  value := primitiveIndex = 117 "named primitives"
  ifTrue:[self tryNamedPrimitiveIn: meth for: receiver withArgs: arguments]
  ifFalse:[receiver tryPrimitive: primitiveIndex withArgs: arguments].
  ].
  ^value == PrimitiveFailToken
  ifTrue: [PrimitiveFailToken]
  ifFalse: [self push: value]!