@@ -158,13 +158,12 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS,
158
158
uint32_t FileBase = getVersion () >= 5 ? 0 : 1 ;
159
159
for (uint32_t I = 0 ; I != FileNames.size (); ++I) {
160
160
const FileNameEntry &FileEntry = FileNames[I];
161
- OS << format (" file_names[%3u]:\n " , I + FileBase);
162
- OS << " name: " ;
161
+ OS << format (" file_names[%3u]:\n " , I + FileBase);
162
+ OS << " name: " ;
163
163
FileEntry.Name .dump (OS, DumpOptions);
164
- OS << ' \n '
165
- << format (" dir_index: %" PRIu64 " \n " , FileEntry.DirIdx );
164
+ OS << ' \n ' << format (" dir_index: %" PRIu64 " \n " , FileEntry.DirIdx );
166
165
if (ContentTypes.HasMD5 )
167
- OS << " md5_checksum: " << FileEntry.Checksum .digest () << ' \n ' ;
166
+ OS << " md5_checksum: " << FileEntry.Checksum .digest () << ' \n ' ;
168
167
if (ContentTypes.HasModTime )
169
168
OS << format (" mod_time: 0x%8.8" PRIx64 " \n " , FileEntry.ModTime );
170
169
if (ContentTypes.HasLength )
@@ -604,9 +603,10 @@ Expected<const DWARFDebugLine::LineTable *> DWARFDebugLine::getOrParseLineTable(
604
603
DWARFDataExtractor &DebugLineData, uint64_t Offset, const DWARFContext &Ctx,
605
604
const DWARFUnit *U, function_ref<void (Error)> RecoverableErrorHandler) {
606
605
if (!DebugLineData.isValidOffset (Offset))
607
- return createStringError (errc::invalid_argument, " offset 0x%8.8" PRIx64
608
- " is not a valid debug line section offset" ,
609
- Offset);
606
+ return createStringError (errc::invalid_argument,
607
+ " offset 0x%8.8" PRIx64
608
+ " is not a valid debug line section offset" ,
609
+ Offset);
610
610
611
611
std::pair<LineTableIter, bool > Pos =
612
612
LineTableMap.insert (LineTableMapTy::value_type (Offset, LineTable ()));
@@ -966,7 +966,8 @@ Error DWARFDebugLine::LineTable::parse(
966
966
967
967
if (Cursor && Verbose) {
968
968
*OS << " (" ;
969
- DWARFFormValue::dumpAddress (*OS, OpcodeAddressSize, State.Row .Address .Address );
969
+ DWARFFormValue::dumpAddress (*OS, OpcodeAddressSize,
970
+ State.Row .Address .Address );
970
971
*OS << ' )' ;
971
972
}
972
973
}
@@ -1159,8 +1160,7 @@ Error DWARFDebugLine::LineTable::parse(
1159
1160
// DW_LNS_advance_pc. Such assemblers, however, can use
1160
1161
// DW_LNS_fixed_advance_pc instead, sacrificing compression.
1161
1162
{
1162
- uint16_t PCOffset =
1163
- TableData.getRelocatedValue (Cursor, 2 );
1163
+ uint16_t PCOffset = TableData.getRelocatedValue (Cursor, 2 );
1164
1164
if (Cursor) {
1165
1165
State.Row .Address .Address += PCOffset;
1166
1166
State.Row .OpIndex = 0 ;
@@ -1314,24 +1314,22 @@ uint32_t DWARFDebugLine::LineTable::findRowInSeq(
1314
1314
1315
1315
uint32_t
1316
1316
DWARFDebugLine::LineTable::lookupAddress (object::SectionedAddress Address,
1317
- bool Approximate,
1318
1317
bool *IsApproximateLine) const {
1319
1318
1320
1319
// Search for relocatable addresses
1321
- uint32_t Result = lookupAddressImpl (Address, Approximate, IsApproximateLine);
1320
+ uint32_t Result = lookupAddressImpl (Address, IsApproximateLine);
1322
1321
1323
1322
if (Result != UnknownRowIndex ||
1324
1323
Address.SectionIndex == object::SectionedAddress::UndefSection)
1325
1324
return Result;
1326
1325
1327
1326
// Search for absolute addresses
1328
1327
Address.SectionIndex = object::SectionedAddress::UndefSection;
1329
- return lookupAddressImpl (Address, Approximate, IsApproximateLine);
1328
+ return lookupAddressImpl (Address, IsApproximateLine);
1330
1329
}
1331
1330
1332
1331
uint32_t
1333
1332
DWARFDebugLine::LineTable::lookupAddressImpl (object::SectionedAddress Address,
1334
- bool Approximate,
1335
1333
bool *IsApproximateLine) const {
1336
1334
// First, find an instruction sequence containing the given address.
1337
1335
DWARFDebugLine::Sequence Sequence;
@@ -1343,21 +1341,21 @@ DWARFDebugLine::LineTable::lookupAddressImpl(object::SectionedAddress Address,
1343
1341
return UnknownRowIndex;
1344
1342
1345
1343
uint32_t RowIndex = findRowInSeq (*It, Address);
1346
- if (RowIndex == UnknownRowIndex || !Approximate )
1344
+ if (RowIndex == UnknownRowIndex || IsApproximateLine == nullptr )
1347
1345
return RowIndex;
1348
1346
1349
1347
// Approximation will only be attempted if a valid RowIndex exists.
1350
- if (Approximate) {
1351
- // Approximation Loop
1352
- for (uint32_t ApproxRowIndex = RowIndex;
1353
- ApproxRowIndex >= It->FirstRowIndex ; --ApproxRowIndex) {
1354
- if (Rows[ApproxRowIndex].Line )
1355
- return ApproxRowIndex;
1356
- *IsApproximateLine = true ;
1357
- }
1358
- // Approximation Loop fails to find the valid ApproxRowIndex
1359
- *IsApproximateLine = false ;
1348
+ uint32_t ApproxRowIndex = RowIndex;
1349
+ // Approximation Loop
1350
+ for (; ApproxRowIndex >= It->FirstRowIndex ; --ApproxRowIndex) {
1351
+ if (Rows[ApproxRowIndex].Line )
1352
+ return ApproxRowIndex;
1353
+ *IsApproximateLine = true ;
1360
1354
}
1355
+ // Approximation Loop fails to find the valid ApproxRowIndex
1356
+ if (ApproxRowIndex < It->FirstRowIndex )
1357
+ *IsApproximateLine = false ;
1358
+
1361
1359
return RowIndex;
1362
1360
}
1363
1361
@@ -1501,9 +1499,8 @@ bool DWARFDebugLine::LineTable::getFileLineInfoForAddress(
1501
1499
object::SectionedAddress Address, bool Approximate, const char *CompDir,
1502
1500
FileLineInfoKind Kind, DILineInfo &Result) const {
1503
1501
// Get the index of row we're looking for in the line table.
1504
-
1505
1502
uint32_t RowIndex =
1506
- lookupAddress (Address, Approximate, &Result.IsApproximatedLine );
1503
+ lookupAddress (Address, Approximate ? &Result.IsApproximateLine : nullptr );
1507
1504
if (RowIndex == -1U )
1508
1505
return false ;
1509
1506
// Take file number and line/column from the row.
0 commit comments