[Lldb-commits] [lldb] [lldb] Add SubtargetFeatures to ArchSpec (PR #173046)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 5 09:38:15 PST 2026
================
@@ -1405,6 +1409,117 @@ void ObjectFileELF::ParseARMAttributes(DataExtractor &data, uint64_t length,
}
}
+static std::optional<lldb::offset_t>
+FindSubSectionOffsetByName(const DataExtractor &data, lldb::offset_t offset,
+ uint32_t length, llvm::StringRef name) {
+ uint32_t section_length = 0;
+ llvm::StringRef section_name;
+ do {
+ offset += section_length;
+ // Sub-section's size and name are included in the total sub-section length.
+ // Don't shift the offset here, so it will point at the beginning of the
+ // sub-section and could be used as a return value.
+ auto tmp_offset = offset;
+ section_length = data.GetU32(&tmp_offset);
+ section_name = data.GetCStr(&tmp_offset);
+ } while (section_name != name && offset + section_length < length);
+ if (section_name == name)
+ return offset;
+ return std::nullopt;
+}
+
+static std::optional<lldb::offset_t>
+FindSubSubSectionOffsetByTag(const DataExtractor &data, lldb::offset_t offset,
+ unsigned tag) {
+ // Consume a sub-section size and name to shift the offset at the beginning of
+ // the sub-sub-sections list.
+ auto upper_section_length = data.GetU32(&offset);
+ data.GetCStr(&offset);
+ auto upper_section_end_offset = offset + upper_section_length;
+
+ uint32_t section_length = 0;
+ unsigned section_tag = 0;
+ do {
+ offset += section_length;
+ // Similar to sub-section sub-sub-section's tag and size are included in the
+ // total sub-sub-section length.
+ auto tmp_offset = offset;
+ section_tag = data.GetULEB128(&tmp_offset);
+ section_length = data.GetU32(&tmp_offset);
+ } while (section_tag != tag &&
+ offset + section_length < upper_section_end_offset);
+ if (section_tag == tag)
+ return offset;
+ return std::nullopt;
+}
+
+static std::optional<std::variant<uint64_t, llvm::StringRef>>
+GetSubSubSubSectionValue(const DataExtractor &data, lldb::offset_t offset,
+ unsigned tag) {
+ // Consume a sub-sub-section tag and size to shift the offset at the beginning
+ // of the sub-sub-sub-sections list.
----------------
daniilavdeev wrote:
I have left an appropriate comment describing the structure of the .riscv.attributes section.
https://github.com/llvm/llvm-project/pull/173046
More information about the lldb-commits
mailing list