aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2021-12-01 16:14:54 +0000
committerDavid Spickett <david.spickett@linaro.org>2022-02-10 10:42:49 +0000
commit2937b282188bafb6bdb65ee87c70e9109aa910b7 (patch)
treebcac3410f25d2496ac9677889ed13ca8bbbdc81a /lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
parent6da728ad9945e070c0860cc2841deb148a7d76b4 (diff)
downloadllvm-2937b282188bafb6bdb65ee87c70e9109aa910b7.zip
llvm-2937b282188bafb6bdb65ee87c70e9109aa910b7.tar.gz
llvm-2937b282188bafb6bdb65ee87c70e9109aa910b7.tar.bz2
Reland "[lldb] Remove non address bits when looking up memory regions"
This reverts commit 0df522969a7a0128052bd79182c8d58e00556e2f. Additional checks are added to fix the detection of the last memory region in GetMemoryRegions or repeating the "memory region" command when the target has non-address bits. Normally you keep reading from address 0, looking up each region's end address until you get LLDB_INVALID_ADDR as the region end address. (0xffffffffffffffff) This is what the remote will return once you go beyond the last mapped region: [0x0000fffffffdf000-0x0001000000000000) rw- [stack] [0x0001000000000000-0xffffffffffffffff) --- Problem is that when we "fix" the lookup address, we remove some bits from it. On an AArch64 system we have 48 bit virtual addresses, so when we fix the end address of the [stack] region the result is 0. So we loop back to the start. [0x0000fffffffdf000-0x0001000000000000) rw- [stack] [0x0000000000000000-0x0000000000400000) --- To fix this I added an additional check for the last range. If the end address of the region is different once you apply FixDataAddress, we are at the last region. Since the end of the last region will be the last valid mappable address, plus 1. That 1 will be removed by the ABI plugin. The only side effect is that on systems with non-address bits, you won't get that last catch all unmapped region from the max virtual address up to 0xf...f. [0x0000fffff8000000-0x0000fffffffdf000) --- [0x0000fffffffdf000-0x0001000000000000) rw- [stack] <ends here> Though in some way this is more correct because that region is not just unmapped, it's not mappable at all. No extra testing is needed because this is already covered by TestMemoryRegion.py, I simply forgot to run it on system that had both top byte ignore and pointer authentication. This change has been tested on a qemu VM with top byte ignore, memory tagging and pointer authentication enabled. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D115508
Diffstat (limited to 'lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp')
-rw-r--r--lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index f952774..f98c415 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -245,8 +245,8 @@ ArchSpec ScriptedProcess::GetArchitecture() {
return GetTarget().GetArchitecture();
}
-Status ScriptedProcess::GetMemoryRegionInfo(lldb::addr_t load_addr,
- MemoryRegionInfo &region) {
+Status ScriptedProcess::DoGetMemoryRegionInfo(lldb::addr_t load_addr,
+ MemoryRegionInfo &region) {
CheckInterpreterAndScriptObject();
Status error;