Hi I split DebugTools.st using the one file one class pattern.
Gwen
>From 2655c83089385b8b0cf9971ae84b5bc1a039552a Mon Sep 17 00:00:00 2001 From: Gwenael Casaccio <mrg...@gmail.com> Date: Wed, 21 Aug 2013 14:06:05 +0200 Subject: [PATCH] Split debug tools package using the one class one file pattern. --- packages/debug/ChangeLog | 6 +++ packages/debug/DebugTools.st | 72 ------------------------------ packages/debug/DebuggerReentered.st | 50 +++++++++++++++++++++ packages/debug/Extensions.st | 87 +++++++++++++++++++++++++++++++++++++ packages/debug/package.xml | 2 + 5 files changed, 145 insertions(+), 72 deletions(-) create mode 100644 packages/debug/DebuggerReentered.st create mode 100644 packages/debug/Extensions.st diff --git a/packages/debug/ChangeLog b/packages/debug/ChangeLog index cffb9b4..8d393f4 100644 --- a/packages/debug/ChangeLog +++ b/packages/debug/ChangeLog @@ -1,3 +1,9 @@ +2013-08-20 Gwenael Casaccio <gwenael.casac...@gmail.com> + + * DebugTools.st: Split DebugTools file. + * Extensions.st: New. + * DebuggerReentered.st: New + 2011-07-27 Paolo Bonzini <bonz...@gnu.org> * DebugTools.st: Improve 2011-07-15 change to fix testsuite failures. diff --git a/packages/debug/DebugTools.st b/packages/debug/DebugTools.st index 49033bd..7e52cb6 100644 --- a/packages/debug/DebugTools.st +++ b/packages/debug/DebugTools.st @@ -311,75 +311,3 @@ pointer bytecodes to line numbers.'> ] ] - - -Namespace current: SystemExceptions [ - -Notification subclass: DebuggerReentered [ - - <category: 'System-Debugging'> - <comment: 'This notification is raised when the debugger is started on a process -that was already being debugged. Trapping it allows the pre-existing -debugger to keep control of the process.'> - - description [ - "Answer a textual description of the exception." - - <category: 'description'> - ^'the debugger was started on an already debugged process' - ] -] - -] - - - -ContextPart extend [ - - currentLine [ - "Answer the 1-based number of the line that is pointed to by the receiver's - instruction pointer." - - <category: 'source code'> - ^Debugger currentLineIn: self - ] - - debugger [ - "Answer the debugger that is attached to the given context. It - is always nil unless the DebugTools package is loaded." - - <category: 'debugging'> - | ctx home | - ctx := self. - [ctx isNil] whileFalse: - [home := ctx home. - (home notNil - and: [(home method attributeAt: #debugging: ifAbsent: [nil]) notNil]) - ifTrue: [^ctx receiver]. - ctx := ctx parentContext]. - ^nil - ] - -] - - - -BlockClosure extend [ - - forkDebugger [ - "Suspend the currently running process and fork the receiver into a new - process, passing a Debugger object that controls the currently running - process." - - <category: 'instance creation'> - | process | - process := Processor activeProcess. - - [process suspend. - Processor activeProcess priority: process priority. - self value: (Debugger on: process)] - forkAt: Processor unpreemptedPriority - ] - -] - diff --git a/packages/debug/DebuggerReentered.st b/packages/debug/DebuggerReentered.st new file mode 100644 index 0000000..9e4c439 --- /dev/null +++ b/packages/debug/DebuggerReentered.st @@ -0,0 +1,50 @@ +"====================================================================== +| +| Inferior process control +| +| + ======================================================================" + +"====================================================================== +| +| Copyright 2002, 2006, 2007 Free Software Foundation, Inc. +| Written by Paolo Bonzini. +| +| This file is part of GNU Smalltalk. +| +| GNU Smalltalk is free software; you can redistribute it and/or modify it +| under the terms of the GNU General Public License as published by the Free +| Software Foundation; either version 2, or (at your option) any later version. +| +| GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT +| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +| FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +| details. +| +| You should have received a copy of the GNU General Public License along with +| GNU Smalltalk; see the file COPYING. If not, write to the Free Software +| Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +| + ======================================================================" + + + +Namespace current: SystemExceptions [ + +Notification subclass: DebuggerReentered [ + + <category: 'System-Debugging'> + <comment: 'This notification is raised when the debugger is started on a process +that was already being debugged. Trapping it allows the pre-existing +debugger to keep control of the process.'> + + description [ + "Answer a textual description of the exception." + + <category: 'description'> + ^'the debugger was started on an already debugged process' + ] +] + +] + diff --git a/packages/debug/Extensions.st b/packages/debug/Extensions.st new file mode 100644 index 0000000..d7be530 --- /dev/null +++ b/packages/debug/Extensions.st @@ -0,0 +1,87 @@ +"====================================================================== +| +| Inferior process control +| +| + ======================================================================" + +"====================================================================== +| +| Copyright 2002, 2006, 2007 Free Software Foundation, Inc. +| Written by Paolo Bonzini. +| +| This file is part of GNU Smalltalk. +| +| GNU Smalltalk is free software; you can redistribute it and/or modify it +| under the terms of the GNU General Public License as published by the Free +| Software Foundation; either version 2, or (at your option) any later version. +| +| GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT +| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +| FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +| details. +| +| You should have received a copy of the GNU General Public License along with +| GNU Smalltalk; see the file COPYING. If not, write to the Free Software +| Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +| + ======================================================================" + + + +ContextPart extend [ + + currentLine [ + "Answer the 1-based number of the line that is pointed to by the receiver's + instruction pointer." + + <category: 'source code'> + ^Debugger currentLineIn: self + ] + + debugger [ + "Answer the debugger that is attached to the given context. It + is always nil unless the DebugTools package is loaded." + + <category: 'debugging'> + | ctx home | + ctx := self. + [ctx isNil] whileFalse: + [home := ctx home. + (home notNil + and: [(home method attributeAt: #debugging: ifAbsent: [nil]) notNil]) + ifTrue: [^ctx receiver]. + ctx := ctx parentContext]. + ^nil + ] + +] + + + +BlockClosure extend [ + + forkDebugger [ + "Suspend the currently running process and fork the receiver into a new + process, passing a Debugger object that controls the currently running + process." + + <category: 'instance creation'> + | process | + process := Processor activeProcess. + + [process suspend. + Processor activeProcess priority: process priority. + self value: (Debugger on: process)] + forkAt: Processor unpreemptedPriority + ] + + debug [ + <category: 'instance creation'> + <exceptionHandlingInternal: false> + + self class debuggerClass debug: 'Debugger'. + self value + ] +] + diff --git a/packages/debug/package.xml b/packages/debug/package.xml index 9108e83..6f38685 100644 --- a/packages/debug/package.xml +++ b/packages/debug/package.xml @@ -6,6 +6,8 @@ <filein>debugtests.st</filein> </test> + <filein>Extensions.st</filein> + <filein>DebuggerReentered.st</filein> <filein>DebugTools.st</filein> <file>ChangeLog</file> </package> -- 1.8.1.2
_______________________________________________ help-smalltalk mailing list help-smalltalk@gnu.org https://lists.gnu.org/mailman/listinfo/help-smalltalk