[Lldb-commits] [PATCH] D116195: [LLDB] Allows overwriting the existing line entry at given file address when inserting
Zequan Wu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 22 16:27:31 PST 2021
zequanwu created this revision.
zequanwu added reviewers: labath, clayborg.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
It seems like that line entries in line table are assumed to always have
distinct file address. This allows overwriting the existing line entry if the
given file address is same as existing one.
The reason for the patch is that line table in PDB doesn't have line entries for
inlined functions. We can only get line info for inlined functions via parsing
inlined call site debug info (`S_INLINESITE`). This allows us to insert line
entries when we parsing `S_INLINESITE`, which could have line with the same
starting file address.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116195
Files:
lldb/include/lldb/Symbol/LineTable.h
lldb/source/Symbol/LineTable.cpp
Index: lldb/source/Symbol/LineTable.cpp
===================================================================
--- lldb/source/Symbol/LineTable.cpp
+++ lldb/source/Symbol/LineTable.cpp
@@ -41,7 +41,8 @@
bool is_start_of_statement,
bool is_start_of_basic_block,
bool is_prologue_end, bool is_epilogue_begin,
- bool is_terminal_entry) {
+ bool is_terminal_entry,
+ bool overwrite_existing) {
Entry entry(file_addr, line, column, file_idx, is_start_of_statement,
is_start_of_basic_block, is_prologue_end, is_epilogue_begin,
is_terminal_entry);
@@ -49,7 +50,14 @@
LineTable::Entry::LessThanBinaryPredicate less_than_bp(this);
entry_collection::iterator pos =
llvm::upper_bound(m_entries, entry, less_than_bp);
-
+ if (overwrite_existing && pos != m_entries.begin()) {
+ --pos;
+ if (pos->file_addr == file_addr) {
+ uint32_t idx = std::distance(m_entries.begin(), pos);
+ m_entries[idx] = entry;
+ return;
+ }
+ }
// Stream s(stdout);
// s << "\n\nBefore:\n";
// Dump (&s, Address::DumpStyleFileAddress);
Index: lldb/include/lldb/Symbol/LineTable.h
===================================================================
--- lldb/include/lldb/Symbol/LineTable.h
+++ lldb/include/lldb/Symbol/LineTable.h
@@ -71,7 +71,8 @@
void InsertLineEntry(lldb::addr_t file_addr, uint32_t line, uint16_t column,
uint16_t file_idx, bool is_start_of_statement,
bool is_start_of_basic_block, bool is_prologue_end,
- bool is_epilogue_begin, bool is_terminal_entry);
+ bool is_epilogue_begin, bool is_terminal_entry,
+ bool overwrite_existing = false);
// Used to instantiate the LineSequence helper class
static std::unique_ptr<LineSequence> CreateLineSequenceContainer();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116195.395944.patch
Type: text/x-patch
Size: 2045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211223/fc0050bf/attachment.bin>
More information about the lldb-commits
mailing list