1
0
Fork 0
forked from fun/fun

Only cosmetics. No code changes. (0.39.15)

This commit is contained in:
Johannes Findeisen 2026-03-30 21:32:46 +02:00
commit 10144d2737

View file

@ -15,7 +15,7 @@
* Debugging and error reporting demo for Fun. * Debugging and error reporting demo for Fun.
* *
* How to run: * How to run:
* fun --repl-on-error examples/debug_reporting.fun * fun --repl-on-error ./examples/error/debug_reporting.fun
* *
* What happens: * What happens:
* - The program runs compute(), then triggers a runtime error in crash(). * - The program runs compute(), then triggers a runtime error in crash().
@ -27,14 +27,14 @@
* :stack # show the value stack * :stack # show the value stack
* :top # show the top-of-stack value * :top # show the top-of-stack value
* :list # show source around the current line * :list # show source around the current line
* :disas # disassemble around current instruction pointer (ip) * :disasm # disassemble around current instruction pointer (ip)
* :frame 1 # select a lower frame, then try :locals, :list, :disas again * :frame 1 # select a lower frame, then try :locals, :list, :disas again
* :printv local[0] # print a single value (also: stack[i], global[i]) * :printv local[0] # print a single value (also: stack[i], global[i])
* *
* Stepping and breakpoints: * Stepping and breakpoints:
* - Before re-running the script, you can set a breakpoint at the marker below. * - Before re-running the script, you can set a breakpoint at the marker below.
* For example (adjust the line number as needed in your copy): * For example (adjust the line number as needed in your copy):
* :break examples/debug_reporting.fun:LINE_BK_1 * :break ./examples/error/debug_reporting.fun:1
* :info breaks * :info breaks
* :cont * :cont
* On hit, try stepping: * On hit, try stepping:
@ -73,16 +73,16 @@ fun main()
main() main()
/* Expected when run with --repl-on-error (your version and line/ip may vary): /* Expected when run with --repl-on-error (your version and line/@ip may vary):
Runtime error: index out of range Runtime error: index out of range
(at ./examples/debug_reporting.fun:68 in crash, op INDEX_GET @ip 9) (at ./examples/error/debug_reporting.fun:68 in crash, op INDEX_GET @ip 9)
Entering REPL due to runtime error (code 1) Entering REPL due to runtime error (code 1)
Fun VERSION REPL Fun VERSION REPL
Type :help for commands. Submit an empty line to run. Type :help for commands. Submit an empty line to run.
fun> :backtrace fun> :backtrace
Backtrace (most recent call first): Backtrace (most recent call first):
#TOP crash at ./examples/debug_reporting.fun ip=... line=... #TOP crash at ./examples/error/debug_reporting.fun ip=... line=...
#... main at ./examples/debug_reporting.fun ip=... line=... #... main at ./examples/error/debug_reporting.fun ip=... line=...
fun> :list fun> :list
> <current line> ... > <current line> ...
fun> :locals fun> :locals
@ -94,7 +94,7 @@ fun> :stack
[... stack values ...] [... stack values ...]
Then try breakpoints and stepping on a new run: Then try breakpoints and stepping on a new run:
fun> :break ./examples/debug_reporting.fun:<line for LINE_BK_1> fun> :break ./examples/error/debug_reporting.fun:<line for LINE_BK_1>
fun> :info breaks fun> :info breaks
fun> :cont fun> :cont
... Breakpoint hit ... ... Breakpoint hit ...