From 1808565194bcc98efe6bef796520e46a046fac30 Mon Sep 17 00:00:00 2001 From: Piotr Bejda Date: Fri, 13 Dec 2024 19:58:44 -0500 Subject: [PATCH] cmd/internal/dwarf: fix missing decl_file tag for abstract subprograms Abstract subprograms are declared at specific file:line just as regular subprograms. Line annotation was already added, but as todo notes, not the file. --- src/cmd/internal/dwarf/dwarf.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go index 02e4c94c3a1b26..329b186c4b41cb 100644 --- a/src/cmd/internal/dwarf/dwarf.go +++ b/src/cmd/internal/dwarf/dwarf.go @@ -473,6 +473,7 @@ var abbrevs = []dwAbbrev{ []dwAttrForm{ {DW_AT_name, DW_FORM_string}, {DW_AT_inline, DW_FORM_data1}, + {DW_AT_decl_file, DW_FORM_data4}, {DW_AT_decl_line, DW_FORM_udata}, {DW_AT_external, DW_FORM_flag}, }, @@ -1150,7 +1151,7 @@ func PutAbstractFunc(ctxt Context, s *FnState) error { // DW_AT_inlined value putattr(ctxt, s.Absfn, abbrev, DW_FORM_data1, DW_CLS_CONSTANT, int64(DW_INL_inlined), nil) - // TODO(mdempsky): Shouldn't we write out StartPos.FileIndex() too? + putattr(ctxt, s.Absfn, abbrev, DW_FORM_data4, DW_CLS_CONSTANT, int64(1+s.StartPos.FileIndex()), nil) // 1-based file index putattr(ctxt, s.Absfn, abbrev, DW_FORM_udata, DW_CLS_CONSTANT, int64(s.StartPos.RelLine()), nil) var ev int64