aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Core/Section.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/Section.cpp')
-rw-r--r--lldb/source/Core/Section.cpp36
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 &section, 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