diff options
Diffstat (limited to 'source/Symbol/LineTable.cpp')
| -rw-r--r-- | source/Symbol/LineTable.cpp | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/source/Symbol/LineTable.cpp b/source/Symbol/LineTable.cpp index 3cb305302927..06e30219f09a 100644 --- a/source/Symbol/LineTable.cpp +++ b/source/Symbol/LineTable.cpp @@ -73,30 +73,24 @@ void LineTable::AppendLineEntryToSequence( is_terminal_entry); entry_collection &entries = seq->m_entries; // Replace the last entry if the address is the same, otherwise append it. If - // we have multiple - // line entries at the same address, this indicates illegal DWARF so this - // "fixes" the line table - // to be correct. If not fixed this can cause a line entry's address that when - // resolved back to - // a symbol context, could resolve to a different line entry. We really want a + // we have multiple line entries at the same address, this indicates illegal + // DWARF so this "fixes" the line table to be correct. If not fixed this can + // cause a line entry's address that when resolved back to a symbol context, + // could resolve to a different line entry. We really want a // 1 to 1 mapping - // here to avoid these kinds of inconsistencies. We will need tor revisit this - // if the DWARF line - // tables are updated to allow multiple entries at the same address legally. + // here to avoid these kinds of inconsistencies. We will need tor revisit + // this if the DWARF line tables are updated to allow multiple entries at the + // same address legally. if (!entries.empty() && entries.back().file_addr == file_addr) { // GCC don't use the is_prologue_end flag to mark the first instruction // after the prologue. // Instead of it it is issuing a line table entry for the first instruction - // of the prologue - // and one for the first instruction after the prologue. If the size of the - // prologue is 0 - // instruction then the 2 line entry will have the same file address. - // Removing it will remove - // our ability to properly detect the location of the end of prologe so we - // set the prologue_end - // flag to preserve this information (setting the prologue_end flag for an - // entry what is after - // the prologue end don't have any effect) + // of the prologue and one for the first instruction after the prologue. If + // the size of the prologue is 0 instruction then the 2 line entry will + // have the same file address. Removing it will remove our ability to + // properly detect the location of the end of prologe so we set the + // prologue_end flag to preserve this information (setting the prologue_end + // flag for an entry what is after the prologue end don't have any effect) entry.is_prologue_end = entry.file_idx == entries.back().file_idx; entries.back() = entry; } else @@ -200,14 +194,13 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr, if (pos->file_addr != search_entry.file_addr) --pos; else if (pos->file_addr == search_entry.file_addr) { - // If this is a termination entry, it shouldn't match since - // entries with the "is_terminal_entry" member set to true - // are termination entries that define the range for the - // previous entry. + // If this is a termination entry, it shouldn't match since entries + // with the "is_terminal_entry" member set to true are termination + // entries that define the range for the previous entry. if (pos->is_terminal_entry) { - // The matching entry is a terminal entry, so we skip - // ahead to the next entry to see if there is another - // entry following this one whose section/offset matches. + // The matching entry is a terminal entry, so we skip ahead to + // the next entry to see if there is another entry following this + // one whose section/offset matches. ++pos; if (pos != end_pos) { if (pos->file_addr != search_entry.file_addr) @@ -216,9 +209,8 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr, } if (pos != end_pos) { - // While in the same section/offset backup to find the first - // line entry that matches the address in case there are - // multiple + // While in the same section/offset backup to find the first line + // entry that matches the address in case there are multiple while (pos != begin_pos) { entry_collection::const_iterator prev_pos = pos - 1; if (prev_pos->file_addr == search_entry.file_addr && @@ -232,16 +224,15 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr, } else { - // There might be code in the containing objfile before the first line - // table entry. Make sure that does not get considered part of the first - // line table entry. + // There might be code in the containing objfile before the first + // line table entry. Make sure that does not get considered part of + // the first line table entry. if (pos->file_addr > so_addr.GetFileAddress()) return false; } // Make sure we have a valid match and that the match isn't a - // terminating - // entry for a previous line... + // terminating entry for a previous line... if (pos != end_pos && pos->is_terminal_entry == false) { uint32_t match_idx = std::distance(begin_pos, pos); success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry); @@ -304,8 +295,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex( continue; // Exact match always wins. Otherwise try to find the closest line > the - // desired - // line. + // desired line. // FIXME: Maybe want to find the line closest before and the line closest // after and // if they're not in the same function, don't return a match. @@ -349,8 +339,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex(uint32_t start_idx, continue; // Exact match always wins. Otherwise try to find the closest line > the - // desired - // line. + // desired line. // FIXME: Maybe want to find the line closest before and the line closest // after and // if they're not in the same function, don't return a match. @@ -389,8 +378,8 @@ size_t LineTable::FineLineEntriesForFileIndex(uint32_t file_idx, bool append, SymbolContext sc(m_comp_unit); for (size_t idx = 0; idx < count; ++idx) { - // Skip line table rows that terminate the previous row (is_terminal_entry - // is non-zero) + // Skip line table rows that terminate the previous row + // (is_terminal_entry is non-zero) if (m_entries[idx].is_terminal_entry) continue; @@ -497,10 +486,9 @@ LineTable *LineTable::LinkLineTable(const FileRangeMap &file_range_map) { terminate_previous_entry = prev_entry_was_linked; } } else if (prev_entry_was_linked) { - // This entry doesn't have a remapping and it needs to be removed. - // Watch out in case we need to terminate a previous entry needs to - // be terminated now that one line entry in a sequence is not longer - // valid. + // This entry doesn't have a remapping and it needs to be removed. Watch + // out in case we need to terminate a previous entry needs to be + // terminated now that one line entry in a sequence is not longer valid. if (!sequence.m_entries.empty() && !sequence.m_entries.back().is_terminal_entry) { terminate_previous_entry = true; |
