From 2c7ea98ccf6f747f4b5abf2a5bb6c052f72aff7f Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Mon, 17 Jan 2022 11:39:01 -0800 Subject: [PATCH] runtime: add stubs for Func.FileLine and Frame.PC With this, 'tinygo test' in github.com/pkg/errors at least compiles and passes a few tests: $ git clone github.com/pkg/errors $ cd errors $ tinygo test -c $ for a in $(go test -list Test | grep Test); do ./errors.test -test.run $a -test.v > $a.log 2>&1; done $ grep -l PASS *.log | wc -l 19 $ grep -l FAIL *.log | wc -l 11 For https://github.com/tinygo-org/tinygo/issues/2445 --- src/runtime/stack.go | 4 ++++ src/runtime/symtab.go | 1 + 2 files changed, 5 insertions(+) diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 5ef9b7ad..c1522088 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -11,6 +11,10 @@ func (f *Func) Name() string { return "" } +func (f *Func) FileLine(pc uintptr) (file string, line int) { + return "", 0 +} + func Caller(skip int) (pc uintptr, file string, line int, ok bool) { return 0, "", 0, false } diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index 0a3ca3da..cfc9885d 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -9,6 +9,7 @@ type Frame struct { File string Line int + PC uintptr } func CallersFrames(callers []uintptr) *Frames {