From 16ddb8bc763c33fb172d0c1bcd04d070f36f9cc8 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Thu, 12 Nov 2020 14:58:46 +0100 Subject: [PATCH] [release-branch.go1.15] cmd/compile: do not emit an extra debug_line entry for the end of seq addr Uses DW_LNS_advance_pc directly, instead of calling putpclcdelta because the latter will create a new debug_line entry for the end of sequence address. Updates #42484. Fixes #42521. Change-Id: Ib6355605cac101b9bf37a3b4961ab0cee678a839 Reviewed-on: https://go-review.googlesource.com/c/go/+/268937 Trust: Than McIntosh Run-TryBot: Than McIntosh TryBot-Result: Go Bot Reviewed-by: Than McIntosh Reviewed-by: Cherry Zhang Reviewed-on: https://go-review.googlesource.com/c/go/+/269517 --- src/cmd/internal/obj/dwarf.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/internal/obj/dwarf.go b/src/cmd/internal/obj/dwarf.go index cd1d5b8687..8a12849d77 100644 --- a/src/cmd/internal/obj/dwarf.go +++ b/src/cmd/internal/obj/dwarf.go @@ -106,7 +106,8 @@ func (ctxt *Link) generateDebugLinesSymbol(s, lines *LSym) { // GDB will assign a line number of zero the last row in the line // table, which we don't want. lastlen := uint64(s.Size - (lastpc - s.Func.Text.Pc)) - putpclcdelta(ctxt, dctxt, lines, lastlen, 0) + dctxt.AddUint8(lines, dwarf.DW_LNS_advance_pc) + dwarf.Uleb128put(dctxt, lines, int64(lastlen)) dctxt.AddUint8(lines, 0) // start extended opcode dwarf.Uleb128put(dctxt, lines, 1) dctxt.AddUint8(lines, dwarf.DW_LNE_end_sequence)