aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2018-01-09 21:20:10 -0500
committerThan McIntosh <thanm@google.com>2018-01-10 19:11:35 +0000
commit5e1dcb7a04ba989483761fc4e14da8e75efa2847 (patch)
treefe0ce5665ed4a8ee12f27c13361611ccd2558a02 /src
parentc9517688c7dbe224bd606050dd7511ad1b10f55a (diff)
downloadgo-5e1dcb7a04ba989483761fc4e14da8e75efa2847.tar.xz
cmd/compile: workaround for inconsistent receiver param srcpos
Given an inlinable method M in package P: func (r *MyStruct) M(...) { When M is compiled within its home package, the source position that the compiler records for 'r' (receiver parameter variable) is accurate, whereas if M is built as part of the compilation of some other package (body read from export data), the declaration line assigned to 'r' will be the line number of the 'import' directive, not the source line from M's source file. This inconsistency can cause differences in the size of abstract parameter DIEs (due to variable-length encoding), which can then in turn result in bad abstract origin offsets, which in turn triggers build failures on iOS (dsymutil crashes when it encounters an incorrect abstract origin reference). Work around the problem by removing the "declaration line number" attribute within the abstract parameter abbreviation table entry. The decl line attribute doesn't contribute a whole lot to the debugging experience, and it gets rid of the inconsistencies that trigger the dsymutil crashes. Updates #23374. Change-Id: I0fdc8e19a48db0ccd938ceadf85103936f89ce9f Reviewed-on: https://go-review.googlesource.com/87055 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/internal/dwarf/dwarf.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go
index b6a0604590..0d6b1971a6 100644
--- a/src/cmd/internal/dwarf/dwarf.go
+++ b/src/cmd/internal/dwarf/dwarf.go
@@ -551,7 +551,6 @@ var abbrevs = [DW_NABRV]dwAbbrev{
[]dwAttrForm{
{DW_AT_name, DW_FORM_string},
{DW_AT_variable_parameter, DW_FORM_flag},
- {DW_AT_decl_line, DW_FORM_udata},
{DW_AT_type, DW_FORM_ref_addr},
},
},
@@ -1429,7 +1428,10 @@ func putAbstractVar(ctxt Context, info Sym, v *Var) {
}
// Line
- putattr(ctxt, info, abbrev, DW_FORM_udata, DW_CLS_CONSTANT, int64(v.DeclLine), nil)
+ if abbrev != DW_ABRV_PARAM_ABSTRACT {
+ // See issue 23374 for more on why decl line is skipped for abs params.
+ putattr(ctxt, info, abbrev, DW_FORM_udata, DW_CLS_CONSTANT, int64(v.DeclLine), nil)
+ }
// Type
putattr(ctxt, info, abbrev, DW_FORM_ref_addr, DW_CLS_REFERENCE, 0, v.Type)