diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2014-09-12 22:51:49 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2014-09-12 22:51:49 +0000 |
commit | 7206c6d11fa4cb5fd44aa680106cb37ce85d9e3b (patch) | |
tree | 50ad47af318c189b3652bfb0649fd43216e6193e /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp | |
parent | 8a0c9e624764b705791b26ed98f66034b9896cef (diff) | |
download | bcm5719-llvm-7206c6d11fa4cb5fd44aa680106cb37ce85d9e3b.tar.gz bcm5719-llvm-7206c6d11fa4cb5fd44aa680106cb37ce85d9e3b.zip |
llgs: fix thread names broken by recent native thread changes.
* Fixes the local stack variable return pointer usage in NativeThreadLinux::GetName().
* Changes NativeThreadProtocol::GetName() to return a std::string.
* Adds a unit test to verify thread names don't regress in the future. Currently only run on Linux since I know default thread names there.
llvm-svn: 217717
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index e3aadf1bc25..11658fe0a87 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -871,21 +871,21 @@ GDBRemoteCommunicationServer::SendStopReplyPacketForThread (lldb::tid_t tid) response.Printf ("thread:%" PRIx64 ";", tid); // Include the thread name if there is one. - const char *thread_name = thread_sp->GetName (); - if (thread_name && thread_name[0]) + const std::string thread_name = thread_sp->GetName (); + if (!thread_name.empty ()) { - size_t thread_name_len = strlen(thread_name); + size_t thread_name_len = thread_name.length (); - if (::strcspn (thread_name, "$#+-;:") == thread_name_len) + if (::strcspn (thread_name.c_str (), "$#+-;:") == thread_name_len) { response.PutCString ("name:"); - response.PutCString (thread_name); + response.PutCString (thread_name.c_str ()); } else { // The thread name contains special chars, send as hex bytes. response.PutCString ("hexname:"); - response.PutCStringAsRawHex8 (thread_name); + response.PutCStringAsRawHex8 (thread_name.c_str ()); } response.PutChar (';'); } |