[Lldb-commits] [PATCH] D152579: [lldb] Symtab::SectionFileAddressesChanged should clear the file address map instead of name map
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 9 12:40:30 PDT 2023
bulbazord created this revision.
bulbazord added reviewers: jasonmolenda, JDevlieghere, jingham.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Currently, `SectionFileAddressesChanged` clears out the `name_to_index`
map and sets `m_file_addr_to_index_compute` to false. This is strange,
as these two fields are used for different purposes. What we should be
doing is clearing the file address to index mapping.
There are 2 bugs here:
1. If we call SectionFileAddressesChanged after the name indexes have been computed, we end up with an empty name to index map, so lookups will fail. This doesn't happen today because we don't initialize the name indexes before calling this, but this is a refactor away from failing in this way.
2. Because we don't clear `m_file_addr_to_index` but still set it's computed flag to false, it ends up with twice the amount of information. One entry will be correct (since it was recalculated), one entry will be outdated.
rdar://110192434
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152579
Files:
lldb/source/Symbol/Symtab.cpp
Index: lldb/source/Symbol/Symtab.cpp
===================================================================
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -80,8 +80,7 @@
}
void Symtab::SectionFileAddressesChanged() {
- auto &name_to_index = GetNameToSymbolIndexMap(lldb::eFunctionNameTypeNone);
- name_to_index.Clear();
+ m_file_addr_to_index.Clear();
m_file_addr_to_index_computed = false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152579.530054.patch
Type: text/x-patch
Size: 427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230609/b655ded0/attachment-0001.bin>
More information about the lldb-commits
mailing list