[all-commits] [llvm/llvm-project] d9398a: [lldb] Remove non-address bits from read/write add...

David Spickett via All-commits all-commits at lists.llvm.org
Wed May 18 04:59:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9398a91e2a6b8837a47a5fda2164c9160e86199
      https://github.com/llvm/llvm-project/commit/d9398a91e2a6b8837a47a5fda2164c9160e86199
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2022-05-18 (Wed, 18 May 2022)

  Changed paths:
    M lldb/source/Target/Process.cpp
    M lldb/source/Target/ProcessTrace.cpp
    M lldb/source/Target/Target.cpp
    A lldb/test/API/linux/aarch64/non_address_bit_memory_access/Makefile
    A lldb/test/API/linux/aarch64/non_address_bit_memory_access/TestAArch64LinuxNonAddressBitMemoryAccess.py
    A lldb/test/API/linux/aarch64/non_address_bit_memory_access/main.c

  Log Message:
  -----------
  [lldb] Remove non-address bits from read/write addresses in lldb

Non-address bits are not part of the virtual address in a pointer.
So they must be removed before passing to interfaces like ptrace.

Some of them we get way with not removing, like AArch64's top byte.
However this is only because of a hardware feature that ignores them.

This change updates all the Process/Target Read/Write memory methods
to remove non-address bits before using addresses.

Doing it in this way keeps lldb-server simple and also fixes the
memory caching when differently tagged pointers for the same location
are read.

Removing the bits is done at the ReadMemory level not DoReadMemory
because particualrly for process, many subclasses override DoReadMemory.

Tests have been added for read/write at the command and API level,
for process and target. This includes variants like
Read<sometype>FromMemory. Commands are tested to make sure we remove
at the command and API level.

"memory find" is not included because:
* There is no API for it.
* It already has its own address handling tests.

Software breakpoints do use these methods but they are not tested
here because there are bigger issues to fix with those. This will
happen in another change.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D118794




More information about the All-commits mailing list