summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/MemoryHistory
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-05-01 11:23:04 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-05-01 11:23:04 +0000
commit8efcca3ebda9f72a72d52837de171d200dd0efa8 (patch)
tree733e3a5781605117d6f1d236ba1779d0160faec6 /lldb/source/Plugins/MemoryHistory
parentb466a74eeb16bae78b827a7ed9ba692a63e7d983 (diff)
Add thread numbers into ASan thread names.
Diffstat (limited to 'lldb/source/Plugins/MemoryHistory')
-rw-r--r--lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
index ab216991c34..2ac92ea24f8 100644
--- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -24,6 +24,8 @@
#include "Plugins/Process/Utility/HistoryThread.h"
#include "lldb/Core/ValueObject.h"
+#include <sstream>
+
using namespace lldb;
using namespace lldb_private;
@@ -123,7 +125,7 @@ static void CreateHistoryThreadFromValueObject(ProcessSP process_sp, ValueObject
return;
int count = count_sp->GetValueAsUnsigned(0);
- tid_t tid = tid_sp->GetValueAsUnsigned(0);
+ tid_t tid = tid_sp->GetValueAsUnsigned(0) + 1;
if (count <= 0)
return;
@@ -144,8 +146,9 @@ static void CreateHistoryThreadFromValueObject(ProcessSP process_sp, ValueObject
HistoryThread *history_thread = new HistoryThread(*process_sp, tid, pcs, 0, false);
ThreadSP new_thread_sp(history_thread);
- // let's use thread name for the type of history thread, since history threads don't have names anyway
- history_thread->SetThreadName(thread_name);
+ std::ostringstream thread_name_with_number;
+ thread_name_with_number << thread_name << " Thread " << tid;
+ history_thread->SetThreadName(thread_name_with_number.str().c_str());
// Save this in the Process' ExtendedThreadList so a strong pointer retains the object
process_sp->GetExtendedThreadList().AddThread (new_thread_sp);
result.push_back(new_thread_sp);
@@ -198,8 +201,8 @@ MemoryHistoryASan::GetHistoryThreads(lldb::addr_t address)
if (!return_value_sp)
return result;
- CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "free", "Memory deallocated at", result);
- CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "alloc", "Memory allocated at", result);
+ CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "free", "Memory deallocated by", result);
+ CreateHistoryThreadFromValueObject(process_sp, return_value_sp, "alloc", "Memory allocated by", result);
return result;
}