================
@@ -8,8 +8,18 @@
#include "lldb/Utility/RegisterType.h"
+#include <atomic>
+
using namespace lldb_private;
+namespace {
+std::atomic<uint64_t> g_next_register_type_uid{1};
+}
+
+RegisterType::RegisterType(RegisterTypeKind kind, std::string id)
+ : m_kind(kind), m_id(std::move(id)),
+ m_uid(g_next_register_type_uid.fetch_add(1, std::memory_order_relaxed))
{}
----------------
barsolo2000 wrote:
A case I can think about:
1. Process A creates a `RegisterType` at address X.
2. The target owned builder caches the type using address X.
3. `Target::CreateProcess()` destroys Process A and its register types, but
keeps the builder.
4. Process B creates a different type, and the allocator reuses address X.
5. An address based cache returns Process A’s stale type
Technically, its rare.. so whatever you think? I don't see a real harm in using
UID.
https://github.com/llvm/llvm-project/pull/215874
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits