diff options
author | Han Ming Ong <hanming@apple.com> | 2013-01-08 22:10:01 +0000 |
---|---|---|
committer | Han Ming Ong <hanming@apple.com> | 2013-01-08 22:10:01 +0000 |
commit | c2c423eac245b1de21758c306365a0b7ff72e687 (patch) | |
tree | d9c3a7a95fc4a22eb65eabe162922971f875fb25 /lldb/source/Target/Process.cpp | |
parent | 5277120dd0d6d326046b08e3b58a27137a202077 (diff) | |
download | bcm5719-llvm-c2c423eac245b1de21758c306365a0b7ff72e687.tar.gz bcm5719-llvm-c2c423eac245b1de21758c306365a0b7ff72e687.zip |
<rdar://problem/12976225>
Checking in the support for doing index ids reservation when given a thread id.
llvm-svn: 171904
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index aac93851596..6ea3f01a6d4 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -937,6 +937,7 @@ Process::Process(Target &target, Listener &listener) : m_private_state_thread (LLDB_INVALID_HOST_THREAD), m_mod_id (), m_thread_index_id (0), + m_thread_id_to_index_id_map (), m_exit_status (-1), m_exit_string (), m_thread_list (this), @@ -1460,12 +1461,51 @@ Process::UpdateThreadListIfNeeded () } } +// This is obsoleted. Staged removal for Xcode. uint32_t Process::GetNextThreadIndexID () { return ++m_thread_index_id; } +uint32_t +Process::GetNextThreadIndexID (uint64_t thread_id) +{ + return AssignIndexIDToThread(thread_id); +} + +bool +Process::HasAssignedIndexIDToThread(uint64_t thread_id) +{ + std::map<uint64_t, uint32_t>::iterator iterator = m_thread_id_to_index_id_map.find(thread_id); + if (iterator == m_thread_id_to_index_id_map.end()) + { + return false; + } + else + { + return true; + } +} + +uint32_t +Process::AssignIndexIDToThread(uint64_t thread_id) +{ + uint32_t result = 0; + std::map<uint64_t, uint32_t>::iterator iterator = m_thread_id_to_index_id_map.find(thread_id); + if (iterator == m_thread_id_to_index_id_map.end()) + { + result = ++m_thread_index_id; + m_thread_id_to_index_id_map[thread_id] = result; + } + else + { + result = iterator->second; + } + + return result; +} + StateType Process::GetState() { |