[Lldb-commits] [lldb] ObjectFileJSON and Section changes to support section.address field i… (PR #101062)

Ilhan Raja via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 29 11:48:14 PDT 2024


https://github.com/YungRaj created https://github.com/llvm/llvm-project/pull/101062

This is a dummy pull request to demonstrate the changes I made in to get symbolication working using JSON Object/Symbol files

https://discourse.llvm.org/t/lldb-support-renaming-symbols-by-address-using-a-symbol-file-provided-by-json-or-other-formatted-data-to-assist-reverse-engineering-e-g-protobuf-plist-xml-etc/80355/8


>From 47af2b7229eaa6712fe5812e3d4dbea44bbb212b Mon Sep 17 00:00:00 2001
From: Ilhan Raja <ilhan.raja at icloud.com>
Date: Mon, 29 Jul 2024 11:43:47 -0700
Subject: [PATCH] ObjectFileJSON and Section changes to support section.address
 field in JSON object symmbol files

---
 lldb/source/Core/Section.cpp                           | 2 +-
 lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 0763e88d4608f..f138d62fb356d 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -685,7 +685,7 @@ 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);
+         o.map("address", section.address) && o.map("size", section.size);
 }
 
 bool fromJSON(const llvm::json::Value &value, lldb::SectionType &type,
diff --git a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
index ffbd87714242c..0ee827355f060 100644
--- a/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
+++ b/lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp
@@ -183,7 +183,7 @@ void ObjectFileJSON::CreateSections(SectionList &unified_section_list) {
   for (const auto &section : m_sections) {
     auto section_sp = std::make_shared<Section>(
         GetModule(), this, id++, ConstString(section.name),
-        section.type.value_or(eSectionTypeCode), 0, section.size.value_or(0), 0,
+        section.type.value_or(eSectionTypeCode), section.address.value_or(0), section.size.value_or(0), 0,
         section.size.value_or(0), /*log2align*/ 0, /*flags*/ 0);
     m_sections_up->AddSection(section_sp);
     unified_section_list.AddSection(section_sp);



More information about the lldb-commits mailing list