tinygo/testdata
Ayke van Laethem ae381e74a5 main: print source location when a panic happens in -monitor
The previous commit started printing the instruction address for runtime
panics. This commit starts using this address to print the source
location.

Here is an example where this feature is very useful. There is a heap
allocation in the Bluetooth package, but we don't know where exactly.
Printing the instruction address of the panic is already useful, but
what is even more useful is looking up this address in the DWARF debug
information that's part of the binary:

    $ tinygo flash -target=circuitplay-bluefruit -monitor ./examples/heartrate
    Connected to /dev/ttyACM0. Press Ctrl-C to exit.
    tick 00:00.810
    tick 00:01.587
    tick 00:02.387
    tick 00:03.244
    panic: runtime error at 0x00027c4d: alloc in interrupt
    [tinygo: panic at /home/ayke/src/tinygo/bluetooth/adapter_sd.go:74:4]

To be clear, this path isn't stored on the microcontroller. It's stored
as part of the build, and `-monitor` just looks up the path from the
panic message.

Possible enhancements:

  - Print such an address for regular panics as well. I'm not sure
    that's so useful, as it's usually a lot easier to look up panics
    just by their message.
  - Use runtimePanicAt (instead of runtimePanic) in other locations, if
    that proves to be beneficial.
  - Print the TinyGo-generated output in some other color, to
    distinguish it from the regular console output.
  - Print more details when panicking (registers, stack values), and
    print an actual backtrace.
2023-04-26 18:40:35 +02:00
..
cgo
embed
generics
alias.go
alias.txt
atomic.go
atomic.txt
binop.go runtime: allow comparing interfaces in reflectValueEqual() 2021-11-24 14:17:47 +01:00
binop.txt
calls.go testdata: add test for else/defer bug 2023-04-11 18:54:05 -07:00
calls.txt compiler: implement func value and builtin defers 2020-07-31 01:48:57 +02:00
channel.go
channel.txt
corpus.yaml
env.go
env.txt
filesystem.go
filesystem.txt
float.go
float.txt compiler: test float to int conversions and fix upper-bound calculation 2021-01-19 14:02:32 +01:00
gc.go
gc.txt
generics.go
generics.txt
goroutines.go
goroutines.txt
init.go
init.txt
init_multi.go
init_multi.txt
interface.go
interface.txt
json.go
json.txt
ldflags.go
ldflags.txt
map.go
map.txt runtime: properly turn pointer into empty interface when hashing 2023-02-25 06:42:30 -08:00
math.go
math.txt
print.go
print.txt
rand.go
rand.txt
recover.go compiler: implement recover() built-in function 2022-06-16 07:59:21 +02:00
recover.txt compiler: implement recover() built-in function 2022-06-16 07:59:21 +02:00
reflect.go
reflect.txt
slice.go
slice.txt
sort.go
sort.txt
stdlib.go
stdlib.txt
string.go
string.txt
structs.go
structs.txt
testing.go all: drop support for Go 1.16 and Go 1.17 2022-08-30 12:38:06 +02:00
testing.txt On baremetal platforms, use simpler test matcher. Fixes #2666. 2022-03-15 05:59:00 +01:00
timers.go testdata: clearly correct values for timing test with a little more time to spare on CI machines 2022-11-03 15:26:20 +01:00
timers.txt testdata: clearly correct values for timing test with a little more time to spare on CI machines 2022-11-03 15:26:20 +01:00
trivialpanic.go
zeroalloc.go
zeroalloc.txt