[Lldb-commits] [PATCH] D157667: Define qHostInfo and Mach-O LC_NOTE "addrable bits" methods to describe high and low memory addressing bits

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 10 17:57:33 PDT 2023


jasonmolenda created this revision.
jasonmolenda added reviewers: JDevlieghere, bulbazord.
jasonmolenda added a project: LLDB.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

To recap, on AArch64 where we need to strip pointer authentication bits off of addresses, it can have a different number of bits in use for high and low memory (you can have a different page table setup for high and low memory, so different number of addressing bits for virtual addresses).  I added this to Process and defined a new setting so these can be done manually in https://reviews.llvm.org/D151292 a few months ago.

This patch defines keys for qHostInfo and a new "addrable bits" LC_NOTE format for mach-o corefiles to define both of them.

qHostInfo gains `low_mem_addressing_bits` and `high_mem_addressing_bits` keys.  The previous `addressing_bits` is still accepted for a value that is used for both regions of memory (this is by far the most common case).

For Mach-O corefile, I've needed to update the "addrable bits" LC_NOTE.  The previous definition was

  struct addressing_bit_count_v3    // ** DEPRECATED **
  {
      uint32_t version;             // currently 3
      uint32_t addressing_bits;     // # of bits used for addressing
      uint64_t unused;
  };

The new definition is

  struct addressing_bit_count
  {
      // currently 4
      uint32_t version;
  
      // Number of bits used for addressing in low
      // memory (addresses starting with 0)
      uint32_t low_memory_addressing_bits;
  
      // Number of bits used for addressing in high
      // memory (addresses starting with f)
      uint32_t high_memory_addressing_bits;
  
      // set to zero
      uint32_t reserved;
  };

The changes in this patchset are to GDBRemoteCommunicationClient (read the new qHostInfo keys), ProcessGDBRemote (set both in the Process when they are specified).  And ObjectFileMachO (read and write the new LC_NOTE in mach-o corefiles), ProcessMachCore (set both in Process when they are specified).

I still accept the previous formats of a single value, and only initialize the base CodeAddressMask and DataAddressMask.  Only when both high and low memory addressing bits are specified and are different, do we set the Process' HighmemCodeAddressMask, HighmemDataAddressMask.

This is the final part of adding support for the different address masks that can be used on AArch64 targets.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157667

Files:
  lldb/docs/lldb-gdb-remote.txt
  lldb/include/lldb/Symbol/ObjectFile.h
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157667.549212.patch
Type: text/x-patch
Size: 10999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230811/18c8abd4/attachment.bin>


More information about the lldb-commits mailing list