Author: wmb
Date: Thu Mar 22 01:21:57 2012
New Revision: 2913
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2913
Log:
Debugger - improved the "up" command so it will skip past the method call machinery to find the caller that the user cares about.
Modified:
forth/lib/debug.fth
forth/lib/rstrace.fth
ofw/core/ofwcore.fth
Modified: forth/lib/debug.fth
==============================================================================
--- forth/lib/debug.fth Wed Mar 21 23:25:54 2012 (r2912)
+++ forth/lib/debug.fth Thu Mar 22 01:21:57 2012 (r2913)
@@ -75,26 +75,28 @@
;
bug definitions
headerless
-\ Go up the return stack until we find the return address left by our caller
-: caller-ip ( rp -- ip )
- begin
- na1+ dup @ dup in-dictionary? if ( rs-adr ip )
- ip>token token@
- dup ['] execute = over defer? or swap <ip @ body> = or
- else
- drop false
- then
- until ( rs-adr )
- @ ip>token
-;
+\ Go up the return stack until we find an interesting caller
: up1 ( rp -- )
- caller-ip
- dup find-cfa ( ip cfa )
- dup ['] catch = if 2drop exit then
- cr ." [ Up to " dup .name ." ]" cr ( ip cfa )
- over token@ .name ( ip cfa )
- >body swap 'unnest (debug)
+ begin na1+ dup rp0 @ <> while ( rs-adr )
+ dup @ ( rs-adr ip )
+ dup in-dictionary? if ( rs-adr ip )
+ find-cfa dup indirect-call? if ( rs-adr xt )
+ drop ( rs-adr )
+ else ( rs-adr xt )
+ nip ( rs-adr )
+ scrolling-debug? if ( xt )
+ cr ." [ Up to " dup .name ." ]" cr
+ then ( xt )
+ (debug ( )
+ exit ( -- )
+ then ( rs-adr )
+ else ( rs-adr ip )
+ drop ( rs-adr )
+ then ( rs-adr )
+ repeat ( rs-adr )
+ drop ( )
;
+
defer to-debug-window ' noop is to-debug-window
defer restore-window ' noop is restore-window
: .debug-short-help ( -- )
@@ -183,19 +185,12 @@
d# 78 rmargin !
.debug-short-help
." Callers: " rp0 @ the-rp na1+ rslist kill-line cr
- \ XXX the following is wrong when popping up
- the-ip <ip @ = if
- #line @ is stack-line \ So the initial stack is displayed in the right place
- then
d# 40 rmargin !
the-ip debug-see
cr
- \ When popping up from an interior word, display the initial stack on
- \ the line where the cursor will be.
- the-ip <ip @ <> if
- the-ip ip>position if ( col row )
- drop is stack-line ( )
- then
+ \ Display the initial stack on the cursor line
+ the-ip ip>position 0= if ( col row )
+ is stack-line drop ( )
then
;
: setup-debug-display ( -- )
Modified: forth/lib/rstrace.fth
==============================================================================
--- forth/lib/rstrace.fth Wed Mar 21 23:25:54 2012 (r2912)
+++ forth/lib/rstrace.fth Thu Mar 22 01:21:57 2012 (r2913)
@@ -103,9 +103,9 @@
\ boring? is a hook for Open Firmware. It recognizes words like
\ $call-method that are essentially indirect calls. Such words
\ just clutter up the stack display and should be elided for clarity.
-defer boring?
-: (boring?) ( ip -- flag ) drop false ;
-' (boring?) is boring?
+defer indirect-call?
+: (indirect-call?) ( xt -- flag ) ['] catch = ;
+' (indirect-call?) is indirect-call?
: rtraceword ( rs-end rs-adr -- rs-end rs-adr' )
@+ ( rs-end rs-adr' ip )
@@ -120,7 +120,7 @@
find-cfa ( rs-end rs-adr xt )
- dup boring? if ( rs-end rs-adr xt )
+ dup indirect-call? if ( rs-end rs-adr xt )
drop exit ( -- rs-end rs-adr )
then ( rs-end rs-adr xt )
Modified: ofw/core/ofwcore.fth
==============================================================================
--- ofw/core/ofwcore.fth Wed Mar 21 23:25:54 2012 (r2912)
+++ ofw/core/ofwcore.fth Thu Mar 22 01:21:57 2012 (r2913)
@@ -4772,20 +4772,21 @@
[then]
also hidden
-: method-call? ( ip -- flag )
- dup ['] $call-self = if drop true exit then ( ip )
- dup ['] $call-method = if drop true exit then ( ip )
- dup ['] $call-parent = if drop true exit then ( ip )
- dup ['] call-package = if drop true exit then ( ip )
- dup ['] $vexecute = if drop true exit then ( ip )
- dup ['] $vexecute? = if drop true exit then ( ip )
- dup ['] $package-execute? = if drop true exit then ( ip )
- dup ['] package-execute = if drop true exit then ( ip )
- dup ['] apply-method = if drop true exit then ( ip )
- dup ['] (apply-method) = if drop true exit then ( ip )
- dup ['] (execute-method) = if drop true exit then ( ip )
- dup ['] execute-device-method = if drop true exit then ( ip )
+: method-call? ( xt -- flag )
+ dup (indirect-call?) if drop true exit then ( xt )
+ dup ['] $call-self = if drop true exit then ( xt )
+ dup ['] $call-method = if drop true exit then ( xt )
+ dup ['] $call-parent = if drop true exit then ( xt )
+ dup ['] call-package = if drop true exit then ( xt )
+ dup ['] $vexecute = if drop true exit then ( xt )
+ dup ['] $vexecute? = if drop true exit then ( xt )
+ dup ['] $package-execute? = if drop true exit then ( xt )
+ dup ['] package-execute = if drop true exit then ( xt )
+ dup ['] apply-method = if drop true exit then ( xt )
+ dup ['] (apply-method) = if drop true exit then ( xt )
+ dup ['] (execute-method) = if drop true exit then ( xt )
+ dup ['] execute-device-method = if drop true exit then ( xt )
drop false
;
-' method-call? to boring?
+' method-call? to indirect-call?
previous
Author: wmb
Date: Wed Mar 21 23:16:33 2012
New Revision: 2911
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2911
Log:
rstrace - set the default value for boring? so the debugger works before OFW is loaded.
Modified:
forth/lib/rstrace.fth
Modified: forth/lib/rstrace.fth
==============================================================================
--- forth/lib/rstrace.fth Wed Mar 21 23:15:39 2012 (r2910)
+++ forth/lib/rstrace.fth Wed Mar 21 23:16:33 2012 (r2911)
@@ -99,8 +99,14 @@
then ( rs-adr n )
drop ( rs-adr )
;
+
+\ boring? is a hook for Open Firmware. It recognizes words like
+\ $call-method that are essentially indirect calls. Such words
+\ just clutter up the stack display and should be elided for clarity.
defer boring?
: (boring?) ( ip -- flag ) drop false ;
+' (boring?) is boring?
+
: rtraceword ( rs-end rs-adr -- rs-end rs-adr' )
@+ ( rs-end rs-adr' ip )
dup reasonable-ip? 0= if ( rs-end rs-adr ip )
Author: wmb
Date: Wed Mar 21 23:15:39 2012
New Revision: 2910
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2910
Log:
Debugger - factored (trace so it's not so crazy long, and cleaned up a few minor glitches.
Modified:
forth/lib/debug.fth
Modified: forth/lib/debug.fth
==============================================================================
--- forth/lib/debug.fth Wed Mar 21 23:14:01 2012 (r2909)
+++ forth/lib/debug.fth Wed Mar 21 23:15:39 2012 (r2910)
@@ -37,8 +37,7 @@
variable step? step? on
variable res
headers
-false value first-time?
-d# 10 circular-stack: locations
+false value redisplay?
: (debug) (s low-adr hi-adr -- )
unbug 1 cnt ! ip> ! <ip ! pnext
@@ -47,7 +46,7 @@
slow-next? on
then
step? on
- true is first-time?
+ true is redisplay?
;
headerless
: 'unnest (s pfa -- pfa' )
@@ -116,6 +115,7 @@
." $ Display top of stack as adr,len text string" cr
." \ Display Forth return stack as numbers (like the data stack)" cr
." Q Quit: abandon execution of the debugged word" cr
+ ." V Visual: toggle between 2-D and scrolling" cr
;
d# 24 constant cmd-column
: to-cmd-column ( -- ) cmd-column to-column ;
@@ -141,8 +141,6 @@
: save-result-loc ( -- ) #out @ to result-col #line @ to result-line ;
: to-result-loc ( -- ) result-col result-line at-xy ;
-0 value rp-mark
-
\ set-package is a hook for Open Firmware. When Open Firmware is loaded,
\ set-package should be set to a word that sets the active package to the
\ package corresponding to the current instance. set-package is called
@@ -165,72 +163,82 @@
variable hex-stack \ Show the data stack in hex?
: save# ( -- ) #-buf /#buf - #buf-save d# 72 move hld @ hld-save ! ;
: restore# ( -- ) #buf-save #-buf /#buf - d# 72 move hld-save @ hld ! ;
+0 value the-ip
+0 value the-rp
: (.rs ( -- )
show-rstack @ 0= if exit then
." return-stack: "
push-hex
- rp0 @ rp@ - /n /
- 6 do \ It appears that skipping the first 6 entries on the stack skips the debug goo on the rs
- rp@ i /n * + @ .
- loop
+ \ Skip the debugger's footprint on the return stack
+ rp0 @ the-rp 5 na+ ?do i @ . /n +loop
pop-base
;
-: (trace ( -- )
- first-time? if
+: setup-scrolling-display ( -- )
+ ??cr
+ the-ip <ip @ = if ." : " else ." Inside " then
+ <ip @ find-cfa .name
+;
+: setup-2d-display ( -- )
+ page
+ d# 78 rmargin !
+ .debug-short-help
+ ." Callers: " rp0 @ the-rp na1+ rslist kill-line cr
+ \ XXX the following is wrong when popping up
+ the-ip <ip @ = if
+ #line @ is stack-line \ So the initial stack is displayed in the right place
+ then
+ d# 40 rmargin !
+ the-ip debug-see
+ cr
+ \ When popping up from an interior word, display the initial stack on
+ \ the line where the cursor will be.
+ the-ip <ip @ <> if
+ the-ip ip>position if ( col row )
+ drop is stack-line ( )
+ then
+ then
+;
+: setup-debug-display ( -- )
+ redisplay? if
scrolling-debug? if
- ??cr
- ip@ <ip @ = if ." : " else ." Inside " then
- <ip @ find-cfa .name
+ setup-scrolling-display
else
- page
- d# 78 rmargin !
- ." Callers: " rp0 @ rp@ na1+ rslist kill-line cr
- \ XXX the following is wrong when popping up
- ip@ <ip @ = if
- #line @ is stack-line \ So the initial stack is displayed in the right place
- then
- d# 40 rmargin !
- ip@ debug-see
- cr
-\ ip@ <ip @ <> if
-\ ip@ ip>position if ( col row )
-\ swap
-\ is stack-line
-\ then
-\ #line @ is stack-line \ So the initial stack is displayed in the right place
- \ then
+ setup-2d-display
then
0 show-rstack !
- false is first-time?
- rp@ is rp-mark
+ false is redisplay?
then
-
- begin
- step? @ if to-debug-window then
+;
+: show-debug-stack ( -- )
+ scrolling-debug? if
save#
- scrolling-debug? if
- cmd-column 2+ to-column
+ cmd-column 2+ to-column
- hex-stack @ if push-hex then
- ." ( " .s \ Show data stack
- hex-stack @ if pop-base then
- show-rstack @ if (.rs then \ Show return stack
- ." )"
- restore#
-
- cr
- ['] noop is indent
- ip@ .token drop \ Show word name
- ['] (indent) is indent
- to-cmd-column
- else
- save-result-loc
- show-partial-stack
+ hex-stack @ if push-hex then
+ ." ( " .s \ Show data stack
+ hex-stack @ if pop-base then
+ show-rstack @ if (.rs then \ Show return stack
+ ." )"
+ restore#
+
+ cr
+ ['] noop is indent
+ the-ip .token drop \ Show word name
+ ['] (indent) is indent
+ to-cmd-column
+ else
+ save-result-loc
+ show-partial-stack
- ip@ ip-set-cursor
- #line @ to stack-line
- then
-
+ the-ip ip-set-cursor
+ #line @ to stack-line
+ then
+;
+: debug-interact ( -- )
+ save#
+ begin
+ step? @ if to-debug-window then
+ show-debug-stack
step? @ key? or if
step? on res off
key dup bl < if drop bl then
@@ -238,28 +246,35 @@
restore-window
scrolling-debug? if reset-page then
case
- ascii D of ip@ token@ executer ['] (debug try endof \ Down
- ascii U of rp@ ['] up1 try endof \ Up
- ascii C of step? @ 0= step? ! true endof \ Continue
- ascii F of
+ ascii D of the-ip token@ executer ['] (debug try endof \ Down
+ ascii U of the-rp ['] up1 try endof \ Up
+ ascii C of \ Continue
+ step? @ 0= step? !
+ step? @ 0= if true to scrolling-debug? true to redisplay? then
+ true
+ endof
+
+ ascii F of \ Forth
cr ." Type 'resume' to return to debugger" cr
set-package interact unset-package false
- endof \ Forth
- ascii G of debug-off cr exit endof \ Go
- ascii H of cr .debug-long-help false endof \ Help
- ascii R of cr rp0 @ rp@ na1+ (rstrace false endof \ RSTrace
- ascii S of cr <ip @ body> (see) false endof \ See
- ascii ? of cr .debug-short-help false endof \ Short Help
+ endof
+ ascii G of debug-off cr true endof \ Go
+ ascii H of cr .debug-long-help false endof \ Help
+ ascii R of cr rp0 @ the-rp na1+ (rstrace false endof \ RSTrace
+ ascii S of cr <ip @ body> (see) false endof \ See
+ ascii ? of cr .debug-short-help false endof \ Short Help
ascii $ of space 2dup type cr to-cmd-column false endof \ String
ascii Q of cr ." unbug" abort true endof \ Quit
- ascii ( of ip@ set-<ip false endof
- ascii < of ip@ ta1+ set-<ip 1 cnt ! false endof
- ascii ) of ip@ ip> ! 1 cnt ! false endof
- ascii * of ip@ find-cfa dup <ip ! 'unnest ip> ! false endof
- ascii \ of show-rstack @ 0= show-rstack ! false endof
- ascii X of hex-stack @ 0= hex-stack ! false endof
- ascii V of scrolling-debug? 0= to scrolling-debug?
- scrolling-debug? 0= if true to first-time? then false endof
+ ascii ( of the-ip set-<ip false endof
+ ascii < of the-ip ta1+ set-<ip 1 cnt ! false endof
+ ascii ) of the-ip ip> ! 1 cnt ! false endof
+ ascii * of the-ip find-cfa dup <ip ! 'unnest ip> ! false endof
+ ascii \ of show-rstack @ 0= show-rstack ! false endof \ toggle return stack display
+ ascii X of hex-stack @ 0= hex-stack ! false endof \ toggle heX stack display
+ ascii V of \ toggle Visual (2D) mode
+ scrolling-debug? 0= to scrolling-debug?
+ scrolling-debug? 0= if true to redisplay? then false
+ endof
( default ) true swap
endcase
else
@@ -267,11 +282,17 @@
then
until
restore#
- scrolling-debug? 0= if to-result-loc then
- ip@ token@ dup ['] unnest = swap ['] exit = or if
- cr true is first-time?
+;
+: (trace ( -- )
+ ip@ to the-ip
+ rp@ to the-rp
+ setup-debug-display
+ debug-interact
+\ scrolling-debug? 0= if to-result-loc then
+ the-ip token@ dup ['] unnest = swap ['] exit = or if
+ cr true is redisplay?
then
- pnext
+ slow-next? @ if pnext then
;
' (trace 'debug token!
Author: wmb
Date: Wed Mar 21 00:56:47 2012
New Revision: 2904
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2904
Log:
Improvements to the 2D debugger.
Modified:
cpu/x86/kerncode.fth
forth/lib/debug.fth
forth/lib/decomp.fth
forth/lib/rstrace.fth
ofw/core/ofwcore.fth
Modified: cpu/x86/kerncode.fth
==============================================================================
--- cpu/x86/kerncode.fth Tue Mar 20 23:37:14 2012 (r2903)
+++ cpu/x86/kerncode.fth Wed Mar 21 00:56:47 2012 (r2904)
@@ -299,13 +299,7 @@
\ Run time word for ?do
code (?do) (s l i -- )
ax pop bx pop ax bx cmp = if bran1 #) jmp then
-[ifdef] big-endian-t
- bx push ax push
- ip dx mov 0 [ip] ax mov ?bswap-ax ax dx add rp adec dx 0 [rp] mov
- ax pop bx pop \ i in ax l in bx
-[else]
- ip dx mov 0 [ip] dx add rp adec dx 0 [rp] mov
-[then]
+ rp adec ip 0 [rp] mov
ip ainc 80000000 # bx add rp adec bx 0 [rp] mov
bx ax sub rp adec ax 0 [rp] mov
\ ??? how about sp rp xchg ... dx push bx push ax push sp rp xchg
@@ -313,17 +307,9 @@
\ Run time word for do
code (do) (s l i -- )
-[ifdef] big-endian-t
ax pop bx pop \ i in ax l in bx
+ rp adec ip 0 [rp] mov
- bx push ax push
- ip dx mov 0 [ip] ax mov ?bswap-ax ax dx add rp adec dx 0 [rp] mov
- ax pop bx pop \ i in ax l in bx
-[else]
- ax pop bx pop \ i in ax l in bx
-
- ip dx mov 0 [ip] dx add rp adec dx 0 [rp] mov
-[then]
ip ainc 80000000 # bx add rp adec bx 0 [rp] mov
bx ax sub rp adec ax 0 [rp] mov
\ ??? how about sp rp xchg ... dx push bx push ax push sp rp xchg
@@ -344,7 +330,13 @@
code (leave) (s -- )
mloclabel pleave
- 2 /n* [rp] ip mov 3 /n* # rp add
+ 2 /n* [rp] ip mov
+[ifdef] big-endian-t
+ 0 [ip] ax mov ?bswap-ax ax ip add
+[else]
+ 0 [ip] ip add
+[then]
+ 3 /n* # rp add
c;
code (?leave) (s f -- ) ax pop ax ax or pleave jne c;
Modified: forth/lib/debug.fth
==============================================================================
--- forth/lib/debug.fth Tue Mar 20 23:37:14 2012 (r2903)
+++ forth/lib/debug.fth Wed Mar 21 00:56:47 2012 (r2904)
@@ -38,6 +38,8 @@
variable res
headers
false value first-time?
+d# 10 circular-stack: locations
+
: (debug) (s low-adr hi-adr -- )
unbug 1 cnt ! ip> ! <ip ! pnext
slow-next? @ 0= if
@@ -119,11 +121,21 @@
: to-cmd-column ( -- ) cmd-column to-column ;
0 value stack-line
-d# 50 constant stack-column
+d# 45 constant stack-column
\ 0 0 2value result-loc
0 value result-line
0 value result-col
: to-stack-location ( -- ) stack-column stack-line at-xy kill-line ;
+: show-partial-stack ( -- )
+ to-stack-location
+
+ ." \ "
+ depth 0< if ." Stack Underflow" sp0 @ sp! exit then
+ depth 0= if ." Empty" exit then
+ depth 4 > if ." .. " then
+ depth depth 5 - 0 max ?do depth i - 1- pick n. loop
+;
+
\ : save-result-loc ( -- ) #out @ #line @ to result-loc ;
\ : to-result-loc ( -- ) result-loc at-xy ;
: save-result-loc ( -- ) #out @ to result-col #line @ to result-line ;
@@ -170,38 +182,51 @@
ip@ <ip @ = if ." : " else ." Inside " then
<ip @ find-cfa .name
else
+ page
+ d# 78 rmargin !
+ ." Callers: " rp0 @ rp@ na1+ rslist kill-line cr
+ \ XXX the following is wrong when popping up
+ ip@ <ip @ = if
+ #line @ is stack-line \ So the initial stack is displayed in the right place
+ then
+ d# 40 rmargin !
ip@ debug-see
- 0 is stack-line \ So the initial stack is displayed in the right place
cr
+\ ip@ <ip @ <> if
+\ ip@ ip>position if ( col row )
+\ swap
+\ is stack-line
+\ then
+\ #line @ is stack-line \ So the initial stack is displayed in the right place
+ \ then
then
0 show-rstack !
false is first-time?
rp@ is rp-mark
then
+
begin
step? @ if to-debug-window then
save#
scrolling-debug? if
cmd-column 2+ to-column
- else
- save-result-loc
- to-stack-location
- then
- hex-stack @ if push-hex then
- ." ( " .s \ Show data stack
- hex-stack @ if pop-base then
- show-rstack @ if (.rs then \ Show return stack
- ." )"
- restore#
+ hex-stack @ if push-hex then
+ ." ( " .s \ Show data stack
+ hex-stack @ if pop-base then
+ show-rstack @ if (.rs then \ Show return stack
+ ." )"
+ restore#
- scrolling-debug? if
cr
['] noop is indent
ip@ .token drop \ Show word name
['] (indent) is indent
to-cmd-column
else
+ save-result-loc
+ show-partial-stack
+
ip@ ip-set-cursor
#line @ to stack-line
then
@@ -233,6 +258,8 @@
ascii * of ip@ find-cfa dup <ip ! 'unnest ip> ! false endof
ascii \ of show-rstack @ 0= show-rstack ! false endof
ascii X of hex-stack @ 0= hex-stack ! false endof
+ ascii V of scrolling-debug? 0= to scrolling-debug?
+ scrolling-debug? 0= if true to first-time? then false endof
( default ) true swap
endcase
else
Modified: forth/lib/decomp.fth
==============================================================================
--- forth/lib/decomp.fth Tue Mar 20 23:37:14 2012 (r2903)
+++ forth/lib/decomp.fth Wed Mar 21 00:56:47 2012 (r2904)
@@ -528,7 +528,7 @@
: .: ( acf definer -- ) .definer space space >body .pf ;
: debug-see ( apf -- )
page-mode? >r no-page
- d# 48 rmargin ! find-cfa ['] : page .:
+ find-cfa ['] : .:
r> is page-mode?
;
: .constant ( acf definer -- ) over >data @ pretty-. .definer drop ;
Modified: forth/lib/rstrace.fth
==============================================================================
--- forth/lib/rstrace.fth Tue Mar 20 23:37:14 2012 (r2903)
+++ forth/lib/rstrace.fth Wed Mar 21 00:56:47 2012 (r2904)
@@ -28,16 +28,20 @@
over na1+ @ reasonable-ip? if ( rs-adr n )
\ The third entry is a reasonable IP so it could be a do loop frame
\ Make sure it points just past a loop end
- over na1+ @ ( rs-adr n n2 )
- ip>token -1 na+ token@ ( rs-adr n xt )
- dup ['] (loop) = swap ['] (+loop) = or if ( rs-adr n )
- \ The two numbers span the +- boundary, so probably a do loop
- ." Do loop frame inside "
- over na1+ @ ip>token .current-word ( rs-adr n )
- over @ ( rs-adr n n1 )
- ." i: " tuck + . ( rs-adr n1 )
- ." limit: " minus0 + . ( rs-adr )
- 2 na+ exit
+ over na1+ @ dup @ + ( rs-adr n n2 )
+ dup reasonable-ip? if ( rs-adr n adr )
+ ip>token -1 na+ token@ ( rs-adr n xt )
+ dup ['] (loop) = swap ['] (+loop) = or if ( rs-adr n )
+ \ The two numbers span the +- boundary, so probably a do loop
+ ." Do loop frame inside "
+ over na1+ @ ip>token .current-word ( rs-adr n )
+ over @ ( rs-adr n n1 )
+ ." i: " tuck + . ( rs-adr n1 )
+ ." limit: " minus0 + . ( rs-adr )
+ 2 na+ exit
+ then ( rs-adr n )
+ else ( rs-adr n n2 )
+ drop ( rs-adr n )
then ( rs-adr n )
then ( rs-adr n )
then ( rs-adr n )
@@ -73,6 +77,67 @@
repeat ( end-adr adr )
2drop
;
+: skip-catch ( rs-adr -- rs-adr' ) 3 na+ ;
+: skip-do-or-n ( rs-adr n -- rs-adr' )
+ over @ reasonable-ip? 0= if ( rs-adr n )
+ \ The second number is not an IP so it could be a do loop frame
+ over na1+ @ reasonable-ip? if ( rs-adr n )
+ \ The third entry is a reasonable IP so it could be a do loop frame
+ \ Make sure it points to an offset that points just past a loop end
+ over na1+ @ dup @ + ( rs-adr n n2 )
+ dup reasonable-ip? if ( rs-adr n adr )
+ ip>token -1 na+ token@ ( rs-adr n xt )
+ dup ['] (loop) = swap ['] (+loop) = or if ( rs-adr n )
+ \ The two numbers span the +- boundary, so probably a do loop
+ drop ( rs-adr )
+ 2 na+ exit ( -- rs-adr )
+ then ( rs-adr n )
+ else ( rs-adr n n2 )
+ drop ( rs-adr n )
+ then ( rs-adr n )
+ then ( rs-adr n )
+ then ( rs-adr n )
+ drop ( rs-adr )
+;
+defer boring?
+: (boring?) ( ip -- flag ) drop false ;
+: rtraceword ( rs-end rs-adr -- rs-end rs-adr' )
+ @+ ( rs-end rs-adr' ip )
+ dup reasonable-ip? 0= if ( rs-end rs-adr ip )
+ skip-do-or-n exit ( -- rs-end rs-adr )
+ then ( rs-end rs-adr )
+
+ dup in-catch? if ( rs-end rs-adr ip )
+ drop skip-catch ( rs-end rs-adr' )
+ exit ( -- rs-end rs-adr' )
+ then ( rs-end rs-adr ip )
+
+ find-cfa ( rs-end rs-adr xt )
+
+ dup boring? if ( rs-end rs-adr xt )
+ drop exit ( -- rs-end rs-adr )
+ then ( rs-end rs-adr xt )
+
+ dup ['] interpret-do-defined = if ( rs-end rs-adr xt )
+ \ Set rs-adr = rs-end so the caller will exit
+ 2drop dup exit ( -- rs-end rs-adr' )
+ then ( rs-end rs-adr xt )
+
+ >name name>string ( rs-end rs-adr adr len )
+ dup #out @ + rmargin @ >= if ( rs-end rs-adr adr len )
+ \ Set rs-adr = rs-end so the caller will exit
+ 2drop ." ..." ( rs-end rs-adr )
+ drop dup exit ( -- rs-end rs-adr' )
+ then ( rs-end rs-adr adr len )
+
+ type space ( rs-end rs-adr )
+;
+: rslist ( end-adr start-adr -- )
+ begin 2dup u> while ( end-adr adr )
+ rtraceword ( end-adr adr' )
+ repeat ( end-adr adr )
+ 2drop
+;
headers
forth definitions
: rstrace ( -- ) \ Return stack backtrace
Modified: ofw/core/ofwcore.fth
==============================================================================
--- ofw/core/ofwcore.fth Tue Mar 20 23:37:14 2012 (r2903)
+++ ofw/core/ofwcore.fth Wed Mar 21 00:56:47 2012 (r2904)
@@ -4770,3 +4770,22 @@
[ifdef] do-autoload
' do-drop-in is do-autoload
[then]
+
+also hidden
+: method-call? ( ip -- flag )
+ dup ['] $call-self = if drop true exit then ( ip )
+ dup ['] $call-method = if drop true exit then ( ip )
+ dup ['] $call-parent = if drop true exit then ( ip )
+ dup ['] call-package = if drop true exit then ( ip )
+ dup ['] $vexecute = if drop true exit then ( ip )
+ dup ['] $vexecute? = if drop true exit then ( ip )
+ dup ['] $package-execute? = if drop true exit then ( ip )
+ dup ['] package-execute = if drop true exit then ( ip )
+ dup ['] apply-method = if drop true exit then ( ip )
+ dup ['] (apply-method) = if drop true exit then ( ip )
+ dup ['] (execute-method) = if drop true exit then ( ip )
+ dup ['] execute-device-method = if drop true exit then ( ip )
+ drop false
+;
+' method-call? to boring?
+previous