hoon: refactors stack-trace production in +mook

This commit is contained in:
Joe Bryan 2020-05-14 00:08:30 -07:00
parent 3fd545e40f
commit 953091a920

View File

@ -6489,51 +6489,83 @@
++ mock ++ mock
|= {{sub/* fol/*} gul/$-({* *} (unit (unit)))} |= {{sub/* fol/*} gul/$-({* *} (unit (unit)))}
(mook (mink [sub fol] gul)) (mook (mink [sub fol] gul))
:: +mook: convert $tone to %toon, rendering stack frames if present
:: ::
++ mook ++ mook
|= ton/tone |= ton=tone
^- toon ^- toon
?. ?=({$2 *} ton) ton ?. ?=([%2 *] ton)
:- %2 ton
=+ yel=(lent trace.ton) |^ [%2 (turn skip rend)]
=. trace.ton ::
++ skip
^+ trace.ton
=/ yel (lent trace.ton)
?. (gth yel 1.024) trace.ton ?. (gth yel 1.024) trace.ton
%+ weld %+ weld
(scag 512 trace.ton) (scag 512 trace.ton)
^- (list {@ta *}) ^+ trace.ton
:_ (slag (sub yel 512) trace.ton) :_ (slag (sub yel 512) trace.ton)
:- %lose :- %lose
%+ rap 3 (crip "[skipped {(scow %ud (sub yel 1.024))} frames]")
"[skipped {(scow %ud (sub yel 1.024))} frames]" ::
|- ^- (list tank) :: +rend: raw stack frame to tank
?~ trace.ton ~ ::
=+ rep=$(trace.ton t.trace.ton) :: supported frame types:
=* dat +.i.trace.ton ::
?+ -.i.trace.ton rep :: $% :: %hunk: failed scry ([~ ~])
$hunk ?@ dat rep :: :: %lose: skipped frames
=/ sof=(unit path) ((soft path) +.dat) :: :: %hand: mug any
?~ sof rep :: :: %mean: ~_
[(smyt u.sof) rep] :: :: %spot: source location
$lose ?^ dat rep :: ::
:_ rep :: [%hunk ref=* path]
leaf+(rip 3 dat) :: [%lose cord]
$hand :_ rep :: [%hand *]
leaf+(scow %p (mug dat)) :: [%mean $@(cord (trap tank))]
$mean ?@ dat [leaf+(rip 3 dat) rep] :: [%spot spot]
=/ mac (mack dat -.dat) :: ==
?~ mac [leaf+"####" rep] ::
=/ sof ((soft tank) u.mac) ++ rend
?~ sof rep |= [tag=@ta dat=*]
[u.sof rep] ^- tank
$spot =/ sof=(unit spot) ((soft spot) dat) ?+ tag
?~ sof rep ::
:_ rep leaf+"mook.{(rip 3 tag)}"
:+ %rose [":" ~ ~] ::
=* sot u.sof %hunk
:~ (smyt p.sot) ?@ dat leaf+"mook.hunk"
=> [ud=|=(a/@u (scow %ud a)) q.sot] =/ sof=(unit path) ((soft path) +.dat)
leaf+"<[{(ud p.p)} {(ud q.p)}].[{(ud p.q)} {(ud q.q)}]>" ?~ sof leaf+"mook.hunk"
== == (smyt u.sof)
::
%lose
?^ dat leaf+"mook.lose"
leaf+(rip 3 dat)
::
%hand
leaf+(scow %p (mug dat))
::
%mean
?@ dat leaf+(rip 3 dat)
=/ mac (mack dat -.dat)
?~ mac leaf+"####"
=/ sof ((soft tank) u.mac)
?~ sof leaf+"mook.mean"
u.sof
::
%spot
=/ sof=(unit spot) ((soft spot) dat)
?~ sof leaf+"mook.spot"
:+ %rose [":" ~ ~]
:~ (smyt p.u.sof)
=* l p.q.u.sof
=* r q.q.u.sof
=/ ud |=(a=@u (scow %ud a))
leaf+"<[{(ud p.l)} {(ud q.l)}].[{(ud p.r)} {(ud q.r)}]>"
==
==
--
:: ::
++ mong ++ mong
|= {{gat/* sam/*} gul/$-({* *} (unit (unit)))} |= {{gat/* sam/*} gul/$-({* *} (unit (unit)))}