From 18b9e5b79f53cbbb46cc7fc94c0034594ddfd8da Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Thu, 16 May 2024 20:25:50 +0200 Subject: [PATCH] Cleanup: do not use #notNil, use #isNotNil instead Fix #95 --- .../SindarinDebugSessionTest.class.st | 2 +- .../SindarinDebuggerTest.class.st | 7 +- src/Sindarin/Context.extension.st | 4 +- src/Sindarin/DebugSession.extension.st | 8 +- .../DebuggedExecutionException.class.st | 10 +- .../DebuggedExecutionIsFinished.class.st | 8 +- src/Sindarin/InstructionStream.extension.st | 12 +- src/Sindarin/NodeNotInASTError.class.st | 8 +- src/Sindarin/NotValidPcError.class.st | 8 +- .../OCBytecodeToASTCache.extension.st | 4 +- src/Sindarin/Object.extension.st | 4 +- src/Sindarin/Process.extension.st | 4 +- src/Sindarin/RBAssignmentNode.extension.st | 4 +- ...RBBlockDefinitionSearchingVisitor.class.st | 18 +-- src/Sindarin/RBBlockNode.extension.st | 12 +- src/Sindarin/RBMessageNode.extension.st | 4 +- src/Sindarin/RBMethodNode.extension.st | 12 +- src/Sindarin/RBProgramNode.extension.st | 6 +- src/Sindarin/RBReturnNode.extension.st | 4 +- src/Sindarin/SindarinDebugSession.class.st | 38 +++--- src/Sindarin/SindarinDebugger.class.st | 110 +++++++++--------- .../SindarinSkippingReturnWarning.class.st | 8 +- .../SteppingATerminatingProcess.class.st | 8 +- src/Sindarin/TSindarin.trait.st | 80 ++++++------- ...tionSignalledByADebuggedExecution.class.st | 14 ++- src/Sindarin/package.st | 2 +- 26 files changed, 210 insertions(+), 189 deletions(-) diff --git a/src/Sindarin-Tests/SindarinDebugSessionTest.class.st b/src/Sindarin-Tests/SindarinDebugSessionTest.class.st index b3d6381..5fc4087 100644 --- a/src/Sindarin-Tests/SindarinDebugSessionTest.class.st +++ b/src/Sindarin-Tests/SindarinDebugSessionTest.class.st @@ -42,7 +42,7 @@ SindarinDebugSessionTest >> testSindarinSessionInstantiation [ sindarinSession := SindarinDebugSession newWithName: sessionName forProcess: process. - self assert: sindarinSession debugSession notNil. + self assert: sindarinSession debugSession isNotNil. self assert: sindarinSession debugSession name equals: sessionName. self assert: sindarinSession debugSession process diff --git a/src/Sindarin-Tests/SindarinDebuggerTest.class.st b/src/Sindarin-Tests/SindarinDebuggerTest.class.st index 1f08e6e..6628f7e 100644 --- a/src/Sindarin-Tests/SindarinDebuggerTest.class.st +++ b/src/Sindarin-Tests/SindarinDebuggerTest.class.st @@ -136,7 +136,6 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeI ^ a * 42 ] - { #category : 'helpers' } SindarinDebuggerTest >> methodWithOneAssignment [ @@ -1399,7 +1398,7 @@ SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [ self assert: scdbg node value value equals: 2 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [ | scdbg nodeWithImplicitReturn | @@ -2041,8 +2040,8 @@ SindarinDebuggerTest >> testTemporaryNamed [ SindarinDebuggerTest >> testTerminate [ | dbg | dbg := SindarinDebugger debug: [ self helperMethod13 ]. - self assert: dbg debugSession interruptedContext notNil. - self assert: dbg debugSession interruptedProcess notNil. + self assert: dbg debugSession interruptedContext isNotNil. + self assert: dbg debugSession interruptedProcess isNotNil. dbg terminate. self assert: dbg debugSession interruptedContext isNil. self assert: dbg debugSession interruptedProcess isNil. diff --git a/src/Sindarin/Context.extension.st b/src/Sindarin/Context.extension.st index 5621831..90235f2 100644 --- a/src/Sindarin/Context.extension.st +++ b/src/Sindarin/Context.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Context } +Extension { #name : 'Context' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } Context >> stepToSendOrReturnOrJump [ "Simulate the execution of bytecodes until either sending a message or diff --git a/src/Sindarin/DebugSession.extension.st b/src/Sindarin/DebugSession.extension.st index 31496ee..53cfe74 100644 --- a/src/Sindarin/DebugSession.extension.st +++ b/src/Sindarin/DebugSession.extension.st @@ -1,11 +1,11 @@ -Extension { #name : #DebugSession } +Extension { #name : 'DebugSession' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } DebugSession >> asSindarinDebugSession [ ^ SindarinDebugSession new debugSession: self ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } DebugSession >> stepToFirstInterestingBytecodeWithJumpIn: aProcess [ "After a restart of a method activation step to the first bytecode instruction that is of interest for the debugger. @@ -24,7 +24,7 @@ DebugSession >> stepToFirstInterestingBytecodeWithJumpIn: aProcess [ ^ aProcess stepToSendOrReturnOrJump ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } DebugSession >> suspendedContext: aContext [ interruptedContext := aContext diff --git a/src/Sindarin/DebuggedExecutionException.class.st b/src/Sindarin/DebuggedExecutionException.class.st index b16d5a8..2549680 100644 --- a/src/Sindarin/DebuggedExecutionException.class.st +++ b/src/Sindarin/DebuggedExecutionException.class.st @@ -1,10 +1,12 @@ Class { - #name : #DebuggedExecutionException, - #superclass : #Error, - #category : #'Sindarin-Exceptions' + #name : 'DebuggedExecutionException', + #superclass : 'Error', + #category : 'Sindarin-Exceptions', + #package : 'Sindarin', + #tag : 'Exceptions' } -{ #category : #testing } +{ #category : 'testing' } DebuggedExecutionException >> isExceptionSignalledForDebuggedExecution [ ^ true ] diff --git a/src/Sindarin/DebuggedExecutionIsFinished.class.st b/src/Sindarin/DebuggedExecutionIsFinished.class.st index 41e4090..b652f67 100644 --- a/src/Sindarin/DebuggedExecutionIsFinished.class.st +++ b/src/Sindarin/DebuggedExecutionIsFinished.class.st @@ -1,5 +1,7 @@ Class { - #name : #DebuggedExecutionIsFinished, - #superclass : #DebuggedExecutionException, - #category : #'Sindarin-Exceptions' + #name : 'DebuggedExecutionIsFinished', + #superclass : 'DebuggedExecutionException', + #category : 'Sindarin-Exceptions', + #package : 'Sindarin', + #tag : 'Exceptions' } diff --git a/src/Sindarin/InstructionStream.extension.st b/src/Sindarin/InstructionStream.extension.st index 6639356..5e8b26f 100644 --- a/src/Sindarin/InstructionStream.extension.st +++ b/src/Sindarin/InstructionStream.extension.st @@ -1,27 +1,27 @@ -Extension { #name : #InstructionStream } +Extension { #name : 'InstructionStream' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } InstructionStream >> willJump [ "Answer whether the next bytecode will jump." ^ self willJumpIfFalse or:[ self willJumpIfTrue or: [ self willJumpTo ] ] ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } InstructionStream >> willJumpIfTrue [ "Answer whether the next bytecode is a jump-if-false." ^ self method encoderClass isBranchIfTrueAt: pc in: self method ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } InstructionStream >> willJumpTo [ "Answer whether the next bytecode is a jump-if-false." ^ self method encoderClass isJumpAt: pc in: self method ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } InstructionStream >> willSendOrReturnOrStoreOrCreateBlock [ "Answer whether the next bytecode will be interesting for the debugger to stop." @@ -30,7 +30,7 @@ InstructionStream >> willSendOrReturnOrStoreOrCreateBlock [ self willReturn or: [ self willStore or: [ self willCreateBlock ] ] ] ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } InstructionStream >> willStoreButNotPop [ "Answer whether the next bytecode is a store that are not store-pop" diff --git a/src/Sindarin/NodeNotInASTError.class.st b/src/Sindarin/NodeNotInASTError.class.st index e10cd45..bddf0c8 100644 --- a/src/Sindarin/NodeNotInASTError.class.st +++ b/src/Sindarin/NodeNotInASTError.class.st @@ -2,7 +2,9 @@ I am signaled when we try to move the execution to a node that is not in the home context's method ast. " Class { - #name : #NodeNotInASTError, - #superclass : #Error, - #category : #'Sindarin-Exceptions' + #name : 'NodeNotInASTError', + #superclass : 'Error', + #category : 'Sindarin-Exceptions', + #package : 'Sindarin', + #tag : 'Exceptions' } diff --git a/src/Sindarin/NotValidPcError.class.st b/src/Sindarin/NotValidPcError.class.st index 643a4f6..8652c16 100644 --- a/src/Sindarin/NotValidPcError.class.st +++ b/src/Sindarin/NotValidPcError.class.st @@ -2,7 +2,9 @@ I am signaled when I try to modify the execution of a context to get to an invalid PC (lower than the method initalPC or greater than the method endPC) " Class { - #name : #NotValidPcError, - #superclass : #Error, - #category : #'Sindarin-Exceptions' + #name : 'NotValidPcError', + #superclass : 'Error', + #category : 'Sindarin-Exceptions', + #package : 'Sindarin', + #tag : 'Exceptions' } diff --git a/src/Sindarin/OCBytecodeToASTCache.extension.st b/src/Sindarin/OCBytecodeToASTCache.extension.st index 534915d..7257bab 100644 --- a/src/Sindarin/OCBytecodeToASTCache.extension.st +++ b/src/Sindarin/OCBytecodeToASTCache.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #OCBytecodeToASTCache } +Extension { #name : 'OCBytecodeToASTCache' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } OCBytecodeToASTCache >> firstRecursiveBcOffsetForStatementNode: aStatementNode [ ^ self methodOrBlockNode bcToASTCache bcToASTMap keys sorted detect: [ diff --git a/src/Sindarin/Object.extension.st b/src/Sindarin/Object.extension.st index 6ca8095..d0b1b50 100644 --- a/src/Sindarin/Object.extension.st +++ b/src/Sindarin/Object.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Object } +Extension { #name : 'Object' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } Object >> isExceptionSignalledForDebuggedExecution [ ^ false ] diff --git a/src/Sindarin/Process.extension.st b/src/Sindarin/Process.extension.st index eb3b21f..b52c6e4 100644 --- a/src/Sindarin/Process.extension.st +++ b/src/Sindarin/Process.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #Process } +Extension { #name : 'Process' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } Process >> stepToSendOrReturnOrJump [ ^Processor activeProcess diff --git a/src/Sindarin/RBAssignmentNode.extension.st b/src/Sindarin/RBAssignmentNode.extension.st index 6878bcd..faa0dc9 100644 --- a/src/Sindarin/RBAssignmentNode.extension.st +++ b/src/Sindarin/RBAssignmentNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBAssignmentNode } +Extension { #name : 'RBAssignmentNode' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBAssignmentNode >> skipWithDebugger: aSindarinDebugger [ aSindarinDebugger skipAssignmentNodeCompletely diff --git a/src/Sindarin/RBBlockDefinitionSearchingVisitor.class.st b/src/Sindarin/RBBlockDefinitionSearchingVisitor.class.st index 7ae0a94..e94aa95 100644 --- a/src/Sindarin/RBBlockDefinitionSearchingVisitor.class.st +++ b/src/Sindarin/RBBlockDefinitionSearchingVisitor.class.st @@ -1,14 +1,16 @@ Class { - #name : #RBBlockDefinitionSearchingVisitor, - #superclass : #RBProgramNodeVisitor, + #name : 'RBBlockDefinitionSearchingVisitor', + #superclass : 'RBProgramNodeVisitor', #instVars : [ 'blockToSearch', 'isBlockFound' ], - #category : #'Sindarin-Base' + #category : 'Sindarin-Base', + #package : 'Sindarin', + #tag : 'Base' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } RBBlockDefinitionSearchingVisitor class >> newToSearch: aBlockNode [ ^ self new @@ -16,26 +18,26 @@ RBBlockDefinitionSearchingVisitor class >> newToSearch: aBlockNode [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } RBBlockDefinitionSearchingVisitor >> blockToSearch: aBlockNode [ blockToSearch := aBlockNode. isBlockFound := false ] -{ #category : #initialization } +{ #category : 'initialization' } RBBlockDefinitionSearchingVisitor >> initialize [ isBlockFound := false ] -{ #category : #accessing } +{ #category : 'accessing' } RBBlockDefinitionSearchingVisitor >> isBlockFound [ ^ isBlockFound ] -{ #category : #visiting } +{ #category : 'visiting' } RBBlockDefinitionSearchingVisitor >> visitNode: aNode [ super visitNode: aNode. diff --git a/src/Sindarin/RBBlockNode.extension.st b/src/Sindarin/RBBlockNode.extension.st index fdd3133..c386df0 100644 --- a/src/Sindarin/RBBlockNode.extension.st +++ b/src/Sindarin/RBBlockNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBBlockNode } +Extension { #name : 'RBBlockNode' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBBlockNode >> executedNodesAfter: aNode [ "Gives all nodes that are executed after aNode. Assuming that aNode is a recursive child, then all nodes executed after it are all nodes after it in allChildrenPostOrder" @@ -13,13 +13,13 @@ RBBlockNode >> executedNodesAfter: aNode [ ^ nodesAfter ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBBlockNode >> firstPCOfStatement: aStatementNode [ ^ self bcToASTCache firstRecursiveBcOffsetForStatementNode: aStatementNode ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBBlockNode >> nextExecutedNodeAfter: aNode [ "Find first node that is after aNode that has an associated pc in method node all children (post-order)" @@ -31,7 +31,7 @@ RBBlockNode >> nextExecutedNodeAfter: aNode [ ^ nodesAfter at: indexOfNextNode ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBBlockNode >> parentOfIdenticalSubtree: subtree [ ^ self allChildren reversed @@ -40,7 +40,7 @@ RBBlockNode >> parentOfIdenticalSubtree: subtree [ ifNone: [ nil ] ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBBlockNode >> skipWithDebugger: aSindarinDebugger [ aSindarinDebugger skipBlockNode diff --git a/src/Sindarin/RBMessageNode.extension.st b/src/Sindarin/RBMessageNode.extension.st index 20711a9..85adff8 100644 --- a/src/Sindarin/RBMessageNode.extension.st +++ b/src/Sindarin/RBMessageNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBMessageNode } +Extension { #name : 'RBMessageNode' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBMessageNode >> skipWithDebugger: aSindarinDebugger [ aSindarinDebugger skipMessageNode diff --git a/src/Sindarin/RBMethodNode.extension.st b/src/Sindarin/RBMethodNode.extension.st index 789a1d9..ab20951 100644 --- a/src/Sindarin/RBMethodNode.extension.st +++ b/src/Sindarin/RBMethodNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBMethodNode } +Extension { #name : 'RBMethodNode' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBMethodNode >> executedNodesAfter: aNode [ "Gives all nodes that are executed after aNode. Assuming that aNode is a recursive child, then all nodes executed after it are all nodes after it in allChildrenPostOrder" @@ -13,13 +13,13 @@ RBMethodNode >> executedNodesAfter: aNode [ ^ nodesAfter ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBMethodNode >> firstPCOfStatement: aStatementNode [ ^ self bcToASTCache firstRecursiveBcOffsetForStatementNode: aStatementNode ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBMethodNode >> nextExecutedNodeAfter: aNode [ "Find first node that is after aNode that has an associated pc in method node all children (post-order)" @@ -31,7 +31,7 @@ RBMethodNode >> nextExecutedNodeAfter: aNode [ ^ nodesAfter at: indexOfNextNode ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBMethodNode >> parentOfIdenticalSubtree: subtree [ ^ self allChildren reversed @@ -40,7 +40,7 @@ RBMethodNode >> parentOfIdenticalSubtree: subtree [ ifNone: [ nil ] ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBMethodNode >> statementNodeContaining: aNode [ | statementNode parentOfStatementNode | diff --git a/src/Sindarin/RBProgramNode.extension.st b/src/Sindarin/RBProgramNode.extension.st index 2887116..719379d 100644 --- a/src/Sindarin/RBProgramNode.extension.st +++ b/src/Sindarin/RBProgramNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBProgramNode } +Extension { #name : 'RBProgramNode' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBProgramNode >> allChildrenPostOrder [ | children | @@ -11,7 +11,7 @@ RBProgramNode >> allChildrenPostOrder [ ^ children ] -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBProgramNode >> skipWithDebugger: aSindarinDebugger [ aSindarinDebugger step diff --git a/src/Sindarin/RBReturnNode.extension.st b/src/Sindarin/RBReturnNode.extension.st index e9ffb01..f5f04c1 100644 --- a/src/Sindarin/RBReturnNode.extension.st +++ b/src/Sindarin/RBReturnNode.extension.st @@ -1,6 +1,6 @@ -Extension { #name : #RBReturnNode } +Extension { #name : 'RBReturnNode' } -{ #category : #'*Sindarin' } +{ #category : '*Sindarin' } RBReturnNode >> skipWithDebugger: aSindarinDebugger [ aSindarinDebugger skipReturnNode diff --git a/src/Sindarin/SindarinDebugSession.class.st b/src/Sindarin/SindarinDebugSession.class.st index a585445..15851d9 100644 --- a/src/Sindarin/SindarinDebugSession.class.st +++ b/src/Sindarin/SindarinDebugSession.class.st @@ -4,17 +4,19 @@ stepRecord: StepRecord StepRecords: LinkedList[StepRecord] " Class { - #name : #SindarinDebugSession, - #superclass : #Object, + #name : 'SindarinDebugSession', + #superclass : 'Object', #instVars : [ 'triggerEventOn', 'canBeTerminated', 'debugSession' ], - #category : #'Sindarin-Core' + #category : 'Sindarin-Core', + #package : 'Sindarin', + #tag : 'Core' } -{ #category : #'instance creation' } +{ #category : 'instance creation' } SindarinDebugSession class >> newWithName: aString forProcess: aProcess [ ^ DebugSession new @@ -23,50 +25,50 @@ SindarinDebugSession class >> newWithName: aString forProcess: aProcess [ asSindarinDebugSession ] -{ #category : #initialization } +{ #category : 'initialization' } SindarinDebugSession >> activateEventTriggering [ triggerEventOn := true. self flag: 'Why not refreshing?'. "self refreshAttachedDebugger." ] -{ #category : #converting } +{ #category : 'converting' } SindarinDebugSession >> asSindarinDebugSession [ ^ self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSession >> canBeTerminated [ ^ canBeTerminated ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSession >> canBeTerminated: anObject [ canBeTerminated := anObject ] -{ #category : #initialization } +{ #category : 'initialization' } SindarinDebugSession >> deactivateEventTriggering [ triggerEventOn := false ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSession >> debugSession [ ^ debugSession ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSession >> debugSession: anObject [ debugSession := anObject ] -{ #category : #initialization } +{ #category : 'initialization' } SindarinDebugSession >> initialize [ super initialize. @@ -74,14 +76,14 @@ SindarinDebugSession >> initialize [ canBeTerminated := true ] -{ #category : #initialization } +{ #category : 'initialization' } SindarinDebugSession >> refreshAttachedDebugger [ "The following lines are to force possible debuggers observing the same debug session to update themselves based" self debugSession triggerEvent: #contextChanged ] -{ #category : #'debugging actions' } +{ #category : 'debugging actions' } SindarinDebugSession >> resumeAndClear [ self debugSession @@ -89,7 +91,7 @@ SindarinDebugSession >> resumeAndClear [ clear ] -{ #category : #'debugging actions' } +{ #category : 'debugging actions' } SindarinDebugSession >> stepInto: aContext [ "Should not step more a process that is terminating, otherwise the image will get locked." self flag: 'Why the image gets locked? Please investigate.'. @@ -99,7 +101,7 @@ SindarinDebugSession >> stepInto: aContext [ ^ self debugSession stepInto: aContext ] -{ #category : #'debugging actions' } +{ #category : 'debugging actions' } SindarinDebugSession >> stepOver: aContext [ "Should not step more a process that is terminating, otherwise the image will get locked." self flag: 'Why the image gets locked? Please investigate.'. @@ -109,13 +111,13 @@ SindarinDebugSession >> stepOver: aContext [ ^ self debugSession stepOver: aContext ] -{ #category : #'debugging actions' } +{ #category : 'debugging actions' } SindarinDebugSession >> terminate [ canBeTerminated ifTrue: [ ^ self debugSession terminate ] ] -{ #category : #'debugging actions' } +{ #category : 'debugging actions' } SindarinDebugSession >> triggerEvent: anEventSelector [ triggerEventOn ifTrue: [ diff --git a/src/Sindarin/SindarinDebugger.class.st b/src/Sindarin/SindarinDebugger.class.st index 1468921..a3a5733 100644 --- a/src/Sindarin/SindarinDebugger.class.st +++ b/src/Sindarin/SindarinDebugger.class.st @@ -15,14 +15,16 @@ Virtual breakpoints were introduced because due to technical limitations, normal - stepHooks: OrderedCollection. A list of blocks to be evaluated after each step of the debugged execution " Class { - #name : #SindarinDebugger, - #superclass : #Object, + #name : 'SindarinDebugger', + #superclass : 'Object', #traits : 'TDebugger + TSindarin', #classTraits : 'TDebugger classTrait + TSindarin classTrait', - #category : #'Sindarin-Base' + #category : 'Sindarin-Base', + #package : 'Sindarin', + #tag : 'Base' } -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> assignmentValue [ "Returns the value about to be assigned, if the current node is an assignment node. Otherwise, returns nil" self flag: 'Why there is no error raised here, while for the case of message sends there is an error?'. @@ -31,7 +33,7 @@ SindarinDebugger >> assignmentValue [ ^ self context at: self currentContextStackSize ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> assignmentVariableName [ "Returns the variable name about to be assigned to, if the current node is an assignment node. Otherwise, returns nil" self flag: 'Why there is no error raised in the case of assignemnts, while there is one for message sends?'. @@ -40,13 +42,13 @@ SindarinDebugger >> assignmentVariableName [ ^ self node variable name ] -{ #category : #astAndAstMapping } +{ #category : 'astAndAstMapping' } SindarinDebugger >> bestNodeFor: anInterval [ ^ self node methodNode bestNodeFor: anInterval ] -{ #category : #'ast manipulation' } +{ #category : 'ast manipulation' } SindarinDebugger >> canStillExecute: aProgramNode [ "returns true if the last pc mapped to aProgramNode is greater than `self pc` in the right context " @@ -64,7 +66,7 @@ SindarinDebugger >> canStillExecute: aProgramNode [ ^ rightContext pc < lastPcForNode ] -{ #category : #'execution predicates' } +{ #category : 'execution predicates' } SindarinDebugger >> contextIsAboutToSignalException: aContext [ "Returns whether aContext is about to execute a message-send of selector #signal to an instance of the Exception class (or one of its subclasses)" @@ -79,7 +81,7 @@ SindarinDebugger >> contextIsAboutToSignalException: aContext [ ] -{ #category : #'stepping - auto' } +{ #category : 'stepping - auto' } SindarinDebugger >> continue [ "Steps the execution until it: - is about to signal an exception. @@ -89,13 +91,13 @@ SindarinDebugger >> continue [ whileFalse: [ self step ] ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugger >> firstPCOfStatement: aStatementNode [ ^ self methodNode firstPCOfStatement: aStatementNode ] -{ #category : #'execution predicates' } +{ #category : 'execution predicates' } SindarinDebugger >> hasSignalledUnhandledException [ "Returns true if the debugged execution has signalled an exception that has not been handled by any on:do: (i.e. the #defaultAction of the exception is about to be executed. This default action typically leads to opening a debugger on the process that signalled the exception)" @@ -103,25 +105,25 @@ SindarinDebugger >> hasSignalledUnhandledException [ self receiver isKindOf: Exception ] ] -{ #category : #'execution predicates' } +{ #category : 'execution predicates' } SindarinDebugger >> isAboutToInstantiateClass [ | methodAboutToExecute | self isMessageSend ifFalse: [ ^ false ]. methodAboutToExecute := self receiver class lookupSelector: self node selector. - ^ methodAboutToExecute notNil and: [ + ^ methodAboutToExecute isNotNil and: [ self instanceCreationPrimitives includes: methodAboutToExecute primitive ] ] -{ #category : #'execution predicates' } +{ #category : 'execution predicates' } SindarinDebugger >> isAboutToSignalException [ ^ self contextIsAboutToSignalException: self context ] -{ #category : #'API - changes' } +{ #category : 'API - changes' } SindarinDebugger >> jumpIntoBlock: aBlockNode toNode: targetNode [ "Moves to targetNode that must be in aBlockNode, which should be a recursive child" @@ -139,21 +141,21 @@ SindarinDebugger >> jumpIntoBlock: aBlockNode toNode: targetNode [ ^ self moveToNode: targetNode ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> message: aSelector [ "Returns whether the execution is about to send a message of selector @aSelector to any object" ^ self isMessageSend and: [ self messageSelector = aSelector ] ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> message: aSelector to: anObject [ "Returns whether the execution is about to send a message of selector @aSelector to @anObject" ^ (self message: aSelector) and: [ self messageReceiver == anObject ] ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> message: aSelector toInstanceOf: aClass [ "Returns whether the execution is about to send a message of selector @aSelector to an instance of class @aClass" @@ -164,7 +166,7 @@ SindarinDebugger >> message: aSelector toInstanceOf: aClass [ ^ self messageReceiver isKindOf: aClass ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> messageArguments [ "Returns the arguments of the message about to be sent, if the current node is a message node." @@ -181,7 +183,7 @@ SindarinDebugger >> messageArguments [ ^ arguments ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> messageReceiver [ "Returns the receiver of the message about to be sent, if the current node is a message node." @@ -191,7 +193,7 @@ SindarinDebugger >> messageReceiver [ at: self currentContextStackSize - self node arguments size ] -{ #category : #stackAccessHelpers } +{ #category : 'stackAccessHelpers' } SindarinDebugger >> messageSelector [ "Returns the selector of the message about to be sent, if the current node is a message node." @@ -200,7 +202,7 @@ SindarinDebugger >> messageSelector [ ^ self node selector ] -{ #category : #'API - changes' } +{ #category : 'API - changes' } SindarinDebugger >> moveToNode: aNode [ "Allows to jump to the first bytecode offset associated to aNode, as long as aNode is in the same lexical context as the suspended context" @@ -228,20 +230,20 @@ SindarinDebugger >> moveToNode: aNode [ self pc: firstPCForNode ] -{ #category : #'accessing - bytes' } +{ #category : 'accessing - bytes' } SindarinDebugger >> nextBytecode [ ^ self symbolicBytecodesForCurrent detect: [ :each | each offset = self pc ] ] -{ #category : #'API - changes' } +{ #category : 'API - changes' } SindarinDebugger >> nextExecutedNodeAfter: aNode [ ^ self methodNode nextExecutedNodeAfter: aNode ] -{ #category : #'API - changes' } +{ #category : 'API - changes' } SindarinDebugger >> pc: anInteger [ "Allows to move to the first PC associated to the node to which anInteger is associated. anInteger must be a valid pc in the suspended context" @@ -271,14 +273,14 @@ SindarinDebugger >> pc: anInteger [ self skipUpToNode: nextNode ] -{ #category : #'stepping - auto' } +{ #category : 'stepping - auto' } SindarinDebugger >> proceed [ "alias of #continue" ^ self continue ] -{ #category : #asserting } +{ #category : 'asserting' } SindarinDebugger >> shouldStepIntoInMethod: aRBMethodNode [ "used by #stpeToReturn to know if it should stepInto or stepOver. It should stepInto to get to non-local returns" @@ -301,7 +303,7 @@ SindarinDebugger >> shouldStepIntoInMethod: aRBMethodNode [ aRBMethodNode ] ] -{ #category : #private } +{ #category : 'private' } SindarinDebugger >> signalExceptionIfDebuggedExecutionHasSignalledUnhandledException [ | unhandledException | @@ -321,7 +323,7 @@ SindarinDebugger >> signalExceptionIfDebuggedExecutionHasSignalledUnhandledExcep signalWithException: unhandledException ]" ] -{ #category : #private } +{ #category : 'private' } SindarinDebugger >> signalExceptionIfDebuggedExecutionIsFinished [ "Signals an DebuggedExecutionIsFinished exception if the debugged execution is finished" @@ -329,7 +331,7 @@ SindarinDebugger >> signalExceptionIfDebuggedExecutionIsFinished [ DebuggedExecutionIsFinished signal ] ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skip [ | instructionStream | @@ -343,7 +345,7 @@ SindarinDebugger >> skip [ self node skipWithDebugger: self ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipAssignmentNodeCompletely [ "Pop the value that will be assigned" @@ -361,7 +363,7 @@ SindarinDebugger >> skipAssignmentNodeCompletely [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipAssignmentNodeWith: replacementValue [ "Pop the value to be assigned" @@ -375,7 +377,7 @@ SindarinDebugger >> skipAssignmentNodeWith: replacementValue [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipBlockNode [ self skipPcToNextBytecode. @@ -386,7 +388,7 @@ SindarinDebugger >> skipBlockNode [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipJump [ | instructionStream | @@ -399,7 +401,7 @@ SindarinDebugger >> skipJump [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipMessageNode [ self node arguments do: [ :arg | self context pop ]. "Pop the arguments of the message send from the context's value stack" @@ -411,7 +413,7 @@ SindarinDebugger >> skipMessageNode [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipMessageNodeWith: replacementValue [ self node arguments do: [ :arg | self context pop ]. "Pop the arguments of the message send from the context's value stack" @@ -426,7 +428,7 @@ SindarinDebugger >> skipMessageNodeWith: replacementValue [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipReturnNode [ | node allReturnNodes | @@ -449,7 +451,7 @@ SindarinDebugger >> skipReturnNode [ self debugSession interruptedProcess ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipThroughNode: aProgramNode [ "Skips execution until program counter reaches aProgramNode. Also skip the target node." @@ -457,7 +459,7 @@ SindarinDebugger >> skipThroughNode: aProgramNode [ self skipUpToNode: aProgramNode skipTargetNode: true ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipToPC: aPC [ "Skips execution until program counter reaches aPC." @@ -467,7 +469,7 @@ SindarinDebugger >> skipToPC: aPC [ do: [ ^ self ] ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipUpToNode: aProgramNode [ "Skips execution until program counter reaches aProgramNode. Does not skip the target node." @@ -475,7 +477,7 @@ SindarinDebugger >> skipUpToNode: aProgramNode [ self skipUpToNode: aProgramNode skipTargetNode: false ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipUpToNode: aProgramNode skipTargetNode: skipTargetNode [ "Skips execution until program counter reaches aProgramNode." @@ -490,7 +492,7 @@ SindarinDebugger >> skipUpToNode: aProgramNode skipTargetNode: skipTargetNode [ skipTargetNode ifTrue: [ self skip ] ] -{ #category : #'stepping - skip' } +{ #category : 'stepping - skip' } SindarinDebugger >> skipWith: replacementValue [ "If it is a message-send or assignment, skips the execution of the current instruction, and puts the replacementValue on the execution stack." @@ -504,7 +506,7 @@ SindarinDebugger >> skipWith: replacementValue [ ^ self skipAssignmentNodeWith: replacementValue ] ] -{ #category : #'ast manipulation' } +{ #category : 'ast manipulation' } SindarinDebugger >> statementNodeContaining: aNode [ | method statementNode parentOfStatementNode | @@ -521,7 +523,7 @@ SindarinDebugger >> statementNodeContaining: aNode [ ^ statementNode ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> step [ "Executes the next instruction. If the instruction is a message-send, step inside it." @@ -530,14 +532,14 @@ SindarinDebugger >> step [ self basicStep ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> step: anInt [ "Call the #step method @anInt times" anInt timesRepeat: [ self step ] ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepBytecode [ "Executes the next bytecode" @@ -547,7 +549,7 @@ SindarinDebugger >> stepBytecode [ self debugSession updateContextTo: process suspendedContext ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepOver [ | startContext | self flag: 'Why don''t we use the stepOver from the debug session? Do we really need to use the #step that performs exception check and termination check every time?'. @@ -559,14 +561,14 @@ SindarinDebugger >> stepOver [ whileFalse: [ self step ] ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepOver: anInt [ "Call the #stepOver method @anInt times" anInt timesRepeat: [ self stepOver ] ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepThrough [ "Hacked for demonstration purposes to have a stepThrough" @@ -574,7 +576,7 @@ SindarinDebugger >> stepThrough [ self basicStepThrough ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepToMethodEntry [ self flag: @@ -584,7 +586,7 @@ SindarinDebugger >> stepToMethodEntry [ self debugSession updateContextTo: process suspendedContext ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepToReturn [ | oldContext methodAST | @@ -600,14 +602,14 @@ SindarinDebugger >> stepToReturn [ ifFalse: [ self basicStepOver ] ] ] -{ #category : #'stepping - steps' } +{ #category : 'stepping - steps' } SindarinDebugger >> stepUntil: aBlock [ "Steps the execution until aBlock evaluates to true" aBlock whileFalse: [ self step ] ] -{ #category : #'API - changes' } +{ #category : 'API - changes' } SindarinDebugger >> tryMoveToNodeInHomeContext: aNode [ "Moves to node aNode if aNode is in the lexical context. Otherwise, the program state goes back to how it was before trying and signals an error as the node is not in AST" @@ -623,7 +625,7 @@ SindarinDebugger >> tryMoveToNodeInHomeContext: aNode [ ^ NodeNotInASTError signal ] ] -{ #category : #'execution predicates' } +{ #category : 'execution predicates' } SindarinDebugger >> willStoreButNotPop [ ^ self instructionStream willStoreButNotPop diff --git a/src/Sindarin/SindarinSkippingReturnWarning.class.st b/src/Sindarin/SindarinSkippingReturnWarning.class.st index 08b4082..4298f5c 100644 --- a/src/Sindarin/SindarinSkippingReturnWarning.class.st +++ b/src/Sindarin/SindarinSkippingReturnWarning.class.st @@ -1,5 +1,7 @@ Class { - #name : #SindarinSkippingReturnWarning, - #superclass : #Warning, - #category : #'Sindarin-Exceptions' + #name : 'SindarinSkippingReturnWarning', + #superclass : 'Warning', + #category : 'Sindarin-Exceptions', + #package : 'Sindarin', + #tag : 'Exceptions' } diff --git a/src/Sindarin/SteppingATerminatingProcess.class.st b/src/Sindarin/SteppingATerminatingProcess.class.st index 699f312..c321cfb 100644 --- a/src/Sindarin/SteppingATerminatingProcess.class.st +++ b/src/Sindarin/SteppingATerminatingProcess.class.st @@ -1,5 +1,7 @@ Class { - #name : #SteppingATerminatingProcess, - #superclass : #Error, - #category : #'Sindarin-Exceptions' + #name : 'SteppingATerminatingProcess', + #superclass : 'Error', + #category : 'Sindarin-Exceptions', + #package : 'Sindarin', + #tag : 'Exceptions' } diff --git a/src/Sindarin/TSindarin.trait.st b/src/Sindarin/TSindarin.trait.st index a834351..3569e25 100644 --- a/src/Sindarin/TSindarin.trait.st +++ b/src/Sindarin/TSindarin.trait.st @@ -2,50 +2,52 @@ I am a trait that contains the core API that a scriptable debugger should use " Trait { - #name : #TSindarin, + #name : 'TSindarin', #instVars : [ 'process', 'sindarinSession', 'blockToDebug' ], - #category : #'Sindarin-Core' + #category : 'Sindarin-Core', + #package : 'Sindarin', + #tag : 'Core' } -{ #category : #start } +{ #category : 'start' } TSindarin classSide >> attachTo: aDebugSession [ "Returns a new instance of ScriptableDebugger attached to aDebugSession" ^ self new attachTo: aDebugSession ] -{ #category : #actions } +{ #category : 'actions' } TSindarin classSide >> closeAllDebuggers [