This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Apply FixCodeAddress to all forms of address arguments
ClosedPublic

Authored by DavidSpickett on Jan 27 2023, 6:32 AM.

Details

Summary

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.

Diff Detail

Event Timeline

DavidSpickett created this revision.Jan 27 2023, 6:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 6:32 AM
DavidSpickett requested review of this revision.Jan 27 2023, 6:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 6:32 AM

Apologies it took me so long to get around to this.

As a superset of your change I presume the test you added will still pass. I don't have a Mac to confirm that myself.

I left a few nits here and there but overall this LGTM

lldb/include/lldb/Interpreter/OptionArgParser.h
19–20
25
lldb/source/Interpreter/OptionArgParser.cpp
161–162
This revision is now accepted and ready to land.Feb 8 2023, 1:10 PM

Address Jonas' comments.

DavidSpickett marked 3 inline comments as done.Feb 13 2023, 2:00 AM