1 //===-- ThreadSpec.h ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ThreadSpec_h_
11 #define liblldb_ThreadSpec_h_
16 #include "lldb/lldb-private.h"
18 namespace lldb_private {
20 // Note: For now the thread spec has only fixed elements -
26 // But if we need more generality, we can hang a key/value map off of this structure.
27 // That's why the thread matches spec test is done as a virtual method in Thread::MatchesSpec,
28 // since it is the native thread that would know how to interpret the keys.
29 // I was going to do the Queue Name this way out of sheer orneriness, but that seems a
30 // sufficiently general concept, so I put it in here on its own.
37 ThreadSpec (const ThreadSpec &rhs);
40 operator=(const ThreadSpec &rhs);
43 SetIndex (uint32_t index)
49 SetTID (lldb::tid_t tid)
55 SetName (const char *name)
61 SetQueueName (const char *queue_name)
63 m_queue_name = queue_name;
82 GetQueueName () const;
85 TIDMatches (lldb::tid_t thread_id) const
87 if (m_tid == LLDB_INVALID_THREAD_ID || thread_id == LLDB_INVALID_THREAD_ID)
90 return thread_id == m_tid;
94 TIDMatches (Thread &thread) const;
97 IndexMatches (uint32_t index) const
99 if (m_index == UINT32_MAX || index == UINT32_MAX)
102 return index == m_index;
106 IndexMatches (Thread &thread) const;
109 NameMatches (const char *name) const
113 else if (name == NULL)
116 return m_name == name;
120 NameMatches (Thread &thread) const;
123 QueueNameMatches (const char *queue_name) const
125 if (m_queue_name.empty())
127 else if (queue_name == NULL)
130 return m_queue_name == queue_name;
134 QueueNameMatches (Thread &thread) const;
137 ThreadPassesBasicTests (Thread &thread) const;
140 HasSpecification () const;
143 GetDescription (Stream *s, lldb::DescriptionLevel level) const;
150 std::string m_queue_name;
153 } // namespace lldb_private
155 #endif // liblldb_ThreadSpec_h_