[llvm] [llvm-readobj][ELF] Implement JSON output for --dynamic-table (PR #95976)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 00:52:00 PDT 2024


================
@@ -7365,6 +7367,19 @@ template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicTable() {
   W.startLine() << "]\n";
 }
 
+template <class ELFT> void JSONELFDumper<ELFT>::printDynamicTable() {
+  Elf_Dyn_Range Table = this->dynamic_table();
+  ListScope L(this->W, "DynamicSection");
+  for (const auto &Entry : Table) {
+    DictScope D(this->W);
+    uintX_t Tag = Entry.getTag();
+    std::string Value = this->getDynamicEntry(Tag, Entry.getVal());
+    this->W.printHex("Tag", Tag);
+    this->W.printString("Value", Value);
+    this->W.printString("Type", this->Obj.getDynamicTagAsString(Tag));
----------------
jh7370 wrote:

Sorry, forgot to respond to this: current format is basically fine now, thanks. I'll continue reviewing and make any more comments I find.

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


More information about the llvm-commits mailing list