summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Target/Process.h2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp4
-rw-r--r--lldb/source/Target/Process.cpp15
3 files changed, 11 insertions, 10 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 6bef28aec94..7f28175dd92 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -3814,7 +3814,7 @@ protected:
AppendSTDERR (const char *s, size_t len);
void
- BroadcastAsyncProfileData(const char *s, size_t len);
+ BroadcastAsyncProfileData(const std::string &one_profile_data);
static void
STDIOReadThreadBytesReceived (void *baton, const void *src, size_t src_len);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 25568f278ea..ca594a8f3fd 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -764,8 +764,8 @@ GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse
while ((found = input.find(end_delimiter, pos)) != std::string::npos)
{
StringExtractorGDBRemote profileDataExtractor(input.substr(pos, found).c_str());
- const std::string& profile_data = HarmonizeThreadIdsForProfileData(process, profileDataExtractor);
- process->BroadcastAsyncProfileData (profile_data.c_str(), profile_data.length());
+ std::string profile_data = HarmonizeThreadIdsForProfileData(process, profileDataExtractor);
+ process->BroadcastAsyncProfileData (profile_data);
pos = found + end_delimiter_len;
}
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());
}
}
OpenPOWER on IntegriCloud