Skip to content

Commit 7745990

Browse files
committed
[lldb/Plugin] Rename TSanRuntime for consistency with plugin (NFC)
Renames TSanRuntime to InstrumentationRuntimeTSan to be consistent with the directory structure and plugin name.
1 parent 0feedeb commit 7745990

File tree

5 files changed

+46
-45
lines changed

5 files changed

+46
-45
lines changed

lldb/source/API/SystemInitializerFull.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
5757
#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h"
5858
#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
59-
#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
59+
#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h"
6060
#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
6161
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
6262
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
@@ -223,7 +223,7 @@ llvm::Error SystemInitializerFull::Initialize() {
223223
minidump::ProcessMinidump::Initialize();
224224
MemoryHistoryASan::Initialize();
225225
InstrumentationRuntimeASan::Initialize();
226-
ThreadSanitizerRuntime::Initialize();
226+
InstrumentationRuntimeTSan::Initialize();
227227
UndefinedBehaviorSanitizerRuntime::Initialize();
228228
MainThreadCheckerRuntime::Initialize();
229229

@@ -317,7 +317,7 @@ void SystemInitializerFull::Terminate() {
317317
minidump::ProcessMinidump::Terminate();
318318
MemoryHistoryASan::Terminate();
319319
InstrumentationRuntimeASan::Terminate();
320-
ThreadSanitizerRuntime::Terminate();
320+
InstrumentationRuntimeTSan::Terminate();
321321
UndefinedBehaviorSanitizerRuntime::Terminate();
322322
MainThreadCheckerRuntime::Terminate();
323323
wasm::SymbolVendorWasm::Terminate();

lldb/source/Plugins/InstrumentationRuntime/TSan/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_lldb_library(lldbPluginInstrumentationRuntimeTSan PLUGIN
2-
TSanRuntime.cpp
2+
InstrumentationRuntimeTSan.cpp
33

44
LINK_LIBS
55
lldbBreakpoint

lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp renamed to lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//===-- TSanRuntime.cpp -----------------------------------------*- C++ -*-===//
1+
//===-- InstrumentationRuntimeTSan.cpp --------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "TSanRuntime.h"
9+
#include "InstrumentationRuntimeTSan.h"
1010

1111
#include "Plugins/Process/Utility/HistoryThread.h"
1212
#include "lldb/Breakpoint/StoppointCallbackContext.h"
@@ -36,29 +36,29 @@ using namespace lldb;
3636
using namespace lldb_private;
3737

3838
lldb::InstrumentationRuntimeSP
39-
ThreadSanitizerRuntime::CreateInstance(const lldb::ProcessSP &process_sp) {
40-
return InstrumentationRuntimeSP(new ThreadSanitizerRuntime(process_sp));
39+
InstrumentationRuntimeTSan::CreateInstance(const lldb::ProcessSP &process_sp) {
40+
return InstrumentationRuntimeSP(new InstrumentationRuntimeTSan(process_sp));
4141
}
4242

43-
void ThreadSanitizerRuntime::Initialize() {
43+
void InstrumentationRuntimeTSan::Initialize() {
4444
PluginManager::RegisterPlugin(
4545
GetPluginNameStatic(), "ThreadSanitizer instrumentation runtime plugin.",
4646
CreateInstance, GetTypeStatic);
4747
}
4848

49-
void ThreadSanitizerRuntime::Terminate() {
49+
void InstrumentationRuntimeTSan::Terminate() {
5050
PluginManager::UnregisterPlugin(CreateInstance);
5151
}
5252

53-
lldb_private::ConstString ThreadSanitizerRuntime::GetPluginNameStatic() {
53+
lldb_private::ConstString InstrumentationRuntimeTSan::GetPluginNameStatic() {
5454
return ConstString("ThreadSanitizer");
5555
}
5656

57-
lldb::InstrumentationRuntimeType ThreadSanitizerRuntime::GetTypeStatic() {
57+
lldb::InstrumentationRuntimeType InstrumentationRuntimeTSan::GetTypeStatic() {
5858
return eInstrumentationRuntimeTypeThreadSanitizer;
5959
}
6060

61-
ThreadSanitizerRuntime::~ThreadSanitizerRuntime() { Deactivate(); }
61+
InstrumentationRuntimeTSan::~InstrumentationRuntimeTSan() { Deactivate(); }
6262

6363
const char *thread_sanitizer_retrieve_report_data_prefix = R"(
6464
extern "C"
@@ -84,7 +84,7 @@ extern "C"
8484
int *running, const char **name, int *parent_tid,
8585
void **trace, unsigned long trace_size);
8686
int __tsan_get_report_unique_tid(void *report, unsigned long idx, int *tid);
87-
87+
8888
// TODO: dlsym won't work on Windows.
8989
void *dlsym(void* handle, const char* symbol);
9090
int (*ptr__tsan_get_report_loc_object_type)(void *report, unsigned long idx, const char **object_type);
@@ -97,15 +97,15 @@ struct data {
9797
void *report;
9898
const char *description;
9999
int report_count;
100-
100+
101101
void *sleep_trace[REPORT_TRACE_SIZE];
102-
102+
103103
int stack_count;
104104
struct {
105105
int idx;
106106
void *trace[REPORT_TRACE_SIZE];
107107
} stacks[REPORT_ARRAY_SIZE];
108-
108+
109109
int mop_count;
110110
struct {
111111
int idx;
@@ -116,7 +116,7 @@ struct data {
116116
void *addr;
117117
void *trace[REPORT_TRACE_SIZE];
118118
} mops[REPORT_ARRAY_SIZE];
119-
119+
120120
int loc_count;
121121
struct {
122122
int idx;
@@ -130,7 +130,7 @@ struct data {
130130
void *trace[REPORT_TRACE_SIZE];
131131
const char *object_type;
132132
} locs[REPORT_ARRAY_SIZE];
133-
133+
134134
int mutex_count;
135135
struct {
136136
int idx;
@@ -139,7 +139,7 @@ struct data {
139139
int destroyed;
140140
void *trace[REPORT_TRACE_SIZE];
141141
} mutexes[REPORT_ARRAY_SIZE];
142-
142+
143143
int thread_count;
144144
struct {
145145
int idx;
@@ -150,7 +150,7 @@ struct data {
150150
int parent_tid;
151151
void *trace[REPORT_TRACE_SIZE];
152152
} threads[REPORT_ARRAY_SIZE];
153-
153+
154154
int unique_tid_count;
155155
struct {
156156
int idx;
@@ -299,8 +299,8 @@ static user_id_t Renumber(uint64_t id,
299299
return IT->second;
300300
}
301301

302-
StructuredData::ObjectSP
303-
ThreadSanitizerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) {
302+
StructuredData::ObjectSP InstrumentationRuntimeTSan::RetrieveReportData(
303+
ExecutionContextRef exe_ctx_ref) {
304304
ProcessSP process_sp = GetProcessSP();
305305
if (!process_sp)
306306
return StructuredData::ObjectSP();
@@ -486,7 +486,7 @@ ThreadSanitizerRuntime::RetrieveReportData(ExecutionContextRef exe_ctx_ref) {
486486
}
487487

488488
std::string
489-
ThreadSanitizerRuntime::FormatDescription(StructuredData::ObjectSP report) {
489+
InstrumentationRuntimeTSan::FormatDescription(StructuredData::ObjectSP report) {
490490
std::string description = report->GetAsDictionary()
491491
->GetValueForKey("issue_type")
492492
->GetAsString()
@@ -580,7 +580,7 @@ static void GetSymbolDeclarationFromAddress(ProcessSP process_sp, addr_t addr,
580580
decl = var->GetDeclaration();
581581
}
582582

583-
addr_t ThreadSanitizerRuntime::GetFirstNonInternalFramePc(
583+
addr_t InstrumentationRuntimeTSan::GetFirstNonInternalFramePc(
584584
StructuredData::ObjectSP trace, bool skip_one_frame) {
585585
ProcessSP process_sp = GetProcessSP();
586586
ModuleSP runtime_module_sp = GetRuntimeModuleSP();
@@ -609,7 +609,7 @@ addr_t ThreadSanitizerRuntime::GetFirstNonInternalFramePc(
609609
}
610610

611611
std::string
612-
ThreadSanitizerRuntime::GenerateSummary(StructuredData::ObjectSP report) {
612+
InstrumentationRuntimeTSan::GenerateSummary(StructuredData::ObjectSP report) {
613613
ProcessSP process_sp = GetProcessSP();
614614

615615
std::string summary = report->GetAsDictionary()
@@ -695,8 +695,8 @@ ThreadSanitizerRuntime::GenerateSummary(StructuredData::ObjectSP report) {
695695
return summary;
696696
}
697697

698-
addr_t
699-
ThreadSanitizerRuntime::GetMainRacyAddress(StructuredData::ObjectSP report) {
698+
addr_t InstrumentationRuntimeTSan::GetMainRacyAddress(
699+
StructuredData::ObjectSP report) {
700700
addr_t result = (addr_t)-1;
701701

702702
report->GetObjectForDotSeparatedPath("mops")->GetAsArray()->ForEach(
@@ -711,7 +711,7 @@ ThreadSanitizerRuntime::GetMainRacyAddress(StructuredData::ObjectSP report) {
711711
return (result == (addr_t)-1) ? 0 : result;
712712
}
713713

714-
std::string ThreadSanitizerRuntime::GetLocationDescription(
714+
std::string InstrumentationRuntimeTSan::GetLocationDescription(
715715
StructuredData::ObjectSP report, addr_t &global_addr,
716716
std::string &global_name, std::string &filename, uint32_t &line) {
717717
std::string result = "";
@@ -791,15 +791,15 @@ std::string ThreadSanitizerRuntime::GetLocationDescription(
791791
return result;
792792
}
793793

794-
bool ThreadSanitizerRuntime::NotifyBreakpointHit(
794+
bool InstrumentationRuntimeTSan::NotifyBreakpointHit(
795795
void *baton, StoppointCallbackContext *context, user_id_t break_id,
796796
user_id_t break_loc_id) {
797797
assert(baton && "null baton");
798798
if (!baton)
799799
return false;
800800

801-
ThreadSanitizerRuntime *const instance =
802-
static_cast<ThreadSanitizerRuntime *>(baton);
801+
InstrumentationRuntimeTSan *const instance =
802+
static_cast<InstrumentationRuntimeTSan *>(baton);
803803

804804
ProcessSP process_sp = instance->GetProcessSP();
805805

@@ -873,20 +873,21 @@ bool ThreadSanitizerRuntime::NotifyBreakpointHit(
873873
return false; // Let target run
874874
}
875875

876-
const RegularExpression &ThreadSanitizerRuntime::GetPatternForRuntimeLibrary() {
876+
const RegularExpression &
877+
InstrumentationRuntimeTSan::GetPatternForRuntimeLibrary() {
877878
static RegularExpression regex(llvm::StringRef("libclang_rt.tsan_"));
878879
return regex;
879880
}
880881

881-
bool ThreadSanitizerRuntime::CheckIfRuntimeIsValid(
882+
bool InstrumentationRuntimeTSan::CheckIfRuntimeIsValid(
882883
const lldb::ModuleSP module_sp) {
883884
static ConstString g_tsan_get_current_report("__tsan_get_current_report");
884885
const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(
885886
g_tsan_get_current_report, lldb::eSymbolTypeAny);
886887
return symbol != nullptr;
887888
}
888889

889-
void ThreadSanitizerRuntime::Activate() {
890+
void InstrumentationRuntimeTSan::Activate() {
890891
if (IsActive())
891892
return;
892893

@@ -916,15 +917,15 @@ void ThreadSanitizerRuntime::Activate() {
916917
process_sp->GetTarget()
917918
.CreateBreakpoint(symbol_address, internal, hardware)
918919
.get();
919-
breakpoint->SetCallback(ThreadSanitizerRuntime::NotifyBreakpointHit, this,
920+
breakpoint->SetCallback(InstrumentationRuntimeTSan::NotifyBreakpointHit, this,
920921
true);
921922
breakpoint->SetBreakpointKind("thread-sanitizer-report");
922923
SetBreakpointID(breakpoint->GetID());
923924

924925
SetActive(true);
925926
}
926927

927-
void ThreadSanitizerRuntime::Deactivate() {
928+
void InstrumentationRuntimeTSan::Deactivate() {
928929
if (GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
929930
ProcessSP process_sp = GetProcessSP();
930931
if (process_sp) {
@@ -1043,7 +1044,7 @@ static void AddThreadsForPath(const std::string &path,
10431044
}
10441045

10451046
lldb::ThreadCollectionSP
1046-
ThreadSanitizerRuntime::GetBacktracesFromExtendedStopInfo(
1047+
InstrumentationRuntimeTSan::GetBacktracesFromExtendedStopInfo(
10471048
StructuredData::ObjectSP info) {
10481049
ThreadCollectionSP threads;
10491050
threads = std::make_shared<ThreadCollection>();

lldb/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.h renamed to lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- TSanRuntime.h -------------------------------------------*- C++ -*-===//
1+
//===-- InstrumentationRuntimeTSan.h ----------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -16,9 +16,9 @@
1616

1717
namespace lldb_private {
1818

19-
class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime {
19+
class InstrumentationRuntimeTSan : public lldb_private::InstrumentationRuntime {
2020
public:
21-
~ThreadSanitizerRuntime() override;
21+
~InstrumentationRuntimeTSan() override;
2222

2323
static lldb::InstrumentationRuntimeSP
2424
CreateInstance(const lldb::ProcessSP &process_sp);
@@ -43,7 +43,7 @@ class ThreadSanitizerRuntime : public lldb_private::InstrumentationRuntime {
4343
GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override;
4444

4545
private:
46-
ThreadSanitizerRuntime(const lldb::ProcessSP &process_sp)
46+
InstrumentationRuntimeTSan(const lldb::ProcessSP &process_sp)
4747
: lldb_private::InstrumentationRuntime(process_sp) {}
4848

4949
const RegularExpression &GetPatternForRuntimeLibrary() override;

lldb/tools/lldb-test/SystemInitializerTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
4747
#include "Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.h"
4848
#include "Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.h"
49-
#include "Plugins/InstrumentationRuntime/TSan/TSanRuntime.h"
49+
#include "Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.h"
5050
#include "Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.h"
5151
#include "Plugins/JITLoader/GDB/JITLoaderGDB.h"
5252
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
@@ -194,7 +194,7 @@ llvm::Error SystemInitializerTest::Initialize() {
194194
minidump::ProcessMinidump::Initialize();
195195
MemoryHistoryASan::Initialize();
196196
InstrumentationRuntimeASan::Initialize();
197-
ThreadSanitizerRuntime::Initialize();
197+
InstrumentationRuntimeTSan::Initialize();
198198
UndefinedBehaviorSanitizerRuntime::Initialize();
199199
MainThreadCheckerRuntime::Initialize();
200200

@@ -287,7 +287,7 @@ void SystemInitializerTest::Terminate() {
287287
minidump::ProcessMinidump::Terminate();
288288
MemoryHistoryASan::Terminate();
289289
InstrumentationRuntimeASan::Terminate();
290-
ThreadSanitizerRuntime::Terminate();
290+
InstrumentationRuntimeTSan::Terminate();
291291
UndefinedBehaviorSanitizerRuntime::Terminate();
292292
MainThreadCheckerRuntime::Terminate();
293293
wasm::SymbolVendorWasm::Terminate();

0 commit comments

Comments
 (0)