[Lldb-commits] [lldb] [lldb] Introduce RegisterType base class for all register type classes (PR #196960)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 4 02:42:45 PDT 2026
================
@@ -0,0 +1,62 @@
+//===-- RegisterType.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_TARGET_REGISTERTYPE_H
+#define LLDB_TARGET_REGISTERTYPE_H
+
+#include <string>
+#include <unordered_set>
+#include <vector>
+
+namespace lldb_private {
+
+class Stream;
+class Log;
+
+class RegisterType {
+public:
+ enum RegisterTypeKind {
+ eRegisterTypeKindFlags,
+ eRegisterTypeKindEnum,
+ };
+
+ RegisterTypeKind getKind() const { return m_kind; }
+
+ RegisterType(RegisterTypeKind kind, std::string id)
+ : m_kind(kind), m_id(std::move(id)) {}
+
+ /// Output XML that describes this type, to be inserted into a target XML
+ /// file. Reserved characters like "<" are replaced with their XML safe
+ /// equivalents like ">".
+ void ToXML(Stream &strm,
----------------
DavidSpickett wrote:
The `FromXML` part (though not called that) is all in `lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp`. For example `ParseEnums`.
Which is not a great place for them. Definitely would like to have `FromXML` to debloat ProcessGDBRemote and be able to test it without faking a connection (`lldb/test/API/functionalities/gdb_remote_client/TestXMLRegisterFlags.py`).
https://github.com/llvm/llvm-project/pull/196960
More information about the lldb-commits
mailing list