[Lldb-commits] [PATCH] D93621: [lldb][wasm] Parse DWO section names

Philip Pfaffe via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 21 02:06:37 PST 2020


pfaffe created this revision.
Herald added subscribers: sunfish, sbc100.
pfaffe requested review of this revision.
Herald added subscribers: lldb-commits, aheejin.
Herald added a project: LLDB.

Mirror ELF section parsing to support DWARF section names for
debug fission.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93621

Files:
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp


Index: lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -253,6 +253,43 @@
 
 Symtab *ObjectFileWasm::GetSymtab() { return nullptr; }
 
+static SectionType GetSectionTypeFromName(llvm::StringRef Name) {
+  if (Name.consume_front(".debug_") || Name.consume_front(".zdebug_")) {
+    return llvm::StringSwitch<SectionType>(Name)
+        .Case("abbrev", eSectionTypeDWARFDebugAbbrev)
+        .Case("abbrev.dwo", eSectionTypeDWARFDebugAbbrevDwo)
+        .Case("addr", eSectionTypeDWARFDebugAddr)
+        .Case("aranges", eSectionTypeDWARFDebugAranges)
+        .Case("cu_index", eSectionTypeDWARFDebugCuIndex)
+        .Case("frame", eSectionTypeDWARFDebugFrame)
+        .Case("info", eSectionTypeDWARFDebugInfo)
+        .Case("info.dwo", eSectionTypeDWARFDebugInfoDwo)
+        .Cases("line", "line.dwo", eSectionTypeDWARFDebugLine)
+        .Cases("line_str", "line_str.dwo", eSectionTypeDWARFDebugLineStr)
+        .Case("loc", eSectionTypeDWARFDebugLoc)
+        .Case("loc.dwo", eSectionTypeDWARFDebugLocDwo)
+        .Case("loclists", eSectionTypeDWARFDebugLocLists)
+        .Case("loclists.dwo", eSectionTypeDWARFDebugLocListsDwo)
+        .Case("macinfo", eSectionTypeDWARFDebugMacInfo)
+        .Cases("macro", "macro.dwo", eSectionTypeDWARFDebugMacro)
+        .Case("names", eSectionTypeDWARFDebugNames)
+        .Case("pubnames", eSectionTypeDWARFDebugPubNames)
+        .Case("pubtypes", eSectionTypeDWARFDebugPubTypes)
+        .Case("ranges", eSectionTypeDWARFDebugRanges)
+        .Case("rnglists", eSectionTypeDWARFDebugRngLists)
+        .Case("rnglists.dwo", eSectionTypeDWARFDebugRngListsDwo)
+        .Case("str", eSectionTypeDWARFDebugStr)
+        .Case("str.dwo", eSectionTypeDWARFDebugStrDwo)
+        .Case("str_offsets", eSectionTypeDWARFDebugStrOffsets)
+        .Case("str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
+        .Case("tu_index", eSectionTypeDWARFDebugTuIndex)
+        .Case("types", eSectionTypeDWARFDebugTypes)
+        .Case("types.dwo", eSectionTypeDWARFDebugTypesDwo)
+        .Default(eSectionTypeOther);
+  }
+  return eSectionTypeOther;
+}
+
 void ObjectFileWasm::CreateSections(SectionList &unified_section_list) {
   if (m_sections_up)
     return;
@@ -280,29 +317,7 @@
       // Code section.
       vm_addr = 0;
     } else {
-      section_type =
-          llvm::StringSwitch<SectionType>(sect_info.name.GetStringRef())
-              .Case(".debug_abbrev", eSectionTypeDWARFDebugAbbrev)
-              .Case(".debug_addr", eSectionTypeDWARFDebugAddr)
-              .Case(".debug_aranges", eSectionTypeDWARFDebugAranges)
-              .Case(".debug_cu_index", eSectionTypeDWARFDebugCuIndex)
-              .Case(".debug_frame", eSectionTypeDWARFDebugFrame)
-              .Case(".debug_info", eSectionTypeDWARFDebugInfo)
-              .Case(".debug_line", eSectionTypeDWARFDebugLine)
-              .Case(".debug_line_str", eSectionTypeDWARFDebugLineStr)
-              .Case(".debug_loc", eSectionTypeDWARFDebugLoc)
-              .Case(".debug_loclists", eSectionTypeDWARFDebugLocLists)
-              .Case(".debug_macinfo", eSectionTypeDWARFDebugMacInfo)
-              .Case(".debug_macro", eSectionTypeDWARFDebugMacro)
-              .Case(".debug_names", eSectionTypeDWARFDebugNames)
-              .Case(".debug_pubnames", eSectionTypeDWARFDebugPubNames)
-              .Case(".debug_pubtypes", eSectionTypeDWARFDebugPubTypes)
-              .Case(".debug_ranges", eSectionTypeDWARFDebugRanges)
-              .Case(".debug_rnglists", eSectionTypeDWARFDebugRngLists)
-              .Case(".debug_str", eSectionTypeDWARFDebugStr)
-              .Case(".debug_str_offsets", eSectionTypeDWARFDebugStrOffsets)
-              .Case(".debug_types", eSectionTypeDWARFDebugTypes)
-              .Default(eSectionTypeOther);
+      section_type = GetSectionTypeFromName(sect_info.name.GetStringRef());
       if (section_type == eSectionTypeOther)
         continue;
       section_name = sect_info.name;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93621.313043.patch
Type: text/x-patch
Size: 4169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201221/c8fb203d/attachment.bin>


More information about the lldb-commits mailing list