bulbazord created this revision. bulbazord added reviewers: JDevlieghere, aprantl, fdeazeve, kastiglione, augusto2112. Herald added a subscriber: emaste. Herald added a project: All. bulbazord requested review of this revision. Herald added subscribers: lldb-commits, MaskRay. Herald added a project: LLDB.
In Apple's downstream fork, there is support for understanding the swift AST sections in various binaries. Even though the lldb on llvm.org does not have support for debugging swift, I think it makes sense to move support for recognizing swift ast sections upstream. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D159142 Files: lldb/include/lldb/lldb-enumerations.h lldb/source/Core/Section.cpp lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Symbol/ObjectFile.cpp Index: lldb/source/Symbol/ObjectFile.cpp =================================================================== --- lldb/source/Symbol/ObjectFile.cpp +++ lldb/source/Symbol/ObjectFile.cpp @@ -357,6 +357,7 @@ case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: case eSectionTypeCTF: + case eSectionTypeSwiftModules: return AddressClass::eDebug; case eSectionTypeEHFrame: case eSectionTypeARMexidx: Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp =================================================================== --- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -1009,6 +1009,7 @@ // .eh_frame can be truncated to 8 chars. .Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame) .Case(".gosymtab", eSectionTypeGoSymtab) + .Case("swiftast", eSectionTypeSwiftModules) .Default(eSectionTypeInvalid); if (section_type != eSectionTypeInvalid) return section_type; Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1202,6 +1202,7 @@ case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: case eSectionTypeCTF: + case eSectionTypeSwiftModules: return AddressClass::eDebug; case eSectionTypeEHFrame: @@ -1476,6 +1477,7 @@ static ConstString g_sect_name_data("__data"); static ConstString g_sect_name_go_symtab("__gosymtab"); static ConstString g_sect_name_ctf("__ctf"); + static ConstString g_sect_name_swift_ast("__swift_ast"); if (section_name == g_sect_name_dwarf_debug_abbrev) return eSectionTypeDWARFDebugAbbrev; @@ -1555,6 +1557,8 @@ return eSectionTypeGoSymtab; if (section_name == g_sect_name_ctf) return eSectionTypeCTF; + if (section_name == g_sect_name_swift_ast) + return eSectionTypeSwiftModules; if (section_name == g_sect_name_objc_data || section_name == g_sect_name_objc_classrefs || section_name == g_sect_name_objc_superrefs || Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1679,6 +1679,7 @@ .Case(".gnu_debugaltlink", eSectionTypeDWARFGNUDebugAltLink) .Case(".gosymtab", eSectionTypeGoSymtab) .Case(".text", eSectionTypeCode) + .Case(".swift_ast", eSectionTypeSwiftModules) .Default(eSectionTypeOther); } Index: lldb/source/Core/Section.cpp =================================================================== --- lldb/source/Core/Section.cpp +++ lldb/source/Core/Section.cpp @@ -149,6 +149,8 @@ return "ctf"; case eSectionTypeOther: return "regular"; + case eSectionTypeSwiftModules: + return "swift-modules"; } return "unknown"; } @@ -455,6 +457,7 @@ case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: case eSectionTypeCTF: + case eSectionTypeSwiftModules: return true; } return false; Index: lldb/include/lldb/lldb-enumerations.h =================================================================== --- lldb/include/lldb/lldb-enumerations.h +++ lldb/include/lldb/lldb-enumerations.h @@ -739,6 +739,7 @@ eSectionTypeDWARFDebugLocListsDwo, eSectionTypeDWARFDebugTuIndex, eSectionTypeCTF, + eSectionTypeSwiftModules, }; FLAGS_ENUM(EmulateInstructionOptions){
Index: lldb/source/Symbol/ObjectFile.cpp =================================================================== --- lldb/source/Symbol/ObjectFile.cpp +++ lldb/source/Symbol/ObjectFile.cpp @@ -357,6 +357,7 @@ case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: case eSectionTypeCTF: + case eSectionTypeSwiftModules: return AddressClass::eDebug; case eSectionTypeEHFrame: case eSectionTypeARMexidx: Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp =================================================================== --- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -1009,6 +1009,7 @@ // .eh_frame can be truncated to 8 chars. .Cases(".eh_frame", ".eh_fram", eSectionTypeEHFrame) .Case(".gosymtab", eSectionTypeGoSymtab) + .Case("swiftast", eSectionTypeSwiftModules) .Default(eSectionTypeInvalid); if (section_type != eSectionTypeInvalid) return section_type; Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1202,6 +1202,7 @@ case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: case eSectionTypeCTF: + case eSectionTypeSwiftModules: return AddressClass::eDebug; case eSectionTypeEHFrame: @@ -1476,6 +1477,7 @@ static ConstString g_sect_name_data("__data"); static ConstString g_sect_name_go_symtab("__gosymtab"); static ConstString g_sect_name_ctf("__ctf"); + static ConstString g_sect_name_swift_ast("__swift_ast"); if (section_name == g_sect_name_dwarf_debug_abbrev) return eSectionTypeDWARFDebugAbbrev; @@ -1555,6 +1557,8 @@ return eSectionTypeGoSymtab; if (section_name == g_sect_name_ctf) return eSectionTypeCTF; + if (section_name == g_sect_name_swift_ast) + return eSectionTypeSwiftModules; if (section_name == g_sect_name_objc_data || section_name == g_sect_name_objc_classrefs || section_name == g_sect_name_objc_superrefs || Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1679,6 +1679,7 @@ .Case(".gnu_debugaltlink", eSectionTypeDWARFGNUDebugAltLink) .Case(".gosymtab", eSectionTypeGoSymtab) .Case(".text", eSectionTypeCode) + .Case(".swift_ast", eSectionTypeSwiftModules) .Default(eSectionTypeOther); } Index: lldb/source/Core/Section.cpp =================================================================== --- lldb/source/Core/Section.cpp +++ lldb/source/Core/Section.cpp @@ -149,6 +149,8 @@ return "ctf"; case eSectionTypeOther: return "regular"; + case eSectionTypeSwiftModules: + return "swift-modules"; } return "unknown"; } @@ -455,6 +457,7 @@ case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: case eSectionTypeCTF: + case eSectionTypeSwiftModules: return true; } return false; Index: lldb/include/lldb/lldb-enumerations.h =================================================================== --- lldb/include/lldb/lldb-enumerations.h +++ lldb/include/lldb/lldb-enumerations.h @@ -739,6 +739,7 @@ eSectionTypeDWARFDebugLocListsDwo, eSectionTypeDWARFDebugTuIndex, eSectionTypeCTF, + eSectionTypeSwiftModules, }; FLAGS_ENUM(EmulateInstructionOptions){
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits