[Lldb-commits] [lldb] r257852 - The ASAN report fetching code had two latent bugs:

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 14 17:03:50 PST 2016


Author: jingham
Date: Thu Jan 14 19:03:50 2016
New Revision: 257852

URL: http://llvm.org/viewvc/llvm-project?rev=257852&view=rev
Log:
The ASAN report fetching code had two latent bugs:
1) It was forward declaring functions without 'extern "C"'.  That used to work
   but only because of another bug in how we passes symbol only function names to the
   compiler and stopped working recently.
2) These forward declarations were in the body of the User Expression, and they actually
   need to go in the prefix file.

<rdar://problem/24177689>

Modified:
    lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp

Modified: lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=257852&r1=257851&r2=257852&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp Thu Jan 14 19:03:50 2016
@@ -127,9 +127,10 @@ AddressSanitizerRuntime::IsActive()
 }
 
 #define RETRIEVE_REPORT_DATA_FUNCTION_TIMEOUT_USEC 2*1000*1000
-
 const char *
-address_sanitizer_retrieve_report_data_command = R"(
+address_sanitizer_retrieve_report_data_prefix = R"(
+extern "C"
+{
 int __asan_report_present();
 void *__asan_get_report_pc();
 void *__asan_get_report_bp();
@@ -138,6 +139,11 @@ void *__asan_get_report_address();
 const char *__asan_get_report_description();
 int __asan_get_report_access_type();
 size_t __asan_get_report_access_size();
+}
+)";
+
+const char *
+address_sanitizer_retrieve_report_data_command = R"(
 struct {
     int present;
     int access_type;
@@ -179,6 +185,7 @@ AddressSanitizerRuntime::RetrieveReportD
     options.SetStopOthers(true);
     options.SetIgnoreBreakpoints(true);
     options.SetTimeoutUsec(RETRIEVE_REPORT_DATA_FUNCTION_TIMEOUT_USEC);
+    options.SetPrefix(address_sanitizer_retrieve_report_data_prefix);
     
     ValueObjectSP return_value_sp;
     if (process_sp->GetTarget().EvaluateExpression(address_sanitizer_retrieve_report_data_command, frame_sp.get(), return_value_sp, options) != eExpressionCompleted)




More information about the lldb-commits mailing list