aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-03-28 20:46:09 +0100
committerRon Evans <[email protected]>2020-03-28 21:55:12 +0100
commitcc4a4c755f51496eec2286439a12386136b576ef (patch)
tree433446d829fa7eb5aac2d2b6019692b1312f7ed5 /compiler
parent2501602b4f048f8b324f74605d8de466a5d3442c (diff)
downloadtinygo-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.go3
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)