[Lldb-commits] [lldb] [lldb] Use raw address in "memory history" command (PR #185812)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 10 23:17:30 PDT 2026


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/185812

The `memory history` command was using `ToAddress` for its  address argument, which strips non-addressable bits (including MTE tag bits) via FixAnyAddress. This caused us to pass a stripped address to `__asan_get_alloc_stack`/`__asan_get_free_stack`, which is incorrect. Switch to `ToRawAddress` to preserve the complete address, including the MTE tag, so we can look up the correct address.

>From 4fc455552c33dc964b90009491e81298189a8037 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Tue, 10 Mar 2026 23:11:20 -0700
Subject: [PATCH] [lldb] Use raw address in "memory history" command

The `memory history` command was using ToAddress to evaluate the address
argument, which strips non-address bits (including MTE tag bits) via
FixAnyAddress. This caused us to pass a stripped address to
__asan_get_alloc_stack/__asan_get_free_stack which is incorrect.

Switch to ToRawAddress to preserve the address, including the MTE tag,
so the instrumentation runtime plugin can find the correct address.
---
 lldb/source/Commands/CommandObjectMemory.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 1ca98ac1a4bde..3b416028ee410 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1567,7 +1567,7 @@ class CommandObjectMemoryHistory : public CommandObjectParsed {
     }
 
     Status error;
-    lldb::addr_t addr = OptionArgParser::ToAddress(
+    lldb::addr_t addr = OptionArgParser::ToRawAddress(
         &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
 
     if (addr == LLDB_INVALID_ADDRESS) {



More information about the lldb-commits mailing list