aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp')
-rw-r--r--source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp55
1 files changed, 34 insertions, 21 deletions
diff --git a/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
index 96754ff78787..9b72ceb71bd0 100644
--- a/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ b/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Stream.h"
@@ -130,26 +131,34 @@ AddressSanitizerRuntime::IsActive()
const char *
address_sanitizer_retrieve_report_data_command = R"(
- struct {
- int present;
- void *pc, *bp, *sp, *address;
- int access_type;
- size_t access_size;
- const char *description;
- } t;
+int __asan_report_present();
+void *__asan_get_report_pc();
+void *__asan_get_report_bp();
+void *__asan_get_report_sp();
+void *__asan_get_report_address();
+const char *__asan_get_report_description();
+int __asan_get_report_access_type();
+size_t __asan_get_report_access_size();
+struct {
+ int present;
+ int access_type;
+ void *pc;
+ void *bp;
+ void *sp;
+ void *address;
+ size_t access_size;
+ const char *description;
+} t;
- t.present = ((int (*) ())__asan_report_present)();
- t.pc = ((void * (*) ())__asan_get_report_pc)();
- /* commented out because rdar://problem/18533301
- t.bp = ((void * (*) ())__asan_get_report_bp)();
- t.sp = ((void * (*) ())__asan_get_report_sp)();
- */
- t.address = ((void * (*) ())__asan_get_report_address)();
- t.description = ((const char * (*) ())__asan_get_report_description)();
- t.access_type = ((int (*) ())__asan_get_report_access_type)();
- t.access_size = ((size_t (*) ())__asan_get_report_access_size)();
-
- t;
+t.present = __asan_report_present();
+t.access_type = __asan_get_report_access_type();
+t.pc = __asan_get_report_pc();
+t.bp = __asan_get_report_bp();
+t.sp = __asan_get_report_sp();
+t.address = __asan_get_report_address();
+t.access_size = __asan_get_report_access_size();
+t.description = __asan_get_report_description();
+t
)";
StructuredData::ObjectSP
@@ -177,8 +186,10 @@ AddressSanitizerRuntime::RetrieveReportData()
return StructuredData::ObjectSP();
addr_t pc = return_value_sp->GetValueForExpressionPath(".pc")->GetValueAsUnsigned(0);
+ /* commented out because rdar://problem/18533301
addr_t bp = return_value_sp->GetValueForExpressionPath(".bp")->GetValueAsUnsigned(0);
addr_t sp = return_value_sp->GetValueForExpressionPath(".sp")->GetValueAsUnsigned(0);
+ */
addr_t address = return_value_sp->GetValueForExpressionPath(".address")->GetValueAsUnsigned(0);
addr_t access_type = return_value_sp->GetValueForExpressionPath(".access_type")->GetValueAsUnsigned(0);
addr_t access_size = return_value_sp->GetValueForExpressionPath(".access_size")->GetValueAsUnsigned(0);
@@ -191,8 +202,10 @@ AddressSanitizerRuntime::RetrieveReportData()
dict->AddStringItem("instrumentation_class", "AddressSanitizer");
dict->AddStringItem("stop_type", "fatal_error");
dict->AddIntegerItem("pc", pc);
+ /* commented out because rdar://problem/18533301
dict->AddIntegerItem("bp", bp);
dict->AddIntegerItem("sp", sp);
+ */
dict->AddIntegerItem("address", address);
dict->AddIntegerItem("access_type", access_type);
dict->AddIntegerItem("access_size", access_size);
@@ -274,11 +287,11 @@ AddressSanitizerRuntime::Activate()
if (symbol == NULL)
return;
- if (!symbol->GetAddress().IsValid())
+ if (!symbol->ValueIsAddress() || !symbol->GetAddressRef().IsValid())
return;
Target &target = m_process->GetTarget();
- addr_t symbol_address = symbol->GetAddress().GetOpcodeLoadAddress(&target);
+ addr_t symbol_address = symbol->GetAddressRef().GetOpcodeLoadAddress(&target);
if (symbol_address == LLDB_INVALID_ADDRESS)
return;