@@ -1568,23 +1568,19 @@ unsigned BinaryContext::addDebugFilenameToUnit(const uint32_t DestCUID,
15681568 DWARFCompileUnit *SrcUnit = DwCtx->getCompileUnitForOffset (SrcCUID);
15691569 const DWARFDebugLine::LineTable *LineTable =
15701570 DwCtx->getLineTableForUnit (SrcUnit);
1571- const std::vector< DWARFDebugLine::FileNameEntry> &FileNames =
1572- LineTable->Prologue .FileNames ;
1573- // Dir indexes start at 1, as DWARF file numbers, and a dir index 0
1571+ const DWARFDebugLine::FileNameEntry &FileNameEntry =
1572+ LineTable->Prologue .getFileNameEntry (FileIndex) ;
1573+ // Dir indexes start at 1 and a dir index 0
15741574 // means empty dir.
1575- assert (FileIndex > 0 && FileIndex <= FileNames.size () &&
1576- " FileIndex out of range for the compilation unit." );
15771575 StringRef Dir = " " ;
1578- if (FileNames[FileIndex - 1 ] .DirIdx != 0 ) {
1576+ if (FileNameEntry .DirIdx != 0 ) {
15791577 if (std::optional<const char *> DirName = dwarf::toString (
1580- LineTable->Prologue
1581- .IncludeDirectories [FileNames[FileIndex - 1 ].DirIdx - 1 ])) {
1578+ LineTable->Prologue .IncludeDirectories [FileNameEntry.DirIdx - 1 ])) {
15821579 Dir = *DirName;
15831580 }
15841581 }
15851582 StringRef FileName = " " ;
1586- if (std::optional<const char *> FName =
1587- dwarf::toString (FileNames[FileIndex - 1 ].Name ))
1583+ if (std::optional<const char *> FName = dwarf::toString (FileNameEntry.Name ))
15881584 FileName = *FName;
15891585 assert (FileName != " " );
15901586 DWARFCompileUnit *DstUnit = DwCtx->getCompileUnitForOffset (DestCUID);
@@ -1925,7 +1921,7 @@ static void printDebugInfo(raw_ostream &OS, const MCInst &Instruction,
19251921 const DWARFDebugLine::Row &Row = LineTable->Rows [RowRef.RowIndex - 1 ];
19261922 StringRef FileName = " " ;
19271923 if (std::optional<const char *> FName =
1928- dwarf::toString (LineTable->Prologue .FileNames [ Row.File - 1 ] .Name ))
1924+ dwarf::toString (LineTable->Prologue .getFileNameEntry ( Row.File ) .Name ))
19291925 FileName = *FName;
19301926 OS << " # debug line " << FileName << " :" << Row.Line ;
19311927 if (Row.Column )
0 commit comments