66 void *__tsan_get_current_report();
67 int __tsan_get_report_data(void *report, const char **description, int *count,
68 int *stack_count, int *mop_count, int *loc_count,
69 int *mutex_count, int *thread_count,
70 int *unique_tid_count, void **sleep_trace,
71 unsigned long trace_size);
72 int __tsan_get_report_stack(void *report, unsigned long idx, void **trace,
73 unsigned long trace_size);
74 int __tsan_get_report_mop(void *report, unsigned long idx, int *tid, void **addr,
75 int *size, int *write, int *atomic, void **trace,
76 unsigned long trace_size);
77 int __tsan_get_report_loc(void *report, unsigned long idx, const char **type,
78 void **addr, unsigned long *start, unsigned long *size, int *tid,
79 int *fd, int *suppressable, void **trace,
80 unsigned long trace_size);
81 int __tsan_get_report_mutex(void *report, unsigned long idx, unsigned long *mutex_id, void **addr,
82 int *destroyed, void **trace, unsigned long trace_size);
83 int __tsan_get_report_thread(void *report, unsigned long idx, int *tid, unsigned long *os_id,
84 int *running, const char **name, int *parent_tid,
85 void **trace, unsigned long trace_size);
86 int __tsan_get_report_unique_tid(void *report, unsigned long idx, int *tid);
88 // TODO: dlsym won't work on Windows.
89 void *dlsym(void* handle, const char* symbol);
90 int (*ptr__tsan_get_report_loc_object_type)(void *report, unsigned long idx, const char **object_type);
96const int REPORT_TRACE_SIZE = 128;
97const int REPORT_ARRAY_SIZE = 4;
101 const char *description;
104 void *sleep_trace[REPORT_TRACE_SIZE];
109 void *trace[REPORT_TRACE_SIZE];
110 } stacks[REPORT_ARRAY_SIZE];
120 void *trace[REPORT_TRACE_SIZE];
121 } mops[REPORT_ARRAY_SIZE];
133 void *trace[REPORT_TRACE_SIZE];
134 const char *object_type;
135 } locs[REPORT_ARRAY_SIZE];
140 unsigned long mutex_id;
143 void *trace[REPORT_TRACE_SIZE];
144 } mutexes[REPORT_ARRAY_SIZE];
154 void *trace[REPORT_TRACE_SIZE];
155 } threads[REPORT_ARRAY_SIZE];
157 int unique_tid_count;
161 } unique_tids[REPORT_ARRAY_SIZE];
164ptr__tsan_get_report_loc_object_type = (typeof(ptr__tsan_get_report_loc_object_type))(void *)dlsym((void*)-2 /*RTLD_DEFAULT*/, "__tsan_get_report_loc_object_type");
166t.report = __tsan_get_current_report();
167__tsan_get_report_data(t.report, &t.description, &t.report_count, &t.stack_count, &t.mop_count, &t.loc_count, &t.mutex_count, &t.thread_count, &t.unique_tid_count, t.sleep_trace, REPORT_TRACE_SIZE);
169if (t.stack_count > REPORT_ARRAY_SIZE) t.stack_count = REPORT_ARRAY_SIZE;
170for (int i = 0; i < t.stack_count; i++) {
172 __tsan_get_report_stack(t.report, i, t.stacks[i].trace, REPORT_TRACE_SIZE);
175if (t.mop_count > REPORT_ARRAY_SIZE) t.mop_count = REPORT_ARRAY_SIZE;
176for (int i = 0; i < t.mop_count; i++) {
178 __tsan_get_report_mop(t.report, i, &t.mops[i].tid, &t.mops[i].addr, &t.mops[i].size, &t.mops[i].write, &t.mops[i].atomic, t.mops[i].trace, REPORT_TRACE_SIZE);
181if (t.loc_count > REPORT_ARRAY_SIZE) t.loc_count = REPORT_ARRAY_SIZE;
182for (int i = 0; i < t.loc_count; i++) {
184 __tsan_get_report_loc(t.report, i, &t.locs[i].type, &t.locs[i].addr, &t.locs[i].start, &t.locs[i].size, &t.locs[i].tid, &t.locs[i].fd, &t.locs[i].suppressable, t.locs[i].trace, REPORT_TRACE_SIZE);
185 if (ptr__tsan_get_report_loc_object_type)
186 ptr__tsan_get_report_loc_object_type(t.report, i, &t.locs[i].object_type);
189if (t.mutex_count > REPORT_ARRAY_SIZE) t.mutex_count = REPORT_ARRAY_SIZE;
190for (int i = 0; i < t.mutex_count; i++) {
191 t.mutexes[i].idx = i;
192 __tsan_get_report_mutex(t.report, i, &t.mutexes[i].mutex_id, &t.mutexes[i].addr, &t.mutexes[i].destroyed, t.mutexes[i].trace, REPORT_TRACE_SIZE);
195if (t.thread_count > REPORT_ARRAY_SIZE) t.thread_count = REPORT_ARRAY_SIZE;
196for (int i = 0; i < t.thread_count; i++) {
197 t.threads[i].idx = i;
198 __tsan_get_report_thread(t.report, i, &t.threads[i].tid, &t.threads[i].os_id, &t.threads[i].running, &t.threads[i].name, &t.threads[i].parent_tid, t.threads[i].trace, REPORT_TRACE_SIZE);
201if (t.unique_tid_count > REPORT_ARRAY_SIZE) t.unique_tid_count = REPORT_ARRAY_SIZE;
202for (int i = 0; i < t.unique_tid_count; i++) {
203 t.unique_tids[i].idx = i;
204 __tsan_get_report_unique_tid(t.report, i, &t.unique_tids[i].tid);
212 const std::string &trace_item_name =
".trace") {
213 auto trace_sp = std::make_shared<StructuredData::Array>();
215 o->GetValueForExpressionPath(trace_item_name.c_str());
216 size_t count = trace_value_object->GetNumChildrenIgnoringErrors();
217 for (
size_t j = 0; j < count; j++) {
219 trace_value_object->GetChildAtIndex(j)->GetValueAsUnsigned(0);
222 trace_sp->AddIntegerItem(trace_addr);
228 ValueObjectSP return_value_sp,
const std::string &items_name,
229 const std::string &count_name,
233 auto array_sp = std::make_shared<StructuredData::Array>();
235 return_value_sp->GetValueForExpressionPath(count_name.c_str())
236 ->GetValueAsUnsigned(0);
238 return_value_sp->GetValueForExpressionPath(items_name.c_str());
239 for (
unsigned int i = 0; i < count; i++) {
241 auto dict_sp = std::make_shared<StructuredData::Dictionary>();
243 callback(o, dict_sp);
245 array_sp->AddItem(dict_sp);
252 const std::string &expression_path) {
254 return_value_sp->GetValueForExpressionPath(expression_path.c_str())
255 ->GetValueAsUnsigned(0);
258 process_sp->ReadCStringFromMemory(ptr, str,
error);
264 std::map<uint64_t, user_id_t> &thread_id_map) {
266 data,
".threads",
".thread_count",
270 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0);
271 uint64_t thread_os_id =
272 o->GetValueForExpressionPath(
".os_id")->GetValueAsUnsigned(0);
275 bool can_update =
true;
276 ThreadSP lldb_thread = process_sp->GetThreadList().FindThreadByID(
277 thread_os_id, can_update);
279 lldb_user_id = lldb_thread->GetIndexID();
285 lldb_user_id = process_sp->AssignIndexIDToThread(thread_os_id);
288 thread_id_map[thread_id] = lldb_user_id;
293 std::map<uint64_t, user_id_t> &thread_id_map) {
294 auto IT = thread_id_map.find(
id);
295 if (IT == thread_id_map.end())
319 options.
SetTimeout(process_sp->GetUtilityExpressionTimeout());
326 frame_sp->CalculateExecutionContext(exe_ctx);
332 ss <<
"cannot evaluate ThreadSanitizer expression:\n";
334 ss << main_value->GetError().AsCString();
336 process_sp->GetTarget().GetDebugger().GetID());
340 std::map<uint64_t, user_id_t> thread_id_map;
343 auto dict = std::make_shared<StructuredData::Dictionary>();
344 dict->AddStringItem(
"instrumentation_class",
"ThreadSanitizer");
345 dict->AddStringItem(
"issue_type",
347 dict->AddIntegerItem(
"report_count",
348 main_value->GetValueForExpressionPath(
".report_count")
349 ->GetValueAsUnsigned(0));
351 main_value,
".sleep_trace"));
354 main_value,
".stacks",
".stack_count",
357 dict->AddIntegerItem(
359 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
362 dict->AddIntegerItem(
"thread_id", thread_sp->GetIndexID());
364 dict->AddItem(
"stacks", stacks);
367 main_value,
".mops",
".mop_count",
370 dict->AddIntegerItem(
372 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
373 dict->AddIntegerItem(
376 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
378 dict->AddIntegerItem(
380 o->GetValueForExpressionPath(
".size")->GetValueAsUnsigned(0));
381 dict->AddBooleanItem(
383 o->GetValueForExpressionPath(
".write")->GetValueAsUnsigned(0));
384 dict->AddBooleanItem(
386 o->GetValueForExpressionPath(
".atomic")->GetValueAsUnsigned(0));
387 dict->AddIntegerItem(
389 o->GetValueForExpressionPath(
".addr")->GetValueAsUnsigned(0));
392 dict->AddItem(
"mops", mops);
395 main_value,
".locs",
".loc_count",
398 dict->AddIntegerItem(
400 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
401 dict->AddStringItem(
"type",
RetrieveString(o, process_sp,
".type"));
402 dict->AddIntegerItem(
404 o->GetValueForExpressionPath(
".addr")->GetValueAsUnsigned(0));
405 dict->AddIntegerItem(
407 o->GetValueForExpressionPath(
".start")->GetValueAsUnsigned(0));
408 dict->AddIntegerItem(
410 o->GetValueForExpressionPath(
".size")->GetValueAsUnsigned(0));
411 dict->AddIntegerItem(
414 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
416 dict->AddIntegerItem(
418 o->GetValueForExpressionPath(
".fd")->GetValueAsUnsigned(0));
419 dict->AddIntegerItem(
"suppressable",
420 o->GetValueForExpressionPath(
".suppressable")
421 ->GetValueAsUnsigned(0));
423 dict->AddStringItem(
"object_type",
426 dict->AddItem(
"locs", locs);
429 main_value,
".mutexes",
".mutex_count",
431 dict->AddIntegerItem(
433 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
434 dict->AddIntegerItem(
436 o->GetValueForExpressionPath(
".mutex_id")->GetValueAsUnsigned(0));
437 dict->AddIntegerItem(
439 o->GetValueForExpressionPath(
".addr")->GetValueAsUnsigned(0));
440 dict->AddIntegerItem(
442 o->GetValueForExpressionPath(
".destroyed")->GetValueAsUnsigned(0));
445 dict->AddItem(
"mutexes", mutexes);
448 main_value,
".threads",
".thread_count",
451 dict->AddIntegerItem(
453 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
454 dict->AddIntegerItem(
457 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
459 dict->AddIntegerItem(
461 o->GetValueForExpressionPath(
".os_id")->GetValueAsUnsigned(0));
462 dict->AddIntegerItem(
464 o->GetValueForExpressionPath(
".running")->GetValueAsUnsigned(0));
465 dict->AddStringItem(
"name",
RetrieveString(o, process_sp,
".name"));
466 dict->AddIntegerItem(
468 Renumber(o->GetValueForExpressionPath(
".parent_tid")
469 ->GetValueAsUnsigned(0),
473 dict->AddItem(
"threads", threads);
476 main_value,
".unique_tids",
".unique_tid_count",
479 dict->AddIntegerItem(
481 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
482 dict->AddIntegerItem(
485 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
488 dict->AddItem(
"unique_tids", unique_tids);
495 std::string description = std::string(report->GetAsDictionary()
496 ->GetValueForKey(
"issue_type")
500 if (description ==
"data-race") {
502 }
else if (description ==
"data-race-vptr") {
503 return "Data race on C++ virtual pointer";
504 }
else if (description ==
"heap-use-after-free") {
505 return "Use of deallocated memory";
506 }
else if (description ==
"heap-use-after-free-vptr") {
507 return "Use of deallocated C++ virtual pointer";
508 }
else if (description ==
"thread-leak") {
509 return "Thread leak";
510 }
else if (description ==
"locked-mutex-destroy") {
511 return "Destruction of a locked mutex";
512 }
else if (description ==
"mutex-double-lock") {
513 return "Double lock of a mutex";
514 }
else if (description ==
"mutex-invalid-access") {
515 return "Use of an uninitialized or destroyed mutex";
516 }
else if (description ==
"mutex-bad-unlock") {
517 return "Unlock of an unlocked mutex (or by a wrong thread)";
518 }
else if (description ==
"mutex-bad-read-lock") {
519 return "Read lock of a write locked mutex";
520 }
else if (description ==
"mutex-bad-read-unlock") {
521 return "Read unlock of a write locked mutex";
522 }
else if (description ==
"signal-unsafe-call") {
523 return "Signal-unsafe call inside a signal handler";
524 }
else if (description ==
"errno-in-signal-handler") {
525 return "Overwrite of errno in a signal handler";
526 }
else if (description ==
"lock-order-inversion") {
527 return "Lock order inversion (potential deadlock)";
528 }
else if (description ==
"external-race") {
529 return "Race on a library object";
530 }
else if (description ==
"swift-access-race") {
531 return "Swift access race";
538static std::string
Sprintf(
const char *format, ...) {
541 va_start(args, format);
549 if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress(addr,
564 if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress(addr,
584 decl = var->GetDeclaration();
593 for (
size_t i = 0; i < trace_array->
GetSize(); i++) {
594 if (skip_one_frame && i == 0)
600 addr_t addr = *maybe_addr;
603 if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress(
607 if (so_addr.
GetModule() == runtime_module_sp)
620 std::string summary = std::string(report->GetAsDictionary()
621 ->GetValueForKey(
"description")
624 bool skip_one_frame =
625 report->GetObjectForDotSeparatedPath(
"issue_type")->GetStringValue() ==
629 if (report->GetAsDictionary()
630 ->GetValueForKey(
"mops")
634 ->GetValueForKey(
"mops")
638 ->GetValueForKey(
"trace"),
641 if (report->GetAsDictionary()
642 ->GetValueForKey(
"stacks")
646 ->GetValueForKey(
"stacks")
650 ->GetValueForKey(
"trace"),
657 if (report->GetAsDictionary()
658 ->GetValueForKey(
"locs")
662 ->GetValueForKey(
"locs")
665 std::string object_type = std::string(loc->GetAsDictionary()
666 ->GetValueForKey(
"object_type")
669 if (!object_type.empty()) {
670 summary =
"Race on " + object_type +
" object";
672 addr_t addr = loc->GetAsDictionary()
673 ->GetValueForKey(
"address")
674 ->GetUnsignedIntegerValue();
676 addr = loc->GetAsDictionary()
677 ->GetValueForKey(
"start")
678 ->GetUnsignedIntegerValue();
682 if (!global_name.empty()) {
683 summary = summary +
" at " + global_name;
685 summary = summary +
" at " +
Sprintf(
"0x%llx", addr);
688 int fd = loc->GetAsDictionary()
689 ->GetValueForKey(
"file_descriptor")
690 ->GetSignedIntegerValue();
692 summary = summary +
" on file descriptor " +
Sprintf(
"%d", fd);
704 report->GetObjectForDotSeparatedPath(
"mops")->GetAsArray()->ForEach(
707 ->GetUnsignedIntegerValue();
713 return (result == (
addr_t)-1) ? 0 : result;
718 std::string &global_name, std::string &filename, uint32_t &line) {
723 if (report->GetAsDictionary()
724 ->GetValueForKey(
"locs")
728 ->GetValueForKey(
"locs")
731 std::string type = std::string(
732 loc->GetAsDictionary()->GetValueForKey(
"type")->GetStringValue());
733 if (type ==
"global") {
734 global_addr = loc->GetAsDictionary()
735 ->GetValueForKey(
"address")
736 ->GetUnsignedIntegerValue();
739 if (!global_name.empty()) {
740 result =
Sprintf(
"'%s' is a global variable (0x%llx)",
741 global_name.c_str(), global_addr);
743 result =
Sprintf(
"0x%llx is a global variable", global_addr);
752 }
else if (type ==
"heap") {
753 addr_t addr = loc->GetAsDictionary()
754 ->GetValueForKey(
"start")
755 ->GetUnsignedIntegerValue();
757 size_t size = loc->GetAsDictionary()
758 ->GetValueForKey(
"size")
759 ->GetUnsignedIntegerValue();
761 std::string object_type = std::string(loc->GetAsDictionary()
762 ->GetValueForKey(
"object_type")
765 if (!object_type.empty()) {
766 result =
Sprintf(
"Location is a %ld-byte %s object at 0x%llx", size,
767 object_type.c_str(), addr);
770 Sprintf(
"Location is a %ld-byte heap object at 0x%llx", size, addr);
772 }
else if (type ==
"stack") {
774 ->GetValueForKey(
"thread_id")
775 ->GetUnsignedIntegerValue();
777 result =
Sprintf(
"Location is stack of thread %d", tid);
778 }
else if (type ==
"tls") {
780 ->GetValueForKey(
"thread_id")
781 ->GetUnsignedIntegerValue();
783 result =
Sprintf(
"Location is TLS of thread %d", tid);
784 }
else if (type ==
"fd") {
785 int fd = loc->GetAsDictionary()
786 ->GetValueForKey(
"file_descriptor")
787 ->GetSignedIntegerValue();
789 result =
Sprintf(
"Location is file descriptor %d", fd);
799 assert(baton &&
"null baton");
808 if (process_sp->GetModIDRef().IsLastResumeForUserExpression())
813 std::string stop_reason_description =
814 "unknown thread sanitizer fault (unable to extract thread sanitizer "
818 report->GetAsDictionary()->AddStringItem(
"description", issue_description);
819 stop_reason_description = issue_description +
" detected";
820 report->GetAsDictionary()->AddStringItem(
"stop_description",
821 stop_reason_description);
823 report->GetAsDictionary()->AddStringItem(
"summary", summary);
825 report->GetAsDictionary()->AddIntegerItem(
"memory_address", main_address);
828 std::string global_name;
829 std::string location_filename;
830 uint32_t location_line = 0;
832 report, global_addr, global_name, location_filename, location_line);
833 report->GetAsDictionary()->AddStringItem(
"location_description",
834 location_description);
835 if (global_addr != 0) {
836 report->GetAsDictionary()->AddIntegerItem(
"global_address", global_addr);
838 if (!global_name.empty()) {
839 report->GetAsDictionary()->AddStringItem(
"global_name", global_name);
841 if (location_filename !=
"") {
842 report->GetAsDictionary()->AddStringItem(
"location_filename",
844 report->GetAsDictionary()->AddIntegerItem(
"location_line", location_line);
847 bool all_addresses_are_same =
true;
848 report->GetObjectForDotSeparatedPath(
"mops")->GetAsArray()->ForEach(
849 [&all_addresses_are_same,
852 ->GetUnsignedIntegerValue();
853 if (main_address != addr)
854 all_addresses_are_same =
false;
857 report->GetAsDictionary()->AddBooleanItem(
"all_addresses_are_same",
858 all_addresses_are_same);
865 thread_sp->SetStopInfo(
867 CreateStopReasonWithInstrumentationData(
868 *thread_sp, stop_reason_description, report));
870 StreamFile &s = process_sp->GetTarget().GetDebugger().GetOutputStream();
871 s.
Printf(
"ThreadSanitizer report breakpoint hit. Use 'thread "
872 "info -s' to get extended information about the "
888 static ConstString g_tsan_get_current_report(
"__tsan_get_current_report");
889 const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(
891 return symbol !=
nullptr;
906 if (symbol ==
nullptr)
912 Target &target = process_sp->GetTarget();
918 const bool internal =
true;
919 const bool hardware =
false;
920 const bool sync =
false;
946 std::string result =
"additional information";
948 if (path ==
"mops") {
960 std::string addr_string =
Sprintf(
" at 0x%llx", addr);
962 if (main_info->GetObjectForDotSeparatedPath(
"all_addresses_are_same")
963 ->GetBooleanValue()) {
967 if (main_info->GetObjectForDotSeparatedPath(
"issue_type")
968 ->GetStringValue() ==
"external-race") {
969 result =
Sprintf(
"%s access by thread %d",
970 is_write ?
"mutating" :
"read-only", thread_id);
971 }
else if (main_info->GetObjectForDotSeparatedPath(
"issue_type")
972 ->GetStringValue() ==
"swift-access-race") {
973 result =
Sprintf(
"modifying access by thread %d", thread_id);
975 result =
Sprintf(
"%s%s of size %zu%s by thread %" PRIu64,
976 is_atomic ?
"atomic " :
"", is_write ?
"write" :
"read",
977 size, addr_string.c_str(), thread_id);
981 if (path ==
"threads") {
984 result =
Sprintf(
"Thread %zu created", thread_id);
987 if (path ==
"locs") {
988 std::string type = std::string(
993 ->GetSignedIntegerValue();
994 if (type ==
"heap") {
995 result =
Sprintf(
"Heap block allocated by thread %" PRIu64, thread_id);
996 }
else if (type ==
"fd") {
997 result =
Sprintf(
"File descriptor %d created by thread %" PRIu64, fd,
1002 if (path ==
"mutexes") {
1006 result =
Sprintf(
"Mutex M%d created", mutex_id);
1009 if (path ==
"stacks") {
1012 result =
Sprintf(
"Thread %" PRIu64, thread_id);
1015 result[0] = toupper(result[0]);
1023 info->GetObjectForDotSeparatedPath(path)->GetAsArray()->ForEach(
1025 std::vector<lldb::addr_t> pcs;
1028 pcs.push_back(
pc->GetUnsignedIntegerValue());
1032 if (pcs.size() == 0)
1038 thread_id_obj ? thread_id_obj->GetUnsignedIntegerValue() : 0;
1041 std::make_shared<HistoryThread>(*process_sp, tid, pcs);
1046 process_sp->GetExtendedThreadList().AddThread(new_thread_sp);
1047 threads->AddThread(new_thread_sp);
1059 if (info->GetObjectForDotSeparatedPath(
"instrumentation_class")
1060 ->GetStringValue() !=
"ThreadSanitizer")
static llvm::raw_ostream & error(Stream &strm)
static void GetRenumberedThreadIds(ProcessSP process_sp, ValueObjectSP data, std::map< uint64_t, user_id_t > &thread_id_map)
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)
const char * thread_sanitizer_retrieve_report_data_prefix
static void GetSymbolDeclarationFromAddress(ProcessSP process_sp, addr_t addr, Declaration &decl)
static user_id_t Renumber(uint64_t id, std::map< uint64_t, user_id_t > &thread_id_map)
static std::string GenerateThreadName(const std::string &path, StructuredData::Object *o, StructuredData::ObjectSP main_info)
static std::string GetSymbolNameFromAddress(ProcessSP process_sp, addr_t addr)
static std::string RetrieveString(ValueObjectSP return_value_sp, ProcessSP process_sp, const std::string &expression_path)
static std::string Sprintf(const char *format,...)
static StructuredData::ArraySP CreateStackTrace(ValueObjectSP o, const std::string &trace_item_name=".trace")
const char * thread_sanitizer_retrieve_report_data_command
static void AddThreadsForPath(const std::string &path, ThreadCollectionSP threads, ProcessSP process_sp, StructuredData::ObjectSP info)
#define LLDB_PLUGIN_DEFINE(PluginName)
A section + offset based address class.
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
bool IsValid() const
Check if the object state is valid.
Symbol * CalculateSymbolContextSymbol() const
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Target & GetTarget()
Accessor for the breakpoint Target.
void SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous=false)
Set the callback action invoked when the breakpoint is hit.
Represents a generic declaration context in a program.
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
A class that describes the declaration location of a lldb object.
uint32_t GetLine() const
Get accessor for the declaration line number.
FileSpec & GetFile()
Get accessor for file specification.
void SetUnwindOnError(bool unwind=false)
void SetLanguage(lldb::LanguageType language_type)
void SetPrefix(const char *prefix)
void SetTryAllThreads(bool try_others=true)
void SetTimeout(const Timeout< std::micro > &timeout)
void SetAutoApplyFixIts(bool b)
void SetStopOthers(bool stop_others=true)
void SetIgnoreBreakpoints(bool ignore=false)
Execution context objects refer to objects in the execution of the program that is being debugged.
lldb::ThreadSP GetThreadSP() const
Get accessor that creates a strong reference from the weak thread reference contained in this object.
lldb::ProcessSP GetProcessSP() const
Get accessor that creates a strong reference from the weak process reference contained in this object...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
StructuredData::ObjectSP RetrieveReportData(ExecutionContextRef exe_ctx_ref)
bool CheckIfRuntimeIsValid(const lldb::ModuleSP module_sp) override
Check whether module_sp corresponds to a valid runtime library.
std::string GetLocationDescription(StructuredData::ObjectSP report, lldb::addr_t &global_addr, std::string &global_name, std::string &filename, uint32_t &line)
const RegularExpression & GetPatternForRuntimeLibrary() override
Return a regular expression which can be used to identify a valid version of the runtime library.
~InstrumentationRuntimeTSan() override
static llvm::StringRef GetPluginNameStatic()
lldb::addr_t GetMainRacyAddress(StructuredData::ObjectSP report)
static lldb::InstrumentationRuntimeSP CreateInstance(const lldb::ProcessSP &process_sp)
static lldb::InstrumentationRuntimeType GetTypeStatic()
void Activate() override
Register a breakpoint in the runtime library and perform any other necessary initialization.
static bool NotifyBreakpointHit(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
lldb::addr_t GetFirstNonInternalFramePc(StructuredData::ObjectSP trace, bool skip_one_frame=false)
std::string GenerateSummary(StructuredData::ObjectSP report)
lldb::ThreadCollectionSP GetBacktracesFromExtendedStopInfo(StructuredData::ObjectSP info) override
std::string FormatDescription(StructuredData::ObjectSP report)
void SetBreakpointID(lldb::user_id_t ID)
void SetActive(bool IsActive)
lldb::user_id_t GetBreakpointID() const
lldb::ModuleSP GetRuntimeModuleSP()
lldb::ProcessSP GetProcessSP()
ConstString GetName(NamePreference preference=ePreferDemangled) const
Best name get accessor.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
ExecutionContextRef exe_ctx_ref
lldb::break_id_t GetID() const
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t size_t PrintfVarArg(const char *format, va_list args)
std::optional< IntType > GetItemAtIndexAsInteger(size_t idx) const
ObjectSP GetValueForKey(llvm::StringRef key) const
Dictionary * GetAsDictionary()
ObjectSP GetObjectForDotSeparatedPath(llvm::StringRef path)
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
std::shared_ptr< Array > ArraySP
bool ValueIsAddress() const
lldb::ModuleSP CalculateSymbolContextModule() override
Address & GetAddressRef()
ConstString GetName() const
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
static lldb::ExpressionResults Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, llvm::StringRef expr_cstr, llvm::StringRef expr_prefix, lldb::ValueObjectSP &result_valobj_sp, std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
Evaluate one expression in the scratch context of the target passed in the exe_ctx and return its res...
lldb::VariableSP GetVariableAtIndex(size_t idx) const
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_ADDRESS
@ DoNoSelectMostRelevantFrame
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eLanguageTypeObjC_plus_plus
Objective-C++.
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Process > ProcessSP
InstrumentationRuntimeType
@ eInstrumentationRuntimeTypeThreadSanitizer
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::InstrumentationRuntime > InstrumentationRuntimeSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::ThreadCollection > ThreadCollectionSP