[Lldb-commits] [lldb] [LLDB] Fix debuginfo ELF files overwriting Unified Section List (PR #166635)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 5 13:35:36 PST 2025


================
@@ -1967,10 +2003,11 @@ void ObjectFileELF::CreateSections(SectionList &unified_section_list) {
     provider.AddSection(std::move(*InfoOr), std::move(section_sp));
   }
 
-  // For eTypeDebugInfo files, the Symbol Vendor will take care of updating the
-  // unified section list.
-  if (GetType() != eTypeDebugInfo)
-    unified_section_list = *m_sections_up;
+  // Merge the two adding any new sections, and overwriting any existing
+  // sections that are SHT_NOBITS
+  std::shared_ptr<SectionList> merged_section_list =
+      SectionList::Merge(unified_section_list, *m_sections_up, MergeSections);
+  unified_section_list = *merged_section_list;
----------------
clayborg wrote:

```
unified_section_list = SectionList::Merge(unified_section_list, *m_sections_up, MergeSections);
```
The only issue I can see with this is what happens if you replace a section that was loaded in the target with a newer better section. The target might have one of the sections loaded.

I also don't see you recursing into the section's child sections, which is where most of the problems come from. So something more needs to be done here.

https://github.com/llvm/llvm-project/pull/166635


More information about the lldb-commits mailing list