From 03d8c38a70fbdc7c2806511e3b6b0dd82182c57b Mon Sep 17 00:00:00 2001 From: Radosvet M Date: Fri, 12 Jan 2024 09:14:22 +0200 Subject: [PATCH] fix panicking and stack traces (#23) * polkawasm: fix misused function putchar * polkawasm: revert wasm-opt -g flag --- builder/build.go | 1 + src/runtime/gc_debug.go | 3 ++- src/runtime/runtime_polkawasm.go | 5 +---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/builder/build.go b/builder/build.go index 0a1c567322..67fe807b41 100644 --- a/builder/build.go +++ b/builder/build.go @@ -828,6 +828,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe if config.Target.Triple == "wasm32-unknown-polkawasm" { args = append(args, opt, + "-g", "--signext-lowering", // "--signature-pruning", // "--const-hoisting", diff --git a/src/runtime/gc_debug.go b/src/runtime/gc_debug.go index bb7aaff769..ad3ae819cb 100644 --- a/src/runtime/gc_debug.go +++ b/src/runtime/gc_debug.go @@ -42,6 +42,7 @@ func printstr(str string) { break } - putchar(str[i]) + putcharBuffer[putcharPosition] = str[i] + putcharPosition++ } } diff --git a/src/runtime/runtime_polkawasm.go b/src/runtime/runtime_polkawasm.go index d99833c883..6891d2992a 100644 --- a/src/runtime/runtime_polkawasm.go +++ b/src/runtime/runtime_polkawasm.go @@ -30,10 +30,7 @@ func abort() { trap() } -func putchar(c byte) { - putcharBuffer[putcharPosition] = c - putcharPosition++ -} +func putchar(c byte) {} func getchar() byte { return 0