Skip to content

[lldb] Rename some register type classes - #213684

Merged
DavidSpickett merged 4 commits into
llvm:mainfrom
DavidSpickett:lldb-register-types-for-stack
Aug 5, 2026
Merged

[lldb] Rename some register type classes#213684
DavidSpickett merged 4 commits into
llvm:mainfrom
DavidSpickett:lldb-register-types-for-stack

Conversation

@DavidSpickett

@DavidSpickett DavidSpickett commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Follow up to #196960.

So that when more types are added, the hierarchy is clear.

RegisterType
-> RegisterTypeEnum
-> RegisterTypeFlags
(in future also...)
-> RegisterTypeUnion
-> RegisterTypeVector

Renamed and moved the test file as it will cover all the classes derived from RegisterType.

So that when more types are added, the hierarchy is clear.

RegisterType
  -> RegisterTypeEnum
  -> RegisterTypeFlags
  (in future also...)
  -> RegisterTypeUnion
  -> RegisterTypeVector

Renamed and moved the test file as it will cover all
the classes derived from RegisterType.
@llvmorg-github-actions

llvmorg-github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

@llvm/pr-subscribers-backend-risc-v

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

Follow up to #196960.

So that when more types are added, the hierarchy is clear.

RegisterType
-> RegisterTypeEnum
-> RegisterTypeFlags
(in future also...)
-> RegisterTypeUnion
-> RegisterTypeVector

Renamed and moved the test file as it will cover all the classes derived from RegisterType.


Patch is 77.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/213684.diff

25 Files Affected:

  • (modified) lldb/include/lldb/Core/DumpRegisterInfo.h (+2-2)
  • (modified) lldb/include/lldb/Core/FormatEntity.h (+1-1)
  • (modified) lldb/include/lldb/Target/DynamicRegisterInfo.h (+2-2)
  • (modified) lldb/include/lldb/Target/RegisterTypeBuilder.h (+4-3)
  • (modified) lldb/include/lldb/Target/Target.h (+1-1)
  • (renamed) lldb/include/lldb/Utility/RegisterTypeFlags.h (+14-16)
  • (modified) lldb/source/Core/DumpRegisterInfo.cpp (+3-3)
  • (modified) lldb/source/Core/DumpRegisterValue.cpp (+4-4)
  • (modified) lldb/source/Core/FormatEntity.cpp (+3-3)
  • (modified) lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.cpp (+31-23)
  • (modified) lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.h (+3-4)
  • (modified) lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp (+1-1)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+34-30)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (+4-4)
  • (modified) lldb/source/Plugins/RegisterTypeBuilder/RegisterTypeBuilderClang.cpp (+6-5)
  • (modified) lldb/source/Plugins/RegisterTypeBuilder/RegisterTypeBuilderClang.h (+1-1)
  • (modified) lldb/source/Target/Target.cpp (+4-3)
  • (modified) lldb/source/Utility/CMakeLists.txt (+1-1)
  • (renamed) lldb/source/Utility/RegisterTypeFlags.cpp (+37-34)
  • (modified) lldb/test/API/commands/register/register_command/TestRegisters.py (+1-1)
  • (modified) lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py (+2-2)
  • (modified) lldb/unittests/Core/DumpRegisterInfoTest.cpp (+14-13)
  • (modified) lldb/unittests/Target/CMakeLists.txt (-1)
  • (modified) lldb/unittests/Utility/CMakeLists.txt (+1)
  • (renamed) lldb/unittests/Utility/RegisterTypeTest.cpp (+168-147)
diff --git a/lldb/include/lldb/Core/DumpRegisterInfo.h b/lldb/include/lldb/Core/DumpRegisterInfo.h
index bceabcacd836e..06b4d71940236 100644
--- a/lldb/include/lldb/Core/DumpRegisterInfo.h
+++ b/lldb/include/lldb/Core/DumpRegisterInfo.h
@@ -18,7 +18,7 @@ namespace lldb_private {
 class Stream;
 class RegisterContext;
 struct RegisterInfo;
-class RegisterFlags;
+class RegisterTypeFlags;
 
 void DumpRegisterInfo(Stream &strm, RegisterContext &ctx,
                       const RegisterInfo &info, uint32_t terminal_width);
@@ -29,7 +29,7 @@ void DoDumpRegisterInfo(
     const std::vector<const char *> &invalidates,
     const std::vector<const char *> &read_from,
     const std::vector<std::pair<const char *, uint32_t>> &in_sets,
-    const RegisterFlags *flags_type, uint32_t terminal_width);
+    const RegisterTypeFlags *flags_type, uint32_t terminal_width);
 
 } // namespace lldb_private
 
diff --git a/lldb/include/lldb/Core/FormatEntity.h b/lldb/include/lldb/Core/FormatEntity.h
index e01009a44aac7..f0e781c718765 100644
--- a/lldb/include/lldb/Core/FormatEntity.h
+++ b/lldb/include/lldb/Core/FormatEntity.h
@@ -78,7 +78,7 @@ struct Entry {
     FrameRegisterPC,
     FrameRegisterSP,
     FrameRegisterFP,
-    FrameRegisterFlags,
+    FrameRegisterTypeFlags,
     FrameRegisterByName,
     FrameIsArtificial,
     FrameKind,
diff --git a/lldb/include/lldb/Target/DynamicRegisterInfo.h b/lldb/include/lldb/Target/DynamicRegisterInfo.h
index b5ce07d9d61e0..7a6085b784ccb 100644
--- a/lldb/include/lldb/Target/DynamicRegisterInfo.h
+++ b/lldb/include/lldb/Target/DynamicRegisterInfo.h
@@ -13,8 +13,8 @@
 #include <vector>
 
 #include "lldb/Utility/ConstString.h"
-#include "lldb/Utility/RegisterFlags.h"
 #include "lldb/Utility/RegisterInfo.h"
+#include "lldb/Utility/RegisterTypeFlags.h"
 #include "lldb/Utility/StructuredData.h"
 #include "lldb/lldb-private.h"
 
@@ -39,7 +39,7 @@ class DynamicRegisterInfo {
     std::vector<uint32_t> invalidate_regs;
     uint32_t value_reg_offset = 0;
     // Non-null if there is an XML provided type.
-    const RegisterFlags *flags_type = nullptr;
+    const RegisterTypeFlags *flags_type = nullptr;
   };
 
   DynamicRegisterInfo() = default;
diff --git a/lldb/include/lldb/Target/RegisterTypeBuilder.h b/lldb/include/lldb/Target/RegisterTypeBuilder.h
index 7239e1d4bd126..bd75ebd3b6d58 100644
--- a/lldb/include/lldb/Target/RegisterTypeBuilder.h
+++ b/lldb/include/lldb/Target/RegisterTypeBuilder.h
@@ -18,9 +18,10 @@ class RegisterTypeBuilder : public PluginInterface {
 public:
   ~RegisterTypeBuilder() override = default;
 
-  virtual CompilerType GetRegisterType(const std::string &name,
-                                       const lldb_private::RegisterFlags &flags,
-                                       uint32_t byte_size) = 0;
+  virtual CompilerType
+  GetRegisterType(const std::string &name,
+                  const lldb_private::RegisterTypeFlags &flags,
+                  uint32_t byte_size) = 0;
 
 protected:
   RegisterTypeBuilder() = default;
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index b64bda33056f1..78f95467f2294 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1565,7 +1565,7 @@ class Target : public std::enable_shared_from_this<Target>,
   llvm::Expected<lldb_private::Address> GetEntryPointAddress();
 
   CompilerType GetRegisterType(const std::string &name,
-                               const lldb_private::RegisterFlags &flags,
+                               const lldb_private::RegisterTypeFlags &flags,
                                uint32_t byte_size);
 
   /// Sends a breakpoint notification event.
diff --git a/lldb/include/lldb/Utility/RegisterFlags.h b/lldb/include/lldb/Utility/RegisterTypeFlags.h
similarity index 90%
rename from lldb/include/lldb/Utility/RegisterFlags.h
rename to lldb/include/lldb/Utility/RegisterTypeFlags.h
index be9eb22fdef46..b15e7e6999335 100644
--- a/lldb/include/lldb/Utility/RegisterFlags.h
+++ b/lldb/include/lldb/Utility/RegisterTypeFlags.h
@@ -1,4 +1,4 @@
-//===-- RegisterFlags.h -----------------------------------------*- C++ -*-===//
+//===------------------------------------------------------------*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,15 +6,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLDB_UTILITY_REGISTERFLAGS_H
-#define LLDB_UTILITY_REGISTERFLAGS_H
-
-#include "lldb/Utility/RegisterType.h"
+#ifndef LLDB_UTILITY_REGISTERTYPEFLAGS_H
+#define LLDB_UTILITY_REGISTERTYPEFLAGS_H
 
 #include <stdint.h>
 #include <string>
 #include <vector>
 
+#include "lldb/Utility/RegisterType.h"
 #include "llvm/ADT/StringSet.h"
 
 namespace lldb_private {
@@ -22,7 +21,7 @@ namespace lldb_private {
 class Stream;
 class Log;
 
-class FieldEnum : public RegisterType {
+class RegisterTypeEnum : public RegisterType {
 public:
   struct Enumerator {
     uint64_t m_value;
@@ -43,12 +42,10 @@ class FieldEnum : public RegisterType {
   // GDB also includes a "size" that is the size of the underlying register.
   // We will not store that here but instead use the size of the register
   // this gets attached to when emitting XML.
-  FieldEnum(std::string id, const Enumerators &enumerators);
+  RegisterTypeEnum(std::string id, const Enumerators &enumerators);
 
   const Enumerators &GetEnumerators() const { return m_enumerators; }
 
-  void ToXML(Stream &strm, unsigned size) const;
-
   void DumpToLog(Log *log) const;
 
   virtual void ToXMLElement(Stream &strm,
@@ -62,7 +59,7 @@ class FieldEnum : public RegisterType {
   Enumerators m_enumerators;
 };
 
-class RegisterFlags : public RegisterType {
+class RegisterTypeFlags : public RegisterType {
 public:
   class Field {
   public:
@@ -72,7 +69,7 @@ class RegisterFlags : public RegisterType {
 
     /// Construct a field that also has some known enum values.
     Field(std::string name, unsigned start, unsigned end,
-          const FieldEnum *enum_type);
+          const RegisterTypeEnum *enum_type);
 
     /// Construct a field that occupies a single bit.
     Field(std::string name, unsigned bit_position);
@@ -100,7 +97,7 @@ class RegisterFlags : public RegisterType {
     const std::string &GetName() const { return m_name; }
     unsigned GetStart() const { return m_start; }
     unsigned GetEnd() const { return m_end; }
-    const FieldEnum *GetEnum() const { return m_enum_type; }
+    const RegisterTypeEnum *GetEnum() const { return m_enum_type; }
     bool Overlaps(const Field &other) const;
     void DumpToLog(Log *log) const;
 
@@ -129,15 +126,15 @@ class RegisterFlags : public RegisterType {
     unsigned m_start;
     unsigned m_end;
 
-    const FieldEnum *m_enum_type;
+    const RegisterTypeEnum *m_enum_type;
   };
 
   /// This assumes that:
   /// * There is at least one field.
   /// * The fields are sorted in descending order.
   /// Gaps are allowed, they will be filled with anonymous padding fields.
-  RegisterFlags(std::string id, unsigned size,
-                const std::vector<Field> &fields);
+  RegisterTypeFlags(std::string id, unsigned size,
+                    const std::vector<Field> &fields);
 
   /// Replace all the fields with the new set of fields. All the assumptions
   /// and checks apply as when you use the constructor. Intended to only be used
@@ -167,6 +164,7 @@ class RegisterFlags : public RegisterType {
 
   const std::vector<Field> &GetFields() const { return m_fields; }
   unsigned GetSize() const { return m_size; }
+
   void DumpToLog(Log *log) const;
 
   /// Produce a text table showing the layout of all the fields. Unnamed/padding
@@ -191,4 +189,4 @@ class RegisterFlags : public RegisterType {
 
 } // namespace lldb_private
 
-#endif // LLDB_UTILITY_REGISTERFLAGS_H
+#endif // LLDB_UTILITY_REGISTERTYPEFLAGS_H
diff --git a/lldb/source/Core/DumpRegisterInfo.cpp b/lldb/source/Core/DumpRegisterInfo.cpp
index 9aaf611b18d63..514f71241fd28 100644
--- a/lldb/source/Core/DumpRegisterInfo.cpp
+++ b/lldb/source/Core/DumpRegisterInfo.cpp
@@ -8,7 +8,7 @@
 
 #include "lldb/Core/DumpRegisterInfo.h"
 #include "lldb/Target/RegisterContext.h"
-#include "lldb/Utility/RegisterFlags.h"
+#include "lldb/Utility/RegisterTypeFlags.h"
 #include "lldb/Utility/Stream.h"
 
 #include "llvm/Support/Casting.h"
@@ -65,7 +65,7 @@ void lldb_private::DumpRegisterInfo(Stream &strm, RegisterContext &ctx,
 
   DoDumpRegisterInfo(strm, info.name, info.alt_name, info.byte_size,
                      invalidates, read_from, in_sets,
-                     llvm::dyn_cast_if_present<lldb_private::RegisterFlags>(
+                     llvm::dyn_cast_if_present<lldb_private::RegisterTypeFlags>(
                          info.register_type),
                      terminal_width);
 }
@@ -92,7 +92,7 @@ void lldb_private::DoDumpRegisterInfo(
     Stream &strm, const char *name, const char *alt_name, uint32_t byte_size,
     const std::vector<const char *> &invalidates,
     const std::vector<const char *> &read_from,
-    const std::vector<SetInfo> &in_sets, const RegisterFlags *flags_type,
+    const std::vector<SetInfo> &in_sets, const RegisterTypeFlags *flags_type,
     uint32_t terminal_width) {
   strm << "       Name: " << name;
   if (alt_name)
diff --git a/lldb/source/Core/DumpRegisterValue.cpp b/lldb/source/Core/DumpRegisterValue.cpp
index 237798346346d..7378cb38f992d 100644
--- a/lldb/source/Core/DumpRegisterValue.cpp
+++ b/lldb/source/Core/DumpRegisterValue.cpp
@@ -11,7 +11,7 @@
 #include "lldb/DataFormatters/DumpValueObjectOptions.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Endian.h"
-#include "lldb/Utility/RegisterFlags.h"
+#include "lldb/Utility/RegisterTypeFlags.h"
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/ValueObject/ValueObject.h"
@@ -22,7 +22,7 @@
 using namespace lldb;
 
 template <typename T>
-static void dump_type_value(const lldb_private::RegisterFlags &flags_type,
+static void dump_type_value(const lldb_private::RegisterTypeFlags &flags_type,
                             lldb_private::CompilerType &fields_compiler_type,
                             T value,
                             lldb_private::ExecutionContextScope *exe_scope,
@@ -123,8 +123,8 @@ void lldb_private::DumpRegisterValue(const RegisterValue &reg_val, Stream &s,
                     0,                    // item_bit_offset
                     exe_scope);
 
-  const RegisterFlags *flags_type =
-      llvm::dyn_cast_if_present<RegisterFlags>(reg_info.register_type);
+  const RegisterTypeFlags *flags_type =
+      llvm::dyn_cast_if_present<RegisterTypeFlags>(reg_info.register_type);
   if (!print_flags || !flags_type || !exe_scope || !target_sp ||
       (reg_info.byte_size != 4 && reg_info.byte_size != 8))
     return;
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 50b05ab98c31c..e886453a45908 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -104,7 +104,7 @@ constexpr Definition g_frame_child_entries[] = {
     Definition("pc", EntryType::FrameRegisterPC),
     Definition("fp", EntryType::FrameRegisterFP),
     Definition("sp", EntryType::FrameRegisterSP),
-    Definition("flags", EntryType::FrameRegisterFlags),
+    Definition("flags", EntryType::FrameRegisterTypeFlags),
     Definition("no-debug", EntryType::FrameNoDebug),
     Entry::DefinitionWithChildren("reg", EntryType::FrameRegisterByName,
                                   g_string_entry),
@@ -380,7 +380,7 @@ const char *FormatEntity::Entry::TypeToCString(Type t) {
     ENUM_TO_CSTR(FrameRegisterPC);
     ENUM_TO_CSTR(FrameRegisterSP);
     ENUM_TO_CSTR(FrameRegisterFP);
-    ENUM_TO_CSTR(FrameRegisterFlags);
+    ENUM_TO_CSTR(FrameRegisterTypeFlags);
     ENUM_TO_CSTR(FrameRegisterByName);
     ENUM_TO_CSTR(FrameIsArtificial);
     ENUM_TO_CSTR(FrameKind);
@@ -1708,7 +1708,7 @@ bool FormatEntity::Formatter::Format(const Entry &entry, Stream &s,
     }
     return false;
 
-  case Entry::Type::FrameRegisterFlags:
+  case Entry::Type::FrameRegisterTypeFlags:
     if (m_exe_ctx) {
       StackFrame *frame = m_exe_ctx->GetFramePtr();
       if (frame) {
diff --git a/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.cpp
index 40343b4238265..5c78a690167d0 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "RegisterFlagsDetector_arm64.h"
+#include "lldb/Utility/RegisterInfo.h"
 #include "lldb/lldb-private-types.h"
 
 // This file is built on all systems because it is used by native processes and
@@ -40,17 +41,17 @@ Arm64RegisterFlagsDetector::DetectPOREL0Fields(uint64_t hwcap, uint64_t hwcap2,
   if (!(hwcap2 & HWCAP2_POE))
     return {};
 
-  static const FieldEnum por_el0_perm_enum("por_el0_perm_enum",
-                                           {
-                                               {0b0000, "No Access"},
-                                               {0b0001, "Read"},
-                                               {0b0010, "Execute"},
-                                               {0b0011, "Read, Execute"},
-                                               {0b0100, "Write"},
-                                               {0b0101, "Write, Read"},
-                                               {0b0110, "Write, Execute"},
-                                               {0b0111, "Read, Write, Execute"},
-                                           });
+  static const RegisterTypeEnum por_el0_perm_enum(
+      "por_el0_perm_enum", {
+                               {0b0000, "No Access"},
+                               {0b0001, "Read"},
+                               {0b0010, "Execute"},
+                               {0b0011, "Read, Execute"},
+                               {0b0100, "Write"},
+                               {0b0101, "Write, Read"},
+                               {0b0110, "Write, Execute"},
+                               {0b0111, "Read, Write, Execute"},
+                           });
 
   return {
       {"Perm15", 60, 63, &por_el0_perm_enum},
@@ -81,10 +82,11 @@ Arm64RegisterFlagsDetector::DetectFPMRFields(uint64_t hwcap, uint64_t hwcap2,
   if (!(hwcap2 & HWCAP2_FPMR))
     return {};
 
-  static const FieldEnum fp8_format_enum("fp8_format_enum", {
-                                                                {0, "FP8_E5M2"},
-                                                                {1, "FP8_E4M3"},
-                                                            });
+  static const RegisterTypeEnum fp8_format_enum("fp8_format_enum",
+                                                {
+                                                    {0, "FP8_E5M2"},
+                                                    {1, "FP8_E4M3"},
+                                                });
   return {
       {"LSCALE2", 32, 37},
       {"NSCALE", 24, 31},
@@ -144,12 +146,12 @@ Arm64RegisterFlagsDetector::DetectMTECtrlFields(uint64_t hwcap, uint64_t hwcap2,
   // to prctl(PR_TAGGED_ADDR_CTRL...). Fields are derived from the defines
   // used to build the value.
 
-  std::vector<RegisterFlags::Field> fields;
+  std::vector<RegisterTypeFlags::Field> fields;
   fields.reserve(4);
   if (hwcap3 & HWCAP3_MTE_STORE_ONLY)
     fields.push_back({"STORE_ONLY", 19});
 
-  static const FieldEnum tcf_enum(
+  static const RegisterTypeEnum tcf_enum(
       "tcf_enum",
       {{0, "TCF_NONE"}, {1, "TCF_SYNC"}, {2, "TCF_ASYNC"}, {3, "TCF_ASYMM"}});
 
@@ -167,11 +169,14 @@ Arm64RegisterFlagsDetector::DetectFPCRFields(uint64_t hwcap, uint64_t hwcap2,
                                              uint64_t hwcap3) {
   (void)hwcap3;
 
-  static const FieldEnum rmode_enum(
+  static const RegisterTypeEnum rmode_enum(
       "rmode_enum", {{0, "RN"}, {1, "RP"}, {2, "RM"}, {3, "RZ"}});
 
-  std::vector<RegisterFlags::Field> fpcr_fields{
-      {"AHP", 26}, {"DN", 25}, {"FZ", 24}, {"RMode", 22, 23, &rmode_enum},
+  std::vector<RegisterTypeFlags::Field> fpcr_fields{
+      {"AHP", 26},
+      {"DN", 25},
+      {"FZ", 24},
+      {"RMode", 22, 23, &rmode_enum},
       // Bits 21-20 are "Stride" which is unused in AArch64 state.
   };
 
@@ -236,8 +241,11 @@ Arm64RegisterFlagsDetector::DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2,
   // or at least not from userspace.
 
   // Status bits that are always present.
-  std::vector<RegisterFlags::Field> cpsr_fields{
-      {"N", 31}, {"Z", 30}, {"C", 29}, {"V", 28},
+  std::vector<RegisterTypeFlags::Field> cpsr_fields{
+      {"N", 31},
+      {"Z", 30},
+      {"C", 29},
+      {"V", 28},
       // Bits 27-26 reserved.
   };
 
@@ -290,7 +298,7 @@ void Arm64RegisterFlagsDetector::UpdateRegisterInfo(
   // Register names will not be duplicated, so we do not want to compare against
   // one if it has already been found. Each time we find one, we erase it from
   // this list.
-  std::vector<std::pair<llvm::StringRef, const RegisterFlags *>>
+  std::vector<std::pair<llvm::StringRef, const RegisterTypeFlags *>>
       search_registers;
   for (const auto &reg : m_registers) {
     // It is possible that a register is all extension dependent fields, and
diff --git a/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.h b/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.h
index 178b79cc53f28..217fd41922fc5 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterFlagsDetector_arm64.h
@@ -9,8 +9,7 @@
 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSDETECTOR_ARM64_H
 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_REGISTERFLAGSDETECTOR_ARM64_H
 
-#include "lldb/Utility/RegisterFlags.h"
-#include "lldb/Utility/RegisterInfo.h"
+#include "lldb/Utility/RegisterTypeFlags.h"
 #include "llvm/ADT/StringRef.h"
 #include <functional>
 
@@ -53,7 +52,7 @@ class Arm64RegisterFlagsDetector {
   bool HasDetected() const { return m_has_detected; }
 
 private:
-  using Fields = std::vector<RegisterFlags::Field>;
+  using Fields = std::vector<RegisterTypeFlags::Field>;
   using DetectorFn = std::function<Fields(uint64_t, uint64_t, uint64_t)>;
 
   static Fields DetectCPSRFields(uint64_t hwcap, uint64_t hwcap2,
@@ -79,7 +78,7 @@ class Arm64RegisterFlagsDetector {
           m_detector(detector) {}
 
     llvm::StringRef m_name;
-    RegisterFlags m_flags;
+    RegisterTypeFlags m_flags;
     DetectorFn m_detector;
   } m_registers[9] = {
       RegisterEntry("cpsr", 4, DetectCPSRFields),
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp
index 62a7bfd727926..fed9d3a8c234f 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp
@@ -336,6 +336,6 @@ RegisterContextCorePOSIX_riscv32::BuildDynamicRegister(
       CopyRegisterListToVector(reg_info.value_regs),
       CopyRegisterListToVector(reg_info.invalidate_regs),
       /*value_reg_offset=*/0,
-      llvm::dyn_cast_if_present<lldb_private::RegisterFlags>(
+      llvm::dyn_cast_if_present<lldb_private::RegisterTypeFlags>(
           reg_info.register_type)};
 }
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 724e7f2e71bd8..82c0d5e60e6e2 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -75,7 +75,7 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/FileSpecList.h"
 #include "lldb/Utility/LLDBLog.h"
-#include "lldb/Utility/RegisterFlags.h"
+#include "lldb/Utility/RegisterTypeFlags.h"
 #include "lldb/Utility/State.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/Timer.h"
@@ -4938,7 +4938,8 @@ struct GdbServerTargetInfo {
   RegisterSetMap reg_set_map;
 };
 
-static FieldEnum::Enumerators ParseEnumEvalues(const XMLNode &enum_node) {
+st...
[truncated]

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

Comment thread lldb/source/Plugins/RegisterTypeBuilder/RegisterTypeBuilderClang.cpp Outdated
Comment thread lldb/source/Plugins/RegisterTypeBuilder/RegisterTypeBuilderClang.cpp Outdated
@DavidSpickett

DavidSpickett commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the class names in comments.

Note that RegisterFlagsDetector will get renamed too but not in this PR.

CopyRegisterListToVector(reg_info.invalidate_regs),
/*value_reg_offset=*/0,
llvm::dyn_cast_if_present<lldb_private::RegisterFlags>(
llvm::dyn_cast_if_present<lldb_private::RegisterTypeFlags>(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be needed but it will get addressed later. I will do an audit of all the dyn_cast uses.

@DavidSpickett
DavidSpickett merged commit f80ea9a into llvm:main Aug 5, 2026
13 checks passed
@DavidSpickett
DavidSpickett deleted the lldb-register-types-for-stack branch August 5, 2026 11:24
@llvm-ci

llvm-ci commented Aug 5, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/21431

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: functionalities/breakpoint/objc/TestObjCBreakpoints.py (379 of 2659)
PASS: lldb-api :: functionalities/breakpoint/same_cu_name/TestFileBreakpointsSameCUName.py (380 of 2659)
PASS: lldb-api :: functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py (381 of 2659)
PASS: lldb-api :: functionalities/breakpoint/scripted_bkpt/overrides_resolver/TestOverridesResolver.py (382 of 2659)
XFAIL: lldb-api :: functionalities/breakpoint/scripted_bkpt/was_hit/TestWasHit.py (383 of 2659)
PASS: lldb-api :: functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py (384 of 2659)
PASS: lldb-api :: functionalities/breakpoint/serialize/TestBreakpointSerialization.py (385 of 2659)
PASS: lldb-api :: functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py (386 of 2659)
PASS: lldb-api :: functionalities/breakpoint/two_hits_one_actual/TestTwoHitsOneActual.py (387 of 2659)
PASS: lldb-api :: functionalities/breakpoint/thread_plan_user_breakpoint/TestThreadPlanUserBreakpoint.py (388 of 2659)
FAIL: lldb-api :: functionalities/breakpoint/update_condition/TestUpdateBreakpointCondition.py (389 of 2659)
******************** TEST 'lldb-api :: functionalities/breakpoint/update_condition/TestUpdateBreakpointCondition.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --triple aarch64-pc-windows-msvc --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --lldb-python-dir C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\Lib\site-packages --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type Release --skip-category=watchpoint --env LLDB_LAUNCH_FLAG_USE_PIPES=1 C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\functionalities\breakpoint\update_condition -p TestUpdateBreakpointCondition.py
--
Exit Code: 1

Command Output (stdout):
--
Skipping the following test categories: watchpoint, libc++, libstdcxx, dwo, dsym, gmodules, debugserver, objc, fork, pexpect


--
Command Output (stderr):
--
UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_update_condition_command_dsym (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_command_dsym) (test case does not fall in any category of interest for this run) 

FAIL: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_update_condition_command_dwarf (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_command_dwarf)

Log Files:

 - C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build\functionalities\breakpoint\update_condition\TestUpdateBreakpointCondition\Failure_test_update_condition_command_dwarf.log

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_update_condition_command_dwo (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_command_dwo) (test case does not fall in any category of interest for this run) 

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_update_condition_python_api_dsym (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_python_api_dsym) (test case does not fall in any category of interest for this run) 

PASS: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_update_condition_python_api_dwarf (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_python_api_dwarf)

UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_update_condition_python_api_dwo (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_python_api_dwo) (test case does not fall in any category of interest for this run) 

======================================================================

FAIL: test_update_condition_command_dwarf (TestUpdateBreakpointCondition.UpdateBreakpointConditionTestCase.test_update_condition_command_dwarf)

   Test that updating a breakpoint condition works correctly using breakpoint modify.

----------------------------------------------------------------------

jinge90 pushed a commit to jinge90/llvm-project that referenced this pull request Aug 6, 2026
Follow up to llvm#196960.

So that when more types are added, the hierarchy is clear.

RegisterType
  -> RegisterTypeEnum
  -> RegisterTypeFlags
  (in future also...)
  -> RegisterTypeUnion
  -> RegisterTypeVector

Renamed and moved the test file as it will cover all the classes derived
from RegisterType.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants