diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -593,7 +593,10 @@ return false; } - ABISP abi = m_exe_ctx.GetProcessPtr()->GetABI(); + ABISP abi; + if (Process * proc = m_exe_ctx.GetProcessPtr()) + abi = proc->GetABI(); + if (abi) addr = abi->FixDataAddress(addr); diff --git a/lldb/test/Shell/Driver/TestPageZeroRead.test b/lldb/test/Shell/Driver/TestPageZeroRead.test new file mode 100644 --- /dev/null +++ b/lldb/test/Shell/Driver/TestPageZeroRead.test @@ -0,0 +1,3 @@ +# Ensure that the read from memory command doesn't try and read from page zero. +# RUN: %clang_host %p/Inputs/hello.c -g -o a.out +# RUN: %lldb -b a.out -o 'x 0'