ssa: add llvm debug info

This commit is contained in:
Li Jie
2024-09-10 11:04:32 +08:00
parent 4bf5dd15e9
commit 3e5338c902
8 changed files with 595 additions and 3 deletions

View File

@@ -236,7 +236,7 @@ func isNeedRuntimeOrPyInit(pkg *packages.Package) (needRuntime, needPyInit bool)
}
const (
ssaBuildMode = ssa.SanityCheckFunctions | ssa.InstantiateGenerics
ssaBuildMode = ssa.SanityCheckFunctions | ssa.InstantiateGenerics | ssa.GlobalDebug
)
type context struct {
@@ -436,6 +436,7 @@ func linkMainPkg(ctx *context, pkg *packages.Package, pkgs []*aPackage, llFiles
}
}
args = append(args, exargs...)
args = append(args, "-gdwarf-5", "-v")
// TODO(xsw): show work
if verbose {
@@ -498,6 +499,7 @@ func buildPkg(ctx *context, aPkg *aPackage, verbose bool) {
cl.SetDebug(0)
}
check(err)
ret.Finalize()
if needLLFile(ctx.mode) {
pkg.ExportFile += ".ll"
os.WriteFile(pkg.ExportFile, []byte(ret.String()), 0644)