diff --git a/builder/sizes.go b/builder/sizes.go index fe912a1a..dacaec71 100644 --- a/builder/sizes.go +++ b/builder/sizes.go @@ -117,7 +117,7 @@ var ( // alloc: heap allocations during init interpretation // pack: data created when storing a constant in an interface for example // string: buffer behind strings - packageSymbolRegexp = regexp.MustCompile(`\$(alloc|embedfsslice|pack|string)(\.[0-9]+)?$`) + packageSymbolRegexp = regexp.MustCompile(`\$(alloc|pack|string)(\.[0-9]+)?$`) ) // readProgramSizeFromDWARF reads the source location for each line of code and diff --git a/compiler/compiler.go b/compiler/compiler.go index ecc00330..ff04f1f7 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -1071,6 +1071,17 @@ func (c *compilerContext) createEmbedGlobal(member *ssa.Global, global llvm.Valu sliceGlobal.SetGlobalConstant(true) sliceGlobal.SetUnnamedAddr(true) sliceGlobal.SetAlignment(c.targetData.ABITypeAlignment(sliceInitializer.Type())) + if c.Debug { + position := c.program.Fset.Position(member.Pos()) + diglobal := c.dibuilder.CreateGlobalVariableExpression(llvm.Metadata{}, llvm.DIGlobalVariableExpression{ + File: c.getDIFile(position.Filename), + Line: position.Line, + Type: c.getDIType(types.NewSlice(embedFileStructType)), + LocalToUnit: true, + Expr: c.dibuilder.CreateExpression(nil), + }) + sliceGlobal.AddMetadata(0, diglobal) + } // Define the embed.FS struct. It has only one field: the files (as a // *[]embed.file).