[all-commits] [llvm/llvm-project] aeaa11: [lldb] Address mask sbprocess apis and new mask in...

Jason Molenda via All-commits all-commits at lists.llvm.org
Wed Mar 6 10:07:08 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aeaa11aeac0aedf32cafec6532d303fea595c5fc
      https://github.com/llvm/llvm-project/commit/aeaa11aeac0aedf32cafec6532d303fea595c5fc
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2024-03-06 (Wed, 06 Mar 2024)

  Changed paths:
    M lldb/include/lldb/API/SBProcess.h
    M lldb/include/lldb/Target/ABI.h
    M lldb/include/lldb/Target/Process.h
    M lldb/include/lldb/Utility/AddressableBits.h
    M lldb/include/lldb/lldb-defines.h
    M lldb/include/lldb/lldb-enumerations.h
    M lldb/source/API/SBProcess.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
    M lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
    M lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
    M lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Target/ABI.cpp
    M lldb/source/Target/Process.cpp
    M lldb/source/Utility/AddressableBits.cpp
    A lldb/test/API/python_api/process/address-masks/Makefile
    A lldb/test/API/python_api/process/address-masks/TestAddressMasks.py
    A lldb/test/API/python_api/process/address-masks/main.c

  Log Message:
  -----------
  [lldb] Address mask sbprocess apis and new mask invalid const (#83663)

[lldb] Add SBProcess methods for get/set/use address masks (#83095)

I'm reviving a patch from phabracator, https://reviews.llvm.org/D155905
which was approved but I wasn't thrilled with all the API I was adding
to SBProcess for all of the address mask types / memory regions. In this
update, I added enums to control type address mask type (code, data,
any) and address space specifiers (low, high, all) with defaulted
arguments for the most common case.  I originally landed this via
https://github.com/llvm/llvm-project/pull/83095 but it failed on CIs
outside of arm64 Darwin so I had to debug it on more environments
and update the patch.

This patch is also fixing a bug in the "addressable bits to address
mask" calculation I added in AddressableBits::SetProcessMasks. If lldb
were told that 64 bits are valid for addressing, this method would
overflow the calculation and set an invalid mask. Added tests to check
this specific bug while I was adding these APIs.

This patch changes the value of "no mask set" from 0 to
LLDB_INVALID_ADDRESS_MASK, which is UINT64_MAX. A mask of all 1's
means "no bits are used for addressing" which is an impossible mask,
whereas a mask of 0 means "all bits are used for addressing" which
is possible.

I added a base class implementation of ABI::FixCodeAddress and
ABI::FixDataAddress that will apply the Process mask values if they
are set to a value other than LLDB_INVALID_ADDRESS_MASK.

I updated all the callers/users of the Mask methods which were
handling a value of 0 to mean invalid mask to use
LLDB_INVALID_ADDRESS_MASK.

I added code to the all AArch64 ABI Fix* methods to apply the
Highmem masks if they have been set.  These will not be set on a
Linux environment, but in TestAddressMasks.py I test the highmem
masks feature for any AArch64 target, so all AArch64 ABI  plugins 
must handle it.

rdar://123530562



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list