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 cgo: support anonymous enums included in multiple Go files 2022-11-02 21:21:40 +01:00
embed interp: fix reading from external global 2022-09-15 19:07:04 +02:00
generics Set internal linkage and keeping default visibility for anonymous functions 2022-08-01 10:53:48 +02:00
alias.go fix bug in IR regarding type aliases 2019-09-20 10:35:49 +02:00
alias.txt fix bug in IR regarding type aliases 2019-09-20 10:35:49 +02:00
atomic.go compiler: really define runtime/volatile.* functions 2022-06-24 11:10:24 +02:00
atomic.txt compiler: really define runtime/volatile.* functions 2022-06-24 11:10:24 +02:00
binop.go runtime: allow comparing interfaces in reflectValueEqual() 2021-11-24 14:17:47 +01:00
binop.txt runtime: allow comparing interfaces in reflectValueEqual() 2021-11-24 14:17:47 +01:00
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 feat: fix typos 2023-03-24 09:22:38 -07:00
channel.txt feat: fix typos 2023-03-24 09:22:38 -07:00
corpus.yaml testdata: add brandondube/pctl to corpus 2023-03-05 10:08:36 -08:00
env.go os: stub out support for some more features 2021-11-26 08:05:35 +01:00
env.txt wasm: add support for the crypto/rand package 2021-08-05 19:01:14 +02:00
filesystem.go all: move from os.IsFoo to errors.Is(err, ErrFoo) 2022-08-07 10:32:23 +02:00
filesystem.txt main: clean up tests 2021-04-09 18:33:48 +02:00
float.go compiler: test float to int conversions and fix upper-bound calculation 2021-01-19 14:02:32 +01:00
float.txt compiler: test float to int conversions and fix upper-bound calculation 2021-01-19 14:02:32 +01:00
gc.go runtime: implement KeepAlive using inline assembly 2023-02-18 10:50:26 +01:00
gc.txt runtime: implement a simple mark/sweep garbage collector 2018-11-18 19:18:39 +01:00
generics.go compiler: fix incorrect DWARF type in some generic parameters 2022-08-22 10:31:30 +02:00
generics.txt Set internal linkage and keeping default visibility for anonymous functions 2022-08-01 10:53:48 +02:00
goroutines.go internal/task: remove coroutines 2022-01-19 14:42:02 -05:00
goroutines.txt interp: run goroutine starts and checks at runtime 2021-12-24 09:10:21 +01:00
init.go interp: use object layout information for LLVM types 2021-11-02 22:16:15 +01:00
init.txt interp: don't ignore array indices for untyped objects 2021-07-14 07:55:05 +02:00
init_multi.go testdata: add more test cases in testdata 2018-10-25 20:37:35 +02:00
init_multi.txt testdata: add more test cases in testdata 2018-10-25 20:37:35 +02:00
interface.go compiler: correctly generate code for local named types 2023-03-21 22:22:03 +01:00
interface.txt compiler: fix difference in aliases in interface methods 2022-04-07 12:54:17 +02:00
json.go transform: optimize reflect.Type Implements() method 2021-03-28 14:00:37 +02:00
json.txt transform: optimize reflect.Type Implements() method 2021-03-28 14:00:37 +02:00
ldflags.go main: implement -ldflags="-X ..." 2021-04-09 18:33:48 +02:00
ldflags.txt main: implement -ldflags="-X ..." 2021-04-09 18:33:48 +02:00
map.go runtime: properly turn pointer into empty interface when hashing 2023-02-25 06:42:30 -08:00
map.txt runtime: properly turn pointer into empty interface when hashing 2023-02-25 06:42:30 -08:00
math.go runtime: add support for math package 2019-02-05 19:37:21 +01:00
math.txt runtime: add support for math package 2019-02-05 19:37:21 +01:00
print.go Add support for printing slices via print/println 2022-07-13 14:44:23 +02:00
print.txt Add support for printing slices via print/println 2022-07-13 14:44:23 +02:00
rand.go wasm: add support for the crypto/rand package 2021-08-05 19:01:14 +02:00
rand.txt wasm: add support for the crypto/rand package 2021-08-05 19:01:14 +02:00
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 compiler,reflect: fix pkgpath for struct fields 2023-03-15 21:53:57 +01:00
reflect.txt compiler,reflect: fix pkgpath for struct fields 2023-03-15 21:53:57 +01:00
slice.go compiler: support all kinds of recursive types 2023-03-18 17:53:47 +01:00
slice.txt compiler: support all kinds of recursive types 2023-03-18 17:53:47 +01:00
sort.go implement reflect.Swapper 2020-10-23 21:37:35 +02:00
sort.txt implement reflect.Swapper 2020-10-23 21:37:35 +02:00
stdlib.go builder: add support for Go 1.20 2023-01-17 08:38:54 +01:00
stdlib.txt os: implement virtual filesystem support 2020-05-13 08:08:57 +02:00
string.go compiler: fix named string to []byte slice conversion 2020-07-29 12:13:37 +02:00
string.txt compiler,runtime: implement []rune to string conversion 2019-08-11 15:45:35 +02:00
structs.go compiler: support recursive types 2019-10-13 23:07:47 +02:00
structs.txt compiler: support recursive types 2019-10-13 23:07:47 +02:00
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 main: print source location when a panic happens in -monitor 2023-04-26 18:40:35 +02:00
zeroalloc.go testdata: fix formatting 2020-05-12 01:17:27 +02:00
zeroalloc.txt add code to handle programs which use heap allocations but never hit the GC 2019-11-17 15:14:51 +01:00