[llvm] [Object] Beginnings of SFrame parser and dumper (PR #147294)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 01:35:59 PDT 2025


================
@@ -6428,6 +6432,55 @@ template <typename ELFT> void ELFDumper<ELFT>::printMemtag() {
   printMemtag(DynamicEntries, AndroidNoteDesc, GlobalDescriptors);
 }
 
+template <typename ELFT>
+void ELFDumper<ELFT>::printSectionsAsSFrame(ArrayRef<std::string> Sections) {
+  constexpr endianness E = ELFT::Endianness;
+  for (object::SectionRef Section :
+       getSectionRefsByNameOrIndex(ObjF, Sections)) {
+    StringRef SectionName = unwrapOrError(FileName, Section.getName());
+    W.getOStream() << '\n';
+    W.startLine() << "Contents of SFrame section '" << SectionName << "':\n";
----------------
labath wrote:

Yeah, I guess that shouldn't be an issue if one uses only the high-level printing primitives. Using python's json parser has occurred to me as well. Something like:
```
# RUN: llvm-readobj --sframe %t.2 --elf-output-style=JSON | %python -m json.tool
```
seems to do the trick. Would you like me to add it? 

https://github.com/llvm/llvm-project/pull/147294


More information about the llvm-commits mailing list