Skip to content

Commit 88b5c74

Browse files
[lldb] Correct 32-bit build failure in StopInfoMachException.cpp (#159523)
uintptr_t is usually a good idea when handling pointers, but lldb has to handle 64-bit addresses that might be from a remote system, on a 32-bit system. So I've changed a few instances here to use addr_t which is 64-bit everywhere. Before we got: https://lab.llvm.org/buildbot/#/builders/18/builds/21247 ``` ../llvm-project/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:81:28: error: constexpr variable 'g_mte_tag_mask' must be initialized by a constant expression 81 | static constexpr uintptr_t g_mte_tag_mask = (uintptr_t)0x0f << g_mte_tag_shift; | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../llvm-project/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:81:61: note: shift count 56 >= width of type 'uintptr_t' (aka 'unsigned int') (32 bits) 81 | static constexpr uintptr_t g_mte_tag_mask = (uintptr_t)0x0f << g_mte_tag_shift; | ^ 1 error generated. ``` Original code added by #159117.
1 parent d76d0a5 commit 88b5c74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void DescribeAddressBriefly(Stream &strm, const Address &addr,
7878
}
7979

8080
static constexpr uint8_t g_mte_tag_shift = 64 - 8;
81-
static constexpr uintptr_t g_mte_tag_mask = (uintptr_t)0x0f << g_mte_tag_shift;
81+
static constexpr addr_t g_mte_tag_mask = (addr_t)0x0f << g_mte_tag_shift;
8282

8383
bool StopInfoMachException::DetermineTagMismatch(ExecutionContext &exe_ctx) {
8484
const bool IsBadAccess = m_value == 1; // EXC_BAD_ACCESS
@@ -97,7 +97,7 @@ bool StopInfoMachException::DetermineTagMismatch(ExecutionContext &exe_ctx) {
9797
m_exc_code, bad_address);
9898

9999
const uint8_t tag = (bad_address & g_mte_tag_mask) >> g_mte_tag_shift;
100-
const uint64_t canonical_addr = bad_address & ~g_mte_tag_mask;
100+
const addr_t canonical_addr = bad_address & ~g_mte_tag_mask;
101101
strm.Printf(
102102
"Note: MTE tag mismatch detected: pointer tag=%d, address=0x%" PRIx64,
103103
tag, canonical_addr);

0 commit comments

Comments
 (0)