[all-commits] [llvm/llvm-project] eb7dc9: [lldb] Add SBValue::GetValueAsAddress API (#90144)

Jason Molenda via All-commits all-commits at lists.llvm.org
Thu Apr 25 16:42:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb7dc991841489e2f8f18467705944c9136b06d2
      https://github.com/llvm/llvm-project/commit/eb7dc991841489e2f8f18467705944c9136b06d2
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M lldb/bindings/interface/SBValueDocstrings.i
    M lldb/include/lldb/API/SBValue.h
    M lldb/source/API/SBValue.cpp
    A lldb/test/API/clear-sbvalue-nonaddressable-bits/Makefile
    A lldb/test/API/clear-sbvalue-nonaddressable-bits/TestClearSBValueNonAddressableBits.py
    A lldb/test/API/clear-sbvalue-nonaddressable-bits/main.c

  Log Message:
  -----------
  [lldb] Add SBValue::GetValueAsAddress API (#90144)

I previously added this API via https://reviews.llvm.org/D142792 in
2023, along with changes to the ValueObject class to treat pointer types
as addresses, and to annotate those ValueObjects with the original
uint64_t byte sequence AND the name of the symbol once stripped, if that
points to a symbol.

I did this unconditionally for all pointer type ValueObjects, and it
caused several regressions in the Objective-C data formatters which have
a ValueObject of an object, it has the address of its class -- but with
ObjC, sometimes it is a "tagged pointer" which is metadata, not an
actual pointer. (e.g. a small NSInteger value is stored entirely in the
tagged pointer, instead of a separate object) Treating these
not-addresses as addresses -- clearing the non-addressable-bits -- is
invalid.

The original version of this patch we're using downstream only does this
bits clearing for pointer types that are specifically decorated with the
pointerauth typequal, but not all of those clang changes are upstreamed
to github main yet, so I tried this simpler approach and hit the tagged
pointer issue and bailed on the whole patch.

This patch, however, is simply adding SBValue::GetValueAsAddress so
script writers who know that an SBValue has an address in memory, can
strip off any metadata. It's an important API to have for script writers
when AArch64 ptrauth is in use, so I'm going to put this part of the
patch back on github main now until we can get the rest of that original
patch upstreamed.



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