#include "InstrumentationRuntimeTSan.h"
#include "Plugins/Process/Utility/HistoryThread.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/UserExpression.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/InstrumentationRuntimeStopInfo.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
#include <memory>
usingnamespacelldb;
usingnamespacelldb_private;
LLDB_PLUGIN_DEFINE(…)
lldb::InstrumentationRuntimeSP
InstrumentationRuntimeTSan::CreateInstance(const lldb::ProcessSP &process_sp) { … }
void InstrumentationRuntimeTSan::Initialize() { … }
void InstrumentationRuntimeTSan::Terminate() { … }
lldb::InstrumentationRuntimeType InstrumentationRuntimeTSan::GetTypeStatic() { … }
InstrumentationRuntimeTSan::~InstrumentationRuntimeTSan() { … }
const char *thread_sanitizer_retrieve_report_data_prefix = …;
const char *thread_sanitizer_retrieve_report_data_command = …;
static StructuredData::ArraySP
CreateStackTrace(ValueObjectSP o,
const std::string &trace_item_name = ".trace") { … }
static StructuredData::ArraySP ConvertToStructuredArray(
ValueObjectSP return_value_sp, const std::string &items_name,
const std::string &count_name,
std::function<void(const ValueObjectSP &o,
const StructuredData::DictionarySP &dict)> const
&callback) { … }
static std::string RetrieveString(ValueObjectSP return_value_sp,
ProcessSP process_sp,
const std::string &expression_path) { … }
static void
GetRenumberedThreadIds(ProcessSP process_sp, ValueObjectSP data,
std::map<uint64_t, user_id_t> &thread_id_map) { … }
static user_id_t Renumber(uint64_t id,
std::map<uint64_t, user_id_t> &thread_id_map) { … }
StructuredData::ObjectSP InstrumentationRuntimeTSan::RetrieveReportData(
ExecutionContextRef exe_ctx_ref) { … }
std::string
InstrumentationRuntimeTSan::FormatDescription(StructuredData::ObjectSP report) { … }
static std::string Sprintf(const char *format, ...) { … }
static std::string GetSymbolNameFromAddress(ProcessSP process_sp, addr_t addr) { … }
static void GetSymbolDeclarationFromAddress(ProcessSP process_sp, addr_t addr,
Declaration &decl) { … }
addr_t InstrumentationRuntimeTSan::GetFirstNonInternalFramePc(
StructuredData::ObjectSP trace, bool skip_one_frame) { … }
std::string
InstrumentationRuntimeTSan::GenerateSummary(StructuredData::ObjectSP report) { … }
addr_t InstrumentationRuntimeTSan::GetMainRacyAddress(
StructuredData::ObjectSP report) { … }
std::string InstrumentationRuntimeTSan::GetLocationDescription(
StructuredData::ObjectSP report, addr_t &global_addr,
std::string &global_name, std::string &filename, uint32_t &line) { … }
bool InstrumentationRuntimeTSan::NotifyBreakpointHit(
void *baton, StoppointCallbackContext *context, user_id_t break_id,
user_id_t break_loc_id) { … }
const RegularExpression &
InstrumentationRuntimeTSan::GetPatternForRuntimeLibrary() { … }
bool InstrumentationRuntimeTSan::CheckIfRuntimeIsValid(
const lldb::ModuleSP module_sp) { … }
void InstrumentationRuntimeTSan::Activate() { … }
void InstrumentationRuntimeTSan::Deactivate() { … }
static std::string GenerateThreadName(const std::string &path,
StructuredData::Object *o,
StructuredData::ObjectSP main_info) { … }
static void AddThreadsForPath(const std::string &path,
ThreadCollectionSP threads, ProcessSP process_sp,
StructuredData::ObjectSP info) { … }
lldb::ThreadCollectionSP
InstrumentationRuntimeTSan::GetBacktracesFromExtendedStopInfo(
StructuredData::ObjectSP info) { … }