--- gforth/Attic/debugging.fs 1995/10/16 18:33:05 1.3 +++ gforth/Attic/debugging.fs 1995/11/07 18:06:35 1.4 @@ -1,5 +1,24 @@ \ Simple debugging aids +\ 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. + + \ They are meant to support a different style of debugging than the \ tracing/stepping debuggers used in languages with long turn-around \ times. @@ -15,15 +34,14 @@ \ of the pictured numeric output string (i.e., don't use ~~ between <# \ and #>). +require source.fs defer printdebugdata ( -- ) \ gforth ' .s IS printdebugdata defer printdebugline ( addr -- ) \ gforth : (printdebugline) ( addr -- ) - cr - dup 2@ type ." :" cell+ cell+ - @ 0 .r ." :" + cr print-sourcepos ." :" \ it would be nice to print the name of the following word, \ but that's not easily possible for primitives printdebugdata @@ -33,8 +51,8 @@ defer printdebugline ( addr -- ) \ gfort : (~~) ( -- ) r@ printdebugline - r> 3 cells + >r ; + r> sourcepos drop + >r ; : ~~ ( compilation -- ; run-time -- ) \ gforth tilde-tilde - POSTPONE (~~) loadfilename 2@ 2, loadline @ , ; immediate + POSTPONE (~~) sourcepos, ; immediate