aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/gc_blocks.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-04-25 01:22:55 +0200
committerRon Evans <[email protected]>2023-04-26 18:40:35 +0200
commit3392827c3e6ac2c0849e443242576c1dd24f6677 (patch)
tree5bbba94ee61eec1edf8205a7c5f28ed105dff6c3 /src/runtime/gc_blocks.go
parent59838338ba00923a9d4f0252345805065a8724b9 (diff)
downloadtinygo-3392827c3e6ac2c0849e443242576c1dd24f6677.tar.gz
tinygo-3392827c3e6ac2c0849e443242576c1dd24f6677.zip
runtime: print the address where a panic happened
This is not very useful in itself, but makes it possible to detect this address in the output. See the next commit. This adds around 50 bytes to each binary (except for AVR and wasm). This is unfortunate, but I think this feature is quite useful still. A future enhancement might be to create a build tag for extended panic information that's not set by default.
Diffstat (limited to 'src/runtime/gc_blocks.go')
-rw-r--r--src/runtime/gc_blocks.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/gc_blocks.go b/src/runtime/gc_blocks.go
index 54c3cb913..7aaff89c1 100644
--- a/src/runtime/gc_blocks.go
+++ b/src/runtime/gc_blocks.go
@@ -278,7 +278,7 @@ func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
}
if interrupt.In() {
- runtimePanic("alloc in interrupt")
+ runtimePanicAt(returnAddress(0), "alloc in interrupt")
}
gcTotalAlloc += uint64(size)
@@ -318,7 +318,7 @@ func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
// Unfortunately the heap could not be increased. This
// happens on baremetal systems for example (where all
// available RAM has already been dedicated to the heap).
- runtimePanic("out of memory")
+ runtimePanicAt(returnAddress(0), "out of memory")
}
}
}