[all-commits] [llvm/llvm-project] 78ee0e: [lldb][AArch64] Use unique_ptr instead of statics ...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Aug 7 03:51:35 PDT 2026


  Branch: refs/heads/users/davidspickett/lldb-register-types-for-stack-4.5
  Home:   https://github.com/llvm/llvm-project
  Commit: 78ee0e6b63a292e40627cc3cf4bcc93904b48142
      https://github.com/llvm/llvm-project/commit/78ee0e6b63a292e40627cc3cf4bcc93904b48142
  Author: David Spickett <david.spickett at arm.com>
  Date:   2026-08-07 (Fri, 07 Aug 2026)

  Changed paths:
    M lldb/source/Plugins/Process/Utility/RegisterTypeDetector_arm64.cpp
    M lldb/source/Plugins/Process/Utility/RegisterTypeDetector_arm64.h
    M lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py

  Log Message:
  -----------
  [lldb][AArch64] Use unique_ptr instead of statics in RegisterTypeDetector

Fixes #214264.

I used static variables for the created types, on the assumption
that only one detector would be used and that the host's
features would not change.

That is true for an lldb-server on a real Linux/FreeBSD system.
It is not true when we use the detector with core files. In the
same LLDB session you might load several files that came from
systems with different features.

The result was that the first detection sets up the static variables
and future detections do not update them. So subsequent core
files can have incorrect types.

(and in future if types vary per-process, we could have the same
issue in lldb-server)

To address this I am changing where the types are stored so that
each instance of the detector has its own set of types for which
it manages the lifetime.

* There is a vector of unique pointers to types. This vector
  is a member, so is per instance of the detector class.
* As new types are added to this vector, it may reallocate,
  but the location of the RegisterTypes themselves will stay
  the same, this is important.
* Detector functions use MakeType to create types, and MakeType
  handles managing the vector. Nothing else accesses the vector
  directly.
* MakeType returns a raw pointer to the type.
* Detector functions return a raw pointer to the top level
  type for the register. For example if it has flags that
  have enums for their fields, the flags type is the top level
  type.
* These top level raw pointers are given to the rest of LLDB.
* We assume that the lifetime of the dector is > that of anyone
  using the raw pointers.
* When the detector destructs, the unique pointers destruct and
  the RegisterTypes are freed.

This handing out of raw pointers is likely a bad idea, but I
want to keep the changes here within the detector.

All existing tests pass, and I have added a test that loads 2
core files with different features. That test fails without
these changes because the STORE_ONLY feature is detected
incorrectly.


  Commit: ac04848f69ba5e9b82e427258518c69224113943
      https://github.com/llvm/llvm-project/commit/ac04848f69ba5e9b82e427258518c69224113943
  Author: David Spickett <david.spickett at arm.com>
  Date:   2026-08-07 (Fri, 07 Aug 2026)

  Changed paths:
    M lldb/source/Plugins/Process/Utility/RegisterTypeDetector_arm64.h

  Log Message:
  -----------
  put back initialiser


Compare: https://github.com/llvm/llvm-project/compare/588e2176b724...ac04848f69ba

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