Patchwork libgo patch committed: Fix DWARF line lookup for different line info

login
register
mail settings
Submitter Ian Taylor
Date April 20, 2012, 6:44 p.m.
Message ID <mcrpqb28cq3.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/154102/
State New
Headers show

Comments

Ian Taylor - April 20, 2012, 6:44 p.m.
This patch to libgo fixes the DWARF line lookup when one function has
different types of lines.  This happens when the line info includes,
e.g., discriminators.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu and power64-unknown-linux-gnu.  Committed to
mainline and 4.7 branch.

Ian

Patch

diff -r 28ec41c37bcf libgo/go/debug/dwarf/line.go
--- a/libgo/go/debug/dwarf/line.go	Fri Apr 20 11:38:11 2012 -0700
+++ b/libgo/go/debug/dwarf/line.go	Fri Apr 20 11:40:46 2012 -0700
@@ -415,6 +415,10 @@ 
 	if newLineInfo {
 		if len(lines) > 0 {
 			sort.Sort(lines[len(lines)-1].addrs)
+			p := &lines[len(lines)-1]
+			if len(p.addrs) > 0 && address > p.addrs[len(p.addrs)-1].pc {
+				p.addrs = append(p.addrs, oneLineInfo{address, p.addrs[len(p.addrs)-1].line})
+			}
 		}
 		lines = append(lines, mapLineInfo{line: lineInfo})
 	}