[Lldb-commits] [lldb] [lldb][AIX] Support for XCOFF Sections (PR #131304)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon May 12 01:58:14 PDT 2025
================
@@ -190,7 +190,59 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {}
bool ObjectFileXCOFF::IsStripped() { return false; }
-void ObjectFileXCOFF::CreateSections(SectionList &unified_section_list) {}
+void ObjectFileXCOFF::CreateSections(SectionList &unified_section_list) {
+ if (m_sections_up)
+ return;
+
+ m_sections_up = std::make_unique<SectionList>();
+ ModuleSP module_sp(GetModule());
+
+ if (!module_sp)
+ return;
+
+ std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
+
+ const auto §ions = m_binary->sections64();
+ int idx = 0;
+ for (size_t i = 0; i < sections.size(); ++i) {
+ const llvm::object::XCOFFSectionHeader64 §ion = sections[i];
+
+ ConstString const_sect_name(section.Name);
+
+ SectionType section_type = lldb::eSectionTypeOther;
+ if (section.Flags & XCOFF::STYP_TEXT)
+ section_type = eSectionTypeCode;
+ else if (section.Flags & XCOFF::STYP_DATA)
+ section_type = eSectionTypeData;
+ else if (section.Flags & XCOFF::STYP_BSS)
+ section_type = eSectionTypeZeroFill;
+ else if (section.Flags & XCOFF::STYP_DWARF) {
+ section_type = llvm::StringSwitch<SectionType>(section.Name)
+ .Case(".dwinfo", eSectionTypeDWARFDebugInfo)
+ .Case(".dwline", eSectionTypeDWARFDebugLine)
+ .Case(".dwabrev", eSectionTypeDWARFDebugAbbrev)
+ .Default(eSectionTypeInvalid);
+
+ if (section_type == eSectionTypeInvalid)
+ section_type = lldb::eSectionTypeOther;
----------------
labath wrote:
```suggestion
.Default(eSectionTypeOther);
```
https://github.com/llvm/llvm-project/pull/131304
More information about the lldb-commits
mailing list