1
- // ===-- ASanRuntime .cpp --------------- --------------------------*- C++ -*-===//
1
+ // ===-- InstrumentationRuntimeASan .cpp --------------------------*- C++ -*-===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
- #include " ASanRuntime .h"
9
+ #include " InstrumentationRuntimeASan .h"
10
10
11
11
#include " lldb/Breakpoint/StoppointCallbackContext.h"
12
12
#include " lldb/Core/Debugger.h"
@@ -31,39 +31,39 @@ using namespace lldb;
31
31
using namespace lldb_private ;
32
32
33
33
lldb::InstrumentationRuntimeSP
34
- AddressSanitizerRuntime ::CreateInstance (const lldb::ProcessSP &process_sp) {
35
- return InstrumentationRuntimeSP (new AddressSanitizerRuntime (process_sp));
34
+ InstrumentationRuntimeASan ::CreateInstance (const lldb::ProcessSP &process_sp) {
35
+ return InstrumentationRuntimeSP (new InstrumentationRuntimeASan (process_sp));
36
36
}
37
37
38
- void AddressSanitizerRuntime ::Initialize () {
38
+ void InstrumentationRuntimeASan ::Initialize () {
39
39
PluginManager::RegisterPlugin (
40
40
GetPluginNameStatic (), " AddressSanitizer instrumentation runtime plugin." ,
41
41
CreateInstance, GetTypeStatic);
42
42
}
43
43
44
- void AddressSanitizerRuntime ::Terminate () {
44
+ void InstrumentationRuntimeASan ::Terminate () {
45
45
PluginManager::UnregisterPlugin (CreateInstance);
46
46
}
47
47
48
- lldb_private::ConstString AddressSanitizerRuntime ::GetPluginNameStatic () {
48
+ lldb_private::ConstString InstrumentationRuntimeASan ::GetPluginNameStatic () {
49
49
return ConstString (" AddressSanitizer" );
50
50
}
51
51
52
- lldb::InstrumentationRuntimeType AddressSanitizerRuntime ::GetTypeStatic () {
52
+ lldb::InstrumentationRuntimeType InstrumentationRuntimeASan ::GetTypeStatic () {
53
53
return eInstrumentationRuntimeTypeAddressSanitizer;
54
54
}
55
55
56
- AddressSanitizerRuntime ::~AddressSanitizerRuntime () { Deactivate (); }
56
+ InstrumentationRuntimeASan ::~InstrumentationRuntimeASan () { Deactivate (); }
57
57
58
58
const RegularExpression &
59
- AddressSanitizerRuntime ::GetPatternForRuntimeLibrary () {
59
+ InstrumentationRuntimeASan ::GetPatternForRuntimeLibrary () {
60
60
// FIXME: This shouldn't include the "dylib" suffix.
61
61
static RegularExpression regex (
62
62
llvm::StringRef (" libclang_rt.asan_(.*)_dynamic\\ .dylib" ));
63
63
return regex;
64
64
}
65
65
66
- bool AddressSanitizerRuntime ::CheckIfRuntimeIsValid (
66
+ bool InstrumentationRuntimeASan ::CheckIfRuntimeIsValid (
67
67
const lldb::ModuleSP module_sp) {
68
68
const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType (
69
69
ConstString (" __asan_get_alloc_stack" ), lldb::eSymbolTypeAny);
@@ -108,7 +108,7 @@ t.description = __asan_get_report_description();
108
108
t
109
109
)" ;
110
110
111
- StructuredData::ObjectSP AddressSanitizerRuntime ::RetrieveReportData () {
111
+ StructuredData::ObjectSP InstrumentationRuntimeASan ::RetrieveReportData () {
112
112
ProcessSP process_sp = GetProcessSP ();
113
113
if (!process_sp)
114
114
return StructuredData::ObjectSP ();
@@ -189,7 +189,7 @@ StructuredData::ObjectSP AddressSanitizerRuntime::RetrieveReportData() {
189
189
}
190
190
191
191
std::string
192
- AddressSanitizerRuntime ::FormatDescription (StructuredData::ObjectSP report) {
192
+ InstrumentationRuntimeASan ::FormatDescription (StructuredData::ObjectSP report) {
193
193
std::string description = report->GetAsDictionary ()
194
194
->GetValueForKey (" description" )
195
195
->GetAsString ()
@@ -235,15 +235,15 @@ AddressSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) {
235
235
.Default (" AddressSanitizer detected: " + description);
236
236
}
237
237
238
- bool AddressSanitizerRuntime ::NotifyBreakpointHit (
238
+ bool InstrumentationRuntimeASan ::NotifyBreakpointHit (
239
239
void *baton, StoppointCallbackContext *context, user_id_t break_id,
240
240
user_id_t break_loc_id) {
241
241
assert (baton && " null baton" );
242
242
if (!baton)
243
243
return false ;
244
244
245
- AddressSanitizerRuntime *const instance =
246
- static_cast <AddressSanitizerRuntime *>(baton);
245
+ InstrumentationRuntimeASan *const instance =
246
+ static_cast <InstrumentationRuntimeASan *>(baton);
247
247
248
248
ProcessSP process_sp = instance->GetProcessSP ();
249
249
@@ -275,7 +275,7 @@ bool AddressSanitizerRuntime::NotifyBreakpointHit(
275
275
return false ; // Let target run
276
276
}
277
277
278
- void AddressSanitizerRuntime ::Activate () {
278
+ void InstrumentationRuntimeASan ::Activate () {
279
279
if (IsActive ())
280
280
return ;
281
281
@@ -305,15 +305,15 @@ void AddressSanitizerRuntime::Activate() {
305
305
process_sp->GetTarget ()
306
306
.CreateBreakpoint (symbol_address, internal, hardware)
307
307
.get ();
308
- breakpoint->SetCallback (AddressSanitizerRuntime ::NotifyBreakpointHit, this ,
308
+ breakpoint->SetCallback (InstrumentationRuntimeASan ::NotifyBreakpointHit, this ,
309
309
true );
310
310
breakpoint->SetBreakpointKind (" address-sanitizer-report" );
311
311
SetBreakpointID (breakpoint->GetID ());
312
312
313
313
SetActive (true );
314
314
}
315
315
316
- void AddressSanitizerRuntime ::Deactivate () {
316
+ void InstrumentationRuntimeASan ::Deactivate () {
317
317
if (GetBreakpointID () != LLDB_INVALID_BREAK_ID) {
318
318
ProcessSP process_sp = GetProcessSP ();
319
319
if (process_sp) {
0 commit comments