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