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

Submitted by Ian Taylor on April 20, 2012, 6:44 p.m.

Details

Message ID mcrpqb28cq3.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

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 hide | download patch | download mbox

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})
 	}