@@ -531,6 +531,7 @@ void DWARFDebugLine::Sequence::reset() {
531
531
FirstRowIndex = 0 ;
532
532
LastRowIndex = 0 ;
533
533
Empty = true ;
534
+ StmtSeqOffset = UINT64_MAX;
534
535
}
535
536
536
537
DWARFDebugLine::LineTable::LineTable () { clear (); }
@@ -565,14 +566,16 @@ DWARFDebugLine::ParsingState::ParsingState(
565
566
resetRowAndSequence ();
566
567
}
567
568
568
- void DWARFDebugLine::ParsingState::resetRowAndSequence () {
569
+ void DWARFDebugLine::ParsingState::resetRowAndSequence (uint64_t Offset ) {
569
570
Row.reset (LineTable->Prologue .DefaultIsStmt );
570
571
Sequence.reset ();
572
+ if (Offset != UINT64_MAX) {
573
+ Sequence.SetSequenceOffset (Offset);
574
+ }
571
575
}
572
576
573
- void DWARFDebugLine::ParsingState::appendRowToMatrix (uint64_t LineTableOffset ) {
577
+ void DWARFDebugLine::ParsingState::appendRowToMatrix () {
574
578
unsigned RowNumber = LineTable->Rows .size ();
575
- Sequence.Offset = LineTableOffset;
576
579
if (Sequence.Empty ) {
577
580
// Record the beginning of instruction sequence.
578
581
Sequence.Empty = false ;
@@ -849,7 +852,9 @@ Error DWARFDebugLine::LineTable::parse(
849
852
*OS << ' \n ' ;
850
853
Row::dumpTableHeader (*OS, /* Indent=*/ Verbose ? 12 : 0 );
851
854
}
852
- uint64_t LineTableSeqOffset = *OffsetPtr;
855
+ // *OffsetPtr points to the end of the prologue - i.e. the start of the first
856
+ // sequence. So initialize the first sequence offset accordingly.
857
+ State.Sequence .SetSequenceOffset (*OffsetPtr);
853
858
854
859
bool TombstonedAddress = false ;
855
860
auto EmitRow = [&] {
@@ -860,7 +865,7 @@ Error DWARFDebugLine::LineTable::parse(
860
865
}
861
866
if (OS)
862
867
State.Row .dump (*OS);
863
- State.appendRowToMatrix (LineTableSeqOffset );
868
+ State.appendRowToMatrix ();
864
869
}
865
870
};
866
871
while (*OffsetPtr < EndOffset) {
@@ -915,10 +920,9 @@ Error DWARFDebugLine::LineTable::parse(
915
920
// into this code path - if it were invalid, the default case would be
916
921
// followed.
917
922
EmitRow ();
918
- State.resetRowAndSequence ();
919
923
// Cursor now points to right after the end_sequence opcode - so points
920
924
// to the start of the next sequence - if one exists.
921
- LineTableSeqOffset = Cursor.tell ();
925
+ State. resetRowAndSequence ( Cursor.tell () );
922
926
break ;
923
927
924
928
case DW_LNE_set_address:
@@ -1419,7 +1423,7 @@ bool DWARFDebugLine::LineTable::lookupAddressRangeImpl(
1419
1423
1420
1424
// Skip sequences that don't match our stmt_sequence offset if one was
1421
1425
// provided
1422
- if (StmtSequenceOffset && CurSeq.Offset != *StmtSequenceOffset) {
1426
+ if (StmtSequenceOffset && CurSeq.StmtSeqOffset != *StmtSequenceOffset) {
1423
1427
++SeqPos;
1424
1428
continue ;
1425
1429
}
0 commit comments