diff options
author | Ayke van Laethem <[email protected]> | 2020-03-28 20:46:09 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-03-28 21:55:12 +0100 |
commit | cc4a4c755f51496eec2286439a12386136b576ef (patch) | |
tree | 433446d829fa7eb5aac2d2b6019692b1312f7ed5 /compiler | |
parent | 2501602b4f048f8b324f74605d8de466a5d3442c (diff) | |
download | tinygo-cc4a4c755f51496eec2286439a12386136b576ef.tar.gz tinygo-cc4a4c755f51496eec2286439a12386136b576ef.zip |
interp: show backtrace with error
This should make it much easier to figure out why and where an error
happens at package initialization time.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/compiler.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/compiler.go b/compiler/compiler.go index a40c5b48c..33b5ab4fd 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -887,7 +887,8 @@ func (b *builder) createFunctionDefinition() { if b.fn.Synthetic == "package initializer" { // Package initializers have no debug info. Create some fake debug // info to at least have *something*. - b.difunc = b.attachDebugInfoRaw(b.fn, b.fn.LLVMFn, "", "", 0) + filename := b.fn.Package().Pkg.Path() + "/<init>" + b.difunc = b.attachDebugInfoRaw(b.fn, b.fn.LLVMFn, "", filename, 0) } else if b.fn.Syntax() != nil { // Create debug info file if needed. b.difunc = b.attachDebugInfo(b.fn) |