diff options
author | Han Ming Ong <hanming@apple.com> | 2013-06-24 18:15:05 +0000 |
---|---|---|
committer | Han Ming Ong <hanming@apple.com> | 2013-06-24 18:15:05 +0000 |
commit | 91ed6b878f9503949b86f3a2f2edf0708868005b (patch) | |
tree | a7ce2540658b6de5352317d346450fb7197d7d89 /lldb/source/Target/Process.cpp | |
parent | 7925e3db637a25d380fc68a8103a6bae6505d8de (diff) | |
download | bcm5719-llvm-91ed6b878f9503949b86f3a2f2edf0708868005b.tar.gz bcm5719-llvm-91ed6b878f9503949b86f3a2f2edf0708868005b.zip |
<rdar://problem/14182286>
Made sure that temporary object created from HarmonizeThreadIdsForProfileData() doesn’t get passed around without creating an object first.
Reviewed by Greg
llvm-svn: 184769
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 200fc08d4a3..d78ebc0584a 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4401,10 +4401,10 @@ Process::AppendSTDERR (const char * s, size_t len) } void -Process::BroadcastAsyncProfileData(const char *s, size_t len) +Process::BroadcastAsyncProfileData(const std::string &one_profile_data) { Mutex::Locker locker (m_profile_data_comm_mutex); - m_profile_data.push_back(s); + m_profile_data.push_back(one_profile_data); BroadcastEventIfUnique (eBroadcastBitProfileData, new ProcessEventData (shared_from_this(), GetState())); } @@ -4414,8 +4414,9 @@ Process::GetAsyncProfileData (char *buf, size_t buf_size, Error &error) Mutex::Locker locker(m_profile_data_comm_mutex); if (m_profile_data.empty()) return 0; - - size_t bytes_available = m_profile_data.front().size(); + + std::string &one_profile_data = m_profile_data.front(); + size_t bytes_available = one_profile_data.size(); if (bytes_available > 0) { Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); @@ -4423,13 +4424,13 @@ Process::GetAsyncProfileData (char *buf, size_t buf_size, Error &error) log->Printf ("Process::GetProfileData (buf = %p, size = %" PRIu64 ")", buf, (uint64_t)buf_size); if (bytes_available > buf_size) { - memcpy(buf, m_profile_data.front().data(), buf_size); - m_profile_data.front().erase(0, buf_size); + memcpy(buf, one_profile_data.c_str(), buf_size); + one_profile_data.erase(0, buf_size); bytes_available = buf_size; } else { - memcpy(buf, m_profile_data.front().data(), bytes_available); + memcpy(buf, one_profile_data.c_str(), bytes_available); m_profile_data.erase(m_profile_data.begin()); } } |