Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,9 +1386,10 @@ bool DWARFDebugLine::LineTable::lookupAddressRangeImpl(
FirstRowIndex = findRowInSeq(CurSeq, Address);

// Figure out the last row in the range.
// end_sequence tags can be at EndAddr
uint32_t LastRowIndex =
findRowInSeq(CurSeq, {EndAddr - 1, Address.SectionIndex});
if (LastRowIndex == UnknownRowIndex)
findRowInSeq(CurSeq, {EndAddr, Address.SectionIndex});
if (LastRowIndex == UnknownRowIndex || !Rows[LastRowIndex].EndSequence)
LastRowIndex = CurSeq.LastRowIndex - 1;

assert(FirstRowIndex != UnknownRowIndex);
Expand Down
29 changes: 15 additions & 14 deletions llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,17 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
for (uint32_t RowIndex : RowVector) {
// Take file number and line/column from the row.
const DWARFDebugLine::Row &Row = CUI.LineTable->Rows[RowIndex];

// TODO(avillega): With this conditional, functions folded by `icf`
// optimizations will only include 1 of all the folded functions. There is
// not a clear path forward to have the information of all folded functions
// in gsym.
if (Row.EndSequence) {
// End sequence markers are included for the last address
// in a function or the last contiguos address in a sequence.
break;
}

std::optional<uint32_t> OptFileIdx =
CUI.DWARFToGSYMFileIndex(Gsym, Row.File);
if (!OptFileIdx) {
Expand Down Expand Up @@ -411,7 +422,7 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
else
Out.Report("Non-monotonically increasing addresses",
[&](raw_ostream &OS) {
OS << "error: line table has addresses that do not "
OS << "warning: line table has addresses that do not "
<< "monotonically increase:\n";
for (uint32_t RowIndex2 : RowVector)
CUI.LineTable->Rows[RowIndex2].dump(OS);
Expand All @@ -424,19 +435,9 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
auto LastLE = FI.OptLineTable->last();
if (LastLE && LastLE->File == FileIdx && LastLE->Line == Row.Line)
continue;
// Only push a row if it isn't an end sequence. End sequence markers are
// included for the last address in a function or the last contiguous
// address in a sequence.
if (Row.EndSequence) {
// End sequence means that the next line entry could have a lower address
// that the previous entries. So we clear the previous row so we don't
// trigger the line table error about address that do not monotonically
// increase.
PrevRow = DWARFDebugLine::Row();
} else {
FI.OptLineTable->push(LE);
PrevRow = Row;
}

FI.OptLineTable->push(LE);
PrevRow = Row;
}
// If not line table rows were added, clear the line table so we don't encode
// on in the GSYM file.
Expand Down
Loading