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

via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 29 11:49:05 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Ilhan Raja (YungRaj)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/101062.diff


2 Files Affected:

- (modified) lldb/source/Core/Section.cpp (+1-1) 
- (modified) lldb/source/Plugins/ObjectFile/JSON/ObjectFileJSON.cpp (+1-1) 


``````````diff
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);

``````````

</details>


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


More information about the lldb-commits mailing list