From e9015848aeceda2df77f745466e5e76ff342dc16 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 c16193d19e..b5b15859bc 100644 --- a/builder/build.go +++ b/builder/build.go @@ -819,6 +819,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