[LLDB] Apply FixCodeAddress to all forms of address arguments
authorDavid Spickett <david.spickett@linaro.org>
Fri, 28 Oct 2022 09:52:06 +0000 (10:52 +0100)
committerDavid Spickett <david.spickett@linaro.org>
Mon, 13 Feb 2023 10:15:52 +0000 (10:15 +0000)
commite6ec76c647aaa335de48b8534d3a044346d9656f
treeb5aff8ba212c9e94df8148ac0d51f221541de3ca
parenta9329a96ada35b1b5439da4e29eed7db10ff813b
[LLDB] Apply FixCodeAddress to all forms of address arguments

This is a follow up to https://reviews.llvm.org/D141629
and applies the change it made to all paths through ToAddress
(now DoToAddress).

I have included the test from my previous attempt
https://reviews.llvm.org/D136938.

The initial change only applied fixing to addresses that
would parse as integers, so my test case failed. Since
ToAddress has multiple exit points, I've wrapped it into
a new method DoToAddress.

Now you can call ToAddress, it will call DoToAddress and
no matter what path you take, the address will be fixed.

For the memory tagging commands we actually want the full
address (to work out mismatches). So I added ToRawAddress
for that.

I have tested this on a QEMU AArch64 Linux system with
Memory Tagging, Pointer Authentication and Top Byte Ignore
enabled. By running the new test and all other tests in
API/linux/aarch64.

Some commands have had calls to the ABI plugin removed
as ToAddress now does this for them.

The "memory region" command still needs to use the ABI plugin
to detect the end of memory when there are non-address bits.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D142715
lldb/include/lldb/Interpreter/OptionArgParser.h
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Commands/CommandObjectMemoryTag.cpp
lldb/source/Interpreter/OptionArgParser.cpp
lldb/test/API/linux/aarch64/non_address_bit_code_break/Makefile [new file with mode: 0644]
lldb/test/API/linux/aarch64/non_address_bit_code_break/TestAArch64LinuxNonAddressBitCodeBreak.py [new file with mode: 0644]
lldb/test/API/linux/aarch64/non_address_bit_code_break/main.c [new file with mode: 0644]