summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/MemoryHistory/asan
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
commitcfca06d7963fa0909f90483b42a6d7d194d01e08 (patch)
tree209fb2a2d68f8f277793fc8df46c753d31bc853b /lldb/source/Plugins/MemoryHistory/asan
parent706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff)
Notes
Diffstat (limited to 'lldb/source/Plugins/MemoryHistory/asan')
-rw-r--r--lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp11
-rw-r--r--lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h6
2 files changed, 12 insertions, 5 deletions
diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
index e0d2c5d0eef8..333113a0b17a 100644
--- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
+++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
@@ -1,4 +1,4 @@
-//===-- MemoryHistoryASan.cpp -----------------------------------*- C++ -*-===//
+//===-- MemoryHistoryASan.cpp ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -28,6 +28,8 @@
using namespace lldb;
using namespace lldb_private;
+LLDB_PLUGIN_DEFINE(MemoryHistoryASan)
+
MemoryHistorySP MemoryHistoryASan::CreateInstance(const ProcessSP &process_sp) {
if (!process_sp.get())
return nullptr;
@@ -136,7 +138,12 @@ static void CreateHistoryThreadFromValueObject(ProcessSP process_sp,
pcs.push_back(pc);
}
- HistoryThread *history_thread = new HistoryThread(*process_sp, tid, pcs);
+ // The ASAN runtime already massages the return addresses into call
+ // addresses, we don't want LLDB's unwinder to try to locate the previous
+ // instruction again as this might lead to us reporting a different line.
+ bool pcs_are_call_addresses = true;
+ HistoryThread *history_thread =
+ new HistoryThread(*process_sp, tid, pcs, pcs_are_call_addresses);
ThreadSP new_thread_sp(history_thread);
std::ostringstream thread_name_with_number;
thread_name_with_number << thread_name << " Thread " << tid;
diff --git a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h
index 266576b0cd96..e9fe37d344a4 100644
--- a/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h
+++ b/lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_MemoryHistoryASan_h_
-#define liblldb_MemoryHistoryASan_h_
+#ifndef LLDB_SOURCE_PLUGINS_MEMORYHISTORY_ASAN_MEMORYHISTORYASAN_H
+#define LLDB_SOURCE_PLUGINS_MEMORYHISTORY_ASAN_MEMORYHISTORYASAN_H
#include "lldb/Target/ABI.h"
#include "lldb/Target/MemoryHistory.h"
@@ -45,4 +45,4 @@ private:
} // namespace lldb_private
-#endif // liblldb_MemoryHistoryASan_h_
+#endif // LLDB_SOURCE_PLUGINS_MEMORYHISTORY_ASAN_MEMORYHISTORYASAN_H