aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorDave Lee <davelee.com@gmail.com>2025-09-10 09:53:54 -0700
committerGitHub <noreply@github.com>2025-09-10 09:53:54 -0700
commitb574e63f9fd1adb52786f9dc03ec6f479229e1a7 (patch)
tree164bb420f584d2dd2fff980c703a11b1b822bc74 /lldb/source/Commands/CommandObjectMemory.cpp
parent7c66302343186decf6c541aefab1bc72ffea0a3b (diff)
downloadllvm-b574e63f9fd1adb52786f9dc03ec6f479229e1a7.zip
llvm-b574e63f9fd1adb52786f9dc03ec6f479229e1a7.tar.gz
llvm-b574e63f9fd1adb52786f9dc03ec6f479229e1a7.tar.bz2
[lldb] Pass execution context to CompilerType::GetByteSize - in CommandObjectMemoryRead (NFC) (#157750)
Some type systems require an execution context be available when working with types (ex: Swift). This fixes `memory read --type` to support such type systems, by passing in an execution context to `GetByteSize()`, instead of passing null. rdar://158968545
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index af1ff3e..5786e75 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -365,6 +365,8 @@ protected:
return;
}
+ ExecutionContextScope *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
+
CompilerType compiler_type;
Status error;
@@ -520,7 +522,7 @@ protected:
--pointer_count;
}
- auto size_or_err = compiler_type.GetByteSize(nullptr);
+ auto size_or_err = compiler_type.GetByteSize(exe_scope);
if (!size_or_err) {
result.AppendErrorWithFormat(
"unable to get the byte size of the type '%s'\n%s",
@@ -640,7 +642,7 @@ protected:
if (!m_format_options.GetFormatValue().OptionWasSet())
m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
- auto size_or_err = compiler_type.GetByteSize(nullptr);
+ auto size_or_err = compiler_type.GetByteSize(exe_scope);
if (!size_or_err) {
result.AppendError(llvm::toString(size_or_err.takeError()));
return;
@@ -800,7 +802,6 @@ protected:
output_stream_p = &result.GetOutputStream();
}
- ExecutionContextScope *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
if (compiler_type.GetOpaqueQualType()) {
for (uint32_t i = 0; i < item_count; ++i) {
addr_t item_addr = addr + (i * item_byte_size);