--- gforth/debug.fs 1994/07/13 19:21:01 1.2 +++ gforth/debug.fs 1997/05/21 20:39:22 1.6 @@ -1,5 +1,23 @@ \ DEBUG.FS Debugger 12jun93jaw +\ Copyright (C) 1995 Free Software Foundation, Inc. + +\ This file is part of Gforth. + +\ Gforth 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 +\ of the License, or (at your option) any later version. + +\ This program 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 this program; if not, write to the Free Software +\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + decimal VARIABLE IP \ istruction pointer for debugger @@ -206,7 +224,7 @@ VARIABLE Body : NestXT ( xt -- true | body false ) DebugMode c-pass ! C-Output off - xtc C-Output on + xt-see C-Output on c-pass @ DebugMode = dup IF ." Cannot debug" cr THEN ; @@ -258,10 +276,20 @@ VARIABLE Unnest Nesting @ 0= ?EXIT -1 Nesting +! r> ELSE - IP @ >r 1 Nesting +! + IP @ 1 cells + >r 1 Nesting +! THEN AGAIN ; -: dbg ' NestXT ?EXIT (debug) ; +: dbg ' NestXT ?EXIT (debug) Leave-D ; + +: TRACE: + r> (debug) ; + +: (TRACE") + cr + ." BREAK AT: " type cr + r> (debug) ; -\ : test 1 2 4 swap dup . ; +: TRACE" + postpone s" + postpone (TRACE") ; immediate