llvm-project/lldb/test/API
David Spickett 88fdce5be6 [lldb] Remove non address bits from memory read arguments
Addresses on AArch64 can have top byte tags, memory tags and pointer
authentication signatures in the upper bits.

While testing memory tagging I found that memory read couldn't
read a range if the two addresses had different tags. The same
could apply to signed pointers given the right circumstance.

(lldb) memory read mte_buf_alt_tag mte_buf+16
error: end address (0x900fffff7ff8010) must be greater than the start
address (0xa00fffff7ff8000).

Or it would try to read a lot more memory than expected.

(lldb) memory read mte_buf mte_buf_alt_tag+16
error: Normally, 'memory read' will not read over 1024 bytes of data.
error: Please use --force to override this restriction just once.
error: or set target.max-memory-read-size if you will often need a
larger limit.

Fix this by removing non address bits before we calculate the read
range. A test is added for AArch64 Linux that confirms this by using
the top byte ignore feature.

This means that if you do read with a tagged pointer the output
does not include those tags. This is potentially confusing but I think
overall it's better that we don't pretend that we're reading memory
from a range that the process is unable to map.

(lldb) p ptr1
(char *) $4 = 0x3400fffffffff140 "\x80\xf1\xff\xff\xff\xff"
(lldb) p ptr2
(char *) $5 = 0x5600fffffffff140 "\x80\xf1\xff\xff\xff\xff"
(lldb) memory read ptr1 ptr2+16
0xfffffffff140: 80 f1 ff ff ff ff 00 00 38 70 bc f7 ff ff 00 00  ........8p......

Reviewed By: omjavaid, danielkiss

Differential Revision: https://reviews.llvm.org/D103626
2022-01-11 13:24:09 +00:00
..
android/platform [lldb] Remove lldbtest.getBuildFlags 2021-12-30 12:19:24 +01:00
api [lldb] Remove support for replaying the test suite from a reproducer 2021-09-30 10:47:19 -07:00
arm [lldb/test] Skip TestBreakpointThumbCodesection on arm64. 2020-06-25 16:20:27 -07:00
assert_messages_test [lldb] Introduce createTestTarget for creating a valid target in API tests 2021-05-24 16:18:44 +02:00
benchmarks [lldb/Test] Add a trace method to replace print statements. 2020-05-25 11:11:46 -07:00
commands [lldb] Disable several lldb tests that are flaky on Windows 2022-01-10 10:21:12 -08:00
driver/batch_mode [LLDB] Skip random fails on Arm/AArch64 Linux buildbot 2021-08-09 13:53:48 +05:00
functionalities [lldb/platform-gdb] Clear cached protocol state upon disconnection 2022-01-10 16:27:30 +01:00
iohandler Revert "[lldb] Fix that the embedded Python REPL crashes if it receives SIGINT" 2021-11-13 18:18:24 +01:00
lang Revert "[lldb] Set result error state in 'frame variable'" 2022-01-09 14:12:47 -08:00
linux [lldb] Remove non address bits from memory read arguments 2022-01-11 13:24:09 +00:00
lua_api [lldb/lua] Supplement Lua bindings for lldb module 2021-10-12 22:10:21 +08:00
macosx Support v2 of 'main bin spec' Mach-O LC_NOTE in corefiles 2021-12-22 00:02:27 -08:00
python_api [lldb] Disable several lldb tests that are flaky on Windows 2022-01-10 10:21:12 -08:00
qemu [lldb/qemu] Set qemu's "ld prefix" based on the platform sysroot 2022-01-03 14:48:13 +01:00
repl/clang [LLDB] Skip TestClangREPL.py on Arm/AArch64 Linux 2021-10-04 11:50:17 +05:00
sample_test [lldb] Readd deleted variable in the sample test 2021-05-24 16:29:25 +02:00
sanity
source-manager [lldb/Target] Refine source display warning for artificial locations (NFC) 2021-12-09 14:38:14 -08:00
terminal [LLDB] Skip flaky tests on Arm/AArch64 Linux bots 2021-08-04 16:57:36 +05:00
test_runner/test
test_utils [lldb/test] Print build commands in trace mode 2021-10-29 11:33:31 +02:00
tools [lldb] Skip TestVSCode_coreFile if no x86 target support 2022-01-09 22:01:31 -08:00
types [lldb] Remove support for replaying the test suite from a reproducer 2021-09-30 10:47:19 -07:00
CMakeLists.txt [lldb] Copy the system debugserver in LLDB.framework 2021-09-24 15:07:22 -07:00
dotest.py
get_darwin_real_python.py [lldb/test][Darwin] Ask dyld where the real python is 2020-05-08 10:22:58 -07:00
lit.cfg.py [lldb] Use lit_config.note to print module cache message 2022-01-07 13:35:18 -08:00
lit.site.cfg.py.in [lldb/lua] Supplement Lua bindings for lldb module 2021-10-12 22:10:21 +08:00
lldbtest.py [lldb/lua] Supplement Lua bindings for lldb module 2021-10-12 22:10:21 +08:00
use_lldb_suite.py [lldb/test] Use realpath consistently for test root file paths. 2020-08-05 11:35:37 -07:00