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>

llvm-svn: 257852
This commit is contained in:
Jim Ingham
2016-01-15 01:03:50 +00:00
parent 5a9a65e43f
commit cc4609a26b

View File

@@ -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::RetrieveReportData()
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)