================
@@ -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 &sections = m_binary->sections64();
+  int idx = 0;
+  for (size_t i = 0; i < sections.size(); ++i) {
+    const llvm::object::XCOFFSectionHeader64 &section = 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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to