dwarf/line: do not consider end of sequence entries valid (#2235)

This is needed to fix the problem we have with 1.15.4+ after the
backport is applied to it. The DWARF standard isn't clear on what
should happen with the end_of_sequence opcode but this is consistent
with debug/dwarf.LineReader as well as gdb.
This commit is contained in:
Alessandro Arzilli 2020-12-04 18:35:57 +01:00 committed by GitHub
parent 731f5ed346
commit 34ffa2e763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

@ -43,6 +43,7 @@ type DebugLineInfo struct {
// if normalizeBackslash is true all backslashes (\) will be converted into forward slashes (/)
normalizeBackslash bool
ptrSize int
endSeqIsValid bool
}
type FileEntry struct {

@ -543,7 +543,7 @@ func fixedadvancepc(sm *StateMachine, buf *bytes.Buffer) {
func endsequence(sm *StateMachine, buf *bytes.Buffer) {
sm.endSeq = true
sm.valid = true
sm.valid = sm.dbl.endSeqIsValid
}
func setaddress(sm *StateMachine, buf *bytes.Buffer) {

@ -80,6 +80,7 @@ func TestGrafana(t *testing.T) {
cuname, _ := e.Val(dwarf.AttrName).(string)
lineInfo := Parse(e.Val(dwarf.AttrCompDir).(string), debugLineBuffer, t.Logf, 0, false, 8)
lineInfo.endSeqIsValid = true
sm := newStateMachine(lineInfo, lineInfo.Instructions, 8)
lnrdr, err := data.LineReader(e)