[Lldb-commits] [lldb] [lldb] Fix format string (PR #204837)
Sergei Barannikov via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 19 07:26:58 PDT 2026
https://github.com/s-barannikov updated https://github.com/llvm/llvm-project/pull/204837
>From ca484adc7a5e02315f1c755bb0c3a2e23b6ebdce Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Fri, 19 Jun 2026 17:15:01 +0300
Subject: [PATCH 1/2] [lldb] Fix format string
GetLoadAddress() returns an integer value, not a null-terminated string.
---
lldb/source/Target/Target.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 3076cbd1b3781..ebb66b559841e 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3087,8 +3087,8 @@ Target::ReadInstructions(const Address &start_addr, uint32_t count,
force_live_memory, &load_addr);
if (error.Fail())
- return llvm::createStringError(
- error.AsCString("Target::ReadInstructions failed to read memory at %s"),
+ return llvm::createStringErrorV(
+ error.AsCString("Target::ReadInstructions failed to read memory at {}"),
start_addr.GetLoadAddress(this));
const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
>From 6ff1d83ec033be0650f6c2d2f72b8545965811bf Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Fri, 19 Jun 2026 17:26:40 +0300
Subject: [PATCH 2/2] Print the address as hex
---
lldb/source/Target/Target.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index ebb66b559841e..685fdae52fc7c 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3088,7 +3088,8 @@ Target::ReadInstructions(const Address &start_addr, uint32_t count,
if (error.Fail())
return llvm::createStringErrorV(
- error.AsCString("Target::ReadInstructions failed to read memory at {}"),
+ error.AsCString(
+ "Target::ReadInstructions failed to read memory at {:x}"),
start_addr.GetLoadAddress(this));
const bool data_from_file = load_addr == LLDB_INVALID_ADDRESS;
More information about the lldb-commits
mailing list