diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:03:47 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:04:23 +0000 |
| commit | 7fa27ce4a07f19b07799a767fc29416f3b625afb (patch) | |
| tree | 27825c83636c4de341eb09a74f49f5d38a15d165 /lldb/source/Core/Section.cpp | |
| parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) | |
Diffstat (limited to 'lldb/source/Core/Section.cpp')
| -rw-r--r-- | lldb/source/Core/Section.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 50c1562f7561..212b3119894f 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -145,6 +145,8 @@ const char *Section::GetTypeAsCString() const { return "absolute"; case eSectionTypeDWARFGNUDebugAltLink: return "dwarf-gnu-debugaltlink"; + case eSectionTypeCTF: + return "ctf"; case eSectionTypeOther: return "regular"; } @@ -452,6 +454,7 @@ bool Section::ContainsOnlyDebugInfo() const { case eSectionTypeDWARFAppleNamespaces: case eSectionTypeDWARFAppleObjC: case eSectionTypeDWARFGNUDebugAltLink: + case eSectionTypeCTF: return true; } return false; @@ -673,3 +676,36 @@ uint64_t SectionList::GetDebugInfoSize() const { } return debug_info_size; } + +namespace llvm { +namespace json { + +bool fromJSON(const llvm::json::Value &value, + lldb_private::JSONSection §ion, llvm::json::Path path) { + llvm::json::ObjectMapper o(value, path); + return o && o.map("name", section.name) && o.map("type", section.type) && + o.map("size", section.address) && o.map("size", section.size); +} + +bool fromJSON(const llvm::json::Value &value, lldb::SectionType &type, + llvm::json::Path path) { + if (auto str = value.getAsString()) { + type = llvm::StringSwitch<lldb::SectionType>(*str) + .Case("code", eSectionTypeCode) + .Case("container", eSectionTypeContainer) + .Case("data", eSectionTypeData) + .Case("debug", eSectionTypeDebug) + .Default(eSectionTypeInvalid); + + if (type == eSectionTypeInvalid) { + path.report("invalid section type"); + return false; + } + + return true; + } + path.report("expected string"); + return false; +} +} // namespace json +} // namespace llvm |
