64 void *__tsan_get_current_report();
65 int __tsan_get_report_data(void *report, const char **description, int *count,
66 int *stack_count, int *mop_count, int *loc_count,
67 int *mutex_count, int *thread_count,
68 int *unique_tid_count, void **sleep_trace,
69 unsigned long trace_size);
70 int __tsan_get_report_stack(void *report, unsigned long idx, void **trace,
71 unsigned long trace_size);
72 int __tsan_get_report_mop(void *report, unsigned long idx, int *tid, void **addr,
73 int *size, int *write, int *atomic, void **trace,
74 unsigned long trace_size);
75 int __tsan_get_report_loc(void *report, unsigned long idx, const char **type,
76 void **addr, unsigned long *start, unsigned long *size, int *tid,
77 int *fd, int *suppressable, void **trace,
78 unsigned long trace_size);
79 int __tsan_get_report_mutex(void *report, unsigned long idx, unsigned long *mutex_id, void **addr,
80 int *destroyed, void **trace, unsigned long trace_size);
81 int __tsan_get_report_thread(void *report, unsigned long idx, int *tid, unsigned long *os_id,
82 int *running, const char **name, int *parent_tid,
83 void **trace, unsigned long trace_size);
84 int __tsan_get_report_unique_tid(void *report, unsigned long idx, int *tid);
86 // TODO: dlsym won't work on Windows.
87 void *dlsym(void* handle, const char* symbol);
88 int (*ptr__tsan_get_report_loc_object_type)(void *report, unsigned long idx, const char **object_type);
94const int REPORT_TRACE_SIZE = 128;
95const int REPORT_ARRAY_SIZE = 4;
99 const char *description;
102 void *sleep_trace[REPORT_TRACE_SIZE];
107 void *trace[REPORT_TRACE_SIZE];
108 } stacks[REPORT_ARRAY_SIZE];
118 void *trace[REPORT_TRACE_SIZE];
119 } mops[REPORT_ARRAY_SIZE];
131 void *trace[REPORT_TRACE_SIZE];
132 const char *object_type;
133 } locs[REPORT_ARRAY_SIZE];
138 unsigned long mutex_id;
141 void *trace[REPORT_TRACE_SIZE];
142 } mutexes[REPORT_ARRAY_SIZE];
152 void *trace[REPORT_TRACE_SIZE];
153 } threads[REPORT_ARRAY_SIZE];
155 int unique_tid_count;
159 } unique_tids[REPORT_ARRAY_SIZE];
162ptr__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");
164t.report = __tsan_get_current_report();
165__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);
167if (t.stack_count > REPORT_ARRAY_SIZE) t.stack_count = REPORT_ARRAY_SIZE;
168for (int i = 0; i < t.stack_count; i++) {
170 __tsan_get_report_stack(t.report, i, t.stacks[i].trace, REPORT_TRACE_SIZE);
173if (t.mop_count > REPORT_ARRAY_SIZE) t.mop_count = REPORT_ARRAY_SIZE;
174for (int i = 0; i < t.mop_count; i++) {
176 __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);
179if (t.loc_count > REPORT_ARRAY_SIZE) t.loc_count = REPORT_ARRAY_SIZE;
180for (int i = 0; i < t.loc_count; i++) {
182 __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);
183 if (ptr__tsan_get_report_loc_object_type)
184 ptr__tsan_get_report_loc_object_type(t.report, i, &t.locs[i].object_type);
187if (t.mutex_count > REPORT_ARRAY_SIZE) t.mutex_count = REPORT_ARRAY_SIZE;
188for (int i = 0; i < t.mutex_count; i++) {
189 t.mutexes[i].idx = i;
190 __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);
193if (t.thread_count > REPORT_ARRAY_SIZE) t.thread_count = REPORT_ARRAY_SIZE;
194for (int i = 0; i < t.thread_count; i++) {
195 t.threads[i].idx = i;
196 __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);
199if (t.unique_tid_count > REPORT_ARRAY_SIZE) t.unique_tid_count = REPORT_ARRAY_SIZE;
200for (int i = 0; i < t.unique_tid_count; i++) {
201 t.unique_tids[i].idx = i;
202 __tsan_get_report_unique_tid(t.report, i, &t.unique_tids[i].tid);
210 const std::string &trace_item_name =
".trace") {
211 auto trace_sp = std::make_shared<StructuredData::Array>();
213 o->GetValueForExpressionPath(trace_item_name.c_str());
214 size_t count = trace_value_object->GetNumChildren();
215 for (
size_t j = 0; j < count; j++) {
217 trace_value_object->GetChildAtIndex(j)->GetValueAsUnsigned(0);
220 trace_sp->AddIntegerItem(trace_addr);
226 ValueObjectSP return_value_sp,
const std::string &items_name,
227 const std::string &count_name,
231 auto array_sp = std::make_shared<StructuredData::Array>();
233 return_value_sp->GetValueForExpressionPath(count_name.c_str())
234 ->GetValueAsUnsigned(0);
236 return_value_sp->GetValueForExpressionPath(items_name.c_str());
237 for (
unsigned int i = 0; i < count; i++) {
239 auto dict_sp = std::make_shared<StructuredData::Dictionary>();
241 callback(o, dict_sp);
243 array_sp->AddItem(dict_sp);
250 const std::string &expression_path) {
252 return_value_sp->GetValueForExpressionPath(expression_path.c_str())
253 ->GetValueAsUnsigned(0);
256 process_sp->ReadCStringFromMemory(ptr, str,
error);
262 std::map<uint64_t, user_id_t> &thread_id_map) {
264 data,
".threads",
".thread_count",
268 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0);
269 uint64_t thread_os_id =
270 o->GetValueForExpressionPath(
".os_id")->GetValueAsUnsigned(0);
273 bool can_update =
true;
274 ThreadSP lldb_thread = process_sp->GetThreadList().FindThreadByID(
275 thread_os_id, can_update);
277 lldb_user_id = lldb_thread->GetIndexID();
283 lldb_user_id = process_sp->AssignIndexIDToThread(thread_os_id);
286 thread_id_map[thread_id] = lldb_user_id;
291 std::map<uint64_t, user_id_t> &thread_id_map) {
292 auto IT = thread_id_map.find(
id);
293 if (IT == thread_id_map.end())
317 options.
SetTimeout(process_sp->GetUtilityExpressionTimeout());
325 frame_sp->CalculateExecutionContext(exe_ctx);
328 main_value, eval_error);
331 ss <<
"cannot evaluate ThreadSanitizer expression:\n";
334 process_sp->GetTarget().GetDebugger().GetID());
338 std::map<uint64_t, user_id_t> thread_id_map;
341 auto dict = std::make_shared<StructuredData::Dictionary>();
342 dict->AddStringItem(
"instrumentation_class",
"ThreadSanitizer");
343 dict->AddStringItem(
"issue_type",
345 dict->AddIntegerItem(
"report_count",
346 main_value->GetValueForExpressionPath(
".report_count")
347 ->GetValueAsUnsigned(0));
349 main_value,
".sleep_trace"));
352 main_value,
".stacks",
".stack_count",
355 dict->AddIntegerItem(
357 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
360 dict->AddIntegerItem(
"thread_id", thread_sp->GetIndexID());
362 dict->AddItem(
"stacks", stacks);
365 main_value,
".mops",
".mop_count",
368 dict->AddIntegerItem(
370 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
371 dict->AddIntegerItem(
374 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
376 dict->AddIntegerItem(
378 o->GetValueForExpressionPath(
".size")->GetValueAsUnsigned(0));
379 dict->AddBooleanItem(
381 o->GetValueForExpressionPath(
".write")->GetValueAsUnsigned(0));
382 dict->AddBooleanItem(
384 o->GetValueForExpressionPath(
".atomic")->GetValueAsUnsigned(0));
385 dict->AddIntegerItem(
387 o->GetValueForExpressionPath(
".addr")->GetValueAsUnsigned(0));
390 dict->AddItem(
"mops", mops);
393 main_value,
".locs",
".loc_count",
396 dict->AddIntegerItem(
398 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
399 dict->AddStringItem(
"type",
RetrieveString(o, process_sp,
".type"));
400 dict->AddIntegerItem(
402 o->GetValueForExpressionPath(
".addr")->GetValueAsUnsigned(0));
403 dict->AddIntegerItem(
405 o->GetValueForExpressionPath(
".start")->GetValueAsUnsigned(0));
406 dict->AddIntegerItem(
408 o->GetValueForExpressionPath(
".size")->GetValueAsUnsigned(0));
409 dict->AddIntegerItem(
412 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
414 dict->AddIntegerItem(
416 o->GetValueForExpressionPath(
".fd")->GetValueAsUnsigned(0));
417 dict->AddIntegerItem(
"suppressable",
418 o->GetValueForExpressionPath(
".suppressable")
419 ->GetValueAsUnsigned(0));
421 dict->AddStringItem(
"object_type",
424 dict->AddItem(
"locs", locs);
427 main_value,
".mutexes",
".mutex_count",
429 dict->AddIntegerItem(
431 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
432 dict->AddIntegerItem(
434 o->GetValueForExpressionPath(
".mutex_id")->GetValueAsUnsigned(0));
435 dict->AddIntegerItem(
437 o->GetValueForExpressionPath(
".addr")->GetValueAsUnsigned(0));
438 dict->AddIntegerItem(
440 o->GetValueForExpressionPath(
".destroyed")->GetValueAsUnsigned(0));
443 dict->AddItem(
"mutexes", mutexes);
446 main_value,
".threads",
".thread_count",
449 dict->AddIntegerItem(
451 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
452 dict->AddIntegerItem(
455 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
457 dict->AddIntegerItem(
459 o->GetValueForExpressionPath(
".os_id")->GetValueAsUnsigned(0));
460 dict->AddIntegerItem(
462 o->GetValueForExpressionPath(
".running")->GetValueAsUnsigned(0));
463 dict->AddStringItem(
"name",
RetrieveString(o, process_sp,
".name"));
464 dict->AddIntegerItem(
466 Renumber(o->GetValueForExpressionPath(
".parent_tid")
467 ->GetValueAsUnsigned(0),
471 dict->AddItem(
"threads", threads);
474 main_value,
".unique_tids",
".unique_tid_count",
477 dict->AddIntegerItem(
479 o->GetValueForExpressionPath(
".idx")->GetValueAsUnsigned(0));
480 dict->AddIntegerItem(
483 o->GetValueForExpressionPath(
".tid")->GetValueAsUnsigned(0),
486 dict->AddItem(
"unique_tids", unique_tids);
493 std::string description = std::string(report->GetAsDictionary()
494 ->GetValueForKey(
"issue_type")
498 if (description ==
"data-race") {
500 }
else if (description ==
"data-race-vptr") {
501 return "Data race on C++ virtual pointer";
502 }
else if (description ==
"heap-use-after-free") {
503 return "Use of deallocated memory";
504 }
else if (description ==
"heap-use-after-free-vptr") {
505 return "Use of deallocated C++ virtual pointer";
506 }
else if (description ==
"thread-leak") {
507 return "Thread leak";
508 }
else if (description ==
"locked-mutex-destroy") {
509 return "Destruction of a locked mutex";
510 }
else if (description ==
"mutex-double-lock") {
511 return "Double lock of a mutex";
512 }
else if (description ==
"mutex-invalid-access") {
513 return "Use of an uninitialized or destroyed mutex";
514 }
else if (description ==
"mutex-bad-unlock") {
515 return "Unlock of an unlocked mutex (or by a wrong thread)";
516 }
else if (description ==
"mutex-bad-read-lock") {
517 return "Read lock of a write locked mutex";
518 }
else if (description ==
"mutex-bad-read-unlock") {
519 return "Read unlock of a write locked mutex";
520 }
else if (description ==
"signal-unsafe-call") {
521 return "Signal-unsafe call inside a signal handler";
522 }
else if (description ==
"errno-in-signal-handler") {
523 return "Overwrite of errno in a signal handler";
524 }
else if (description ==
"lock-order-inversion") {
525 return "Lock order inversion (potential deadlock)";
526 }
else if (description ==
"external-race") {
527 return "Race on a library object";
528 }
else if (description ==
"swift-access-race") {
529 return "Swift access race";
536static std::string
Sprintf(
const char *format, ...) {
539 va_start(args, format);
547 if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress(addr,
562 if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress(addr,
582 decl = var->GetDeclaration();
591 for (
size_t i = 0; i < trace_array->
GetSize(); i++) {
592 if (skip_one_frame && i == 0)
600 if (!process_sp->GetTarget().GetSectionLoadList().ResolveLoadAddress(
604 if (so_addr.
GetModule() == runtime_module_sp)
617 std::string summary = std::string(report->GetAsDictionary()
618 ->GetValueForKey(
"description")
621 bool skip_one_frame =
622 report->GetObjectForDotSeparatedPath(
"issue_type")->GetStringValue() ==
626 if (report->GetAsDictionary()
627 ->GetValueForKey(
"mops")
631 ->GetValueForKey(
"mops")
635 ->GetValueForKey(
"trace"),
638 if (report->GetAsDictionary()
639 ->GetValueForKey(
"stacks")
643 ->GetValueForKey(
"stacks")
647 ->GetValueForKey(
"trace"),
654 if (report->GetAsDictionary()
655 ->GetValueForKey(
"locs")
659 ->GetValueForKey(
"locs")
662 std::string object_type = std::string(loc->GetAsDictionary()
663 ->GetValueForKey(
"object_type")
666 if (!object_type.empty()) {
667 summary =
"Race on " + object_type +
" object";
669 addr_t addr = loc->GetAsDictionary()
670 ->GetValueForKey(
"address")
671 ->GetUnsignedIntegerValue();
673 addr = loc->GetAsDictionary()
674 ->GetValueForKey(
"start")
675 ->GetUnsignedIntegerValue();
679 if (!global_name.empty()) {
680 summary = summary +
" at " + global_name;
682 summary = summary +
" at " +
Sprintf(
"0x%llx", addr);
685 int fd = loc->GetAsDictionary()
686 ->GetValueForKey(
"file_descriptor")
687 ->GetSignedIntegerValue();
689 summary = summary +
" on file descriptor " +
Sprintf(
"%d", fd);
701 report->GetObjectForDotSeparatedPath(
"mops")->GetAsArray()->ForEach(
704 ->GetUnsignedIntegerValue();
710 return (result == (
addr_t)-1) ? 0 : result;
715 std::string &global_name, std::string &filename, uint32_t &line) {
720 if (report->GetAsDictionary()
721 ->GetValueForKey(
"locs")
725 ->GetValueForKey(
"locs")
728 std::string type = std::string(
729 loc->GetAsDictionary()->GetValueForKey(
"type")->GetStringValue());
730 if (type ==
"global") {
731 global_addr = loc->GetAsDictionary()
732 ->GetValueForKey(
"address")
733 ->GetUnsignedIntegerValue();
736 if (!global_name.empty()) {
737 result =
Sprintf(
"'%s' is a global variable (0x%llx)",
738 global_name.c_str(), global_addr);
740 result =
Sprintf(
"0x%llx is a global variable", global_addr);
749 }
else if (type ==
"heap") {
750 addr_t addr = loc->GetAsDictionary()
751 ->GetValueForKey(
"start")
752 ->GetUnsignedIntegerValue();
754 size_t size = loc->GetAsDictionary()
755 ->GetValueForKey(
"size")
756 ->GetUnsignedIntegerValue();
758 std::string object_type = std::string(loc->GetAsDictionary()
759 ->GetValueForKey(
"object_type")
762 if (!object_type.empty()) {
763 result =
Sprintf(
"Location is a %ld-byte %s object at 0x%llx", size,
764 object_type.c_str(), addr);
767 Sprintf(
"Location is a %ld-byte heap object at 0x%llx", size, addr);
769 }
else if (type ==
"stack") {
770 tid_t tid = loc->GetAsDictionary()
771 ->GetValueForKey(
"thread_id")
772 ->GetUnsignedIntegerValue();
774 result =
Sprintf(
"Location is stack of thread %d", tid);
775 }
else if (type ==
"tls") {
776 tid_t tid = loc->GetAsDictionary()
777 ->GetValueForKey(
"thread_id")
778 ->GetUnsignedIntegerValue();
780 result =
Sprintf(
"Location is TLS of thread %d", tid);
781 }
else if (type ==
"fd") {
782 int fd = loc->GetAsDictionary()
783 ->GetValueForKey(
"file_descriptor")
784 ->GetSignedIntegerValue();
786 result =
Sprintf(
"Location is file descriptor %d", fd);
796 assert(baton &&
"null baton");
805 if (process_sp->GetModIDRef().IsLastResumeForUserExpression())
810 std::string stop_reason_description =
811 "unknown thread sanitizer fault (unable to extract thread sanitizer "
815 report->GetAsDictionary()->AddStringItem(
"description", issue_description);
816 stop_reason_description = issue_description +
" detected";
817 report->GetAsDictionary()->AddStringItem(
"stop_description",
818 stop_reason_description);
820 report->GetAsDictionary()->AddStringItem(
"summary", summary);
822 report->GetAsDictionary()->AddIntegerItem(
"memory_address", main_address);
825 std::string global_name;
826 std::string location_filename;
827 uint32_t location_line = 0;
829 report, global_addr, global_name, location_filename, location_line);
830 report->GetAsDictionary()->AddStringItem(
"location_description",
831 location_description);
832 if (global_addr != 0) {
833 report->GetAsDictionary()->AddIntegerItem(
"global_address", global_addr);
835 if (!global_name.empty()) {
836 report->GetAsDictionary()->AddStringItem(
"global_name", global_name);
838 if (location_filename !=
"") {
839 report->GetAsDictionary()->AddStringItem(
"location_filename",
841 report->GetAsDictionary()->AddIntegerItem(
"location_line", location_line);
844 bool all_addresses_are_same =
true;
845 report->GetObjectForDotSeparatedPath(
"mops")->GetAsArray()->ForEach(
846 [&all_addresses_are_same,
849 ->GetUnsignedIntegerValue();
850 if (main_address != addr)
851 all_addresses_are_same =
false;
854 report->GetAsDictionary()->AddBooleanItem(
"all_addresses_are_same",
855 all_addresses_are_same);
862 thread_sp->SetStopInfo(
864 CreateStopReasonWithInstrumentationData(
865 *thread_sp, stop_reason_description, report));
867 StreamFile &s = process_sp->GetTarget().GetDebugger().GetOutputStream();
868 s.
Printf(
"ThreadSanitizer report breakpoint hit. Use 'thread "
869 "info -s' to get extended information about the "
885 static ConstString g_tsan_get_current_report(
"__tsan_get_current_report");
886 const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(
888 return symbol !=
nullptr;
903 if (symbol ==
nullptr)
909 Target &target = process_sp->GetTarget();
915 const bool internal =
true;
916 const bool hardware =
false;
917 const bool sync =
false;
943 std::string result =
"additional information";
945 if (path ==
"mops") {
957 std::string addr_string =
Sprintf(
" at 0x%llx", addr);
959 if (main_info->GetObjectForDotSeparatedPath(
"all_addresses_are_same")
960 ->GetBooleanValue()) {
964 if (main_info->GetObjectForDotSeparatedPath(
"issue_type")
965 ->GetStringValue() ==
"external-race") {
966 result =
Sprintf(
"%s access by thread %d",
967 is_write ?
"mutating" :
"read-only", thread_id);
968 }
else if (main_info->GetObjectForDotSeparatedPath(
"issue_type")
969 ->GetStringValue() ==
"swift-access-race") {
970 result =
Sprintf(
"modifying access by thread %d", thread_id);
972 result =
Sprintf(
"%s%s of size %zu%s by thread %" PRIu64,
973 is_atomic ?
"atomic " :
"", is_write ?
"write" :
"read",
974 size, addr_string.c_str(), thread_id);
978 if (path ==
"threads") {
981 result =
Sprintf(
"Thread %zu created", thread_id);
984 if (path ==
"locs") {
985 std::string type = std::string(
990 ->GetSignedIntegerValue();
991 if (type ==
"heap") {
992 result =
Sprintf(
"Heap block allocated by thread %" PRIu64, thread_id);
993 }
else if (type ==
"fd") {
994 result =
Sprintf(
"File descriptor %d created by thread %" PRIu64, fd,
999 if (path ==
"mutexes") {
1003 result =
Sprintf(
"Mutex M%d created", mutex_id);
1006 if (path ==
"stacks") {
1009 result =
Sprintf(
"Thread %" PRIu64, thread_id);
1012 result[0] = toupper(result[0]);
1020 info->GetObjectForDotSeparatedPath(path)->GetAsArray()->ForEach(
1022 std::vector<lldb::addr_t> pcs;
1025 pcs.push_back(
pc->GetUnsignedIntegerValue());
1029 if (pcs.size() == 0)
1035 thread_id_obj ? thread_id_obj->GetUnsignedIntegerValue() : 0;
1038 std::make_shared<HistoryThread>(*process_sp, tid, pcs);
1043 process_sp->GetExtendedThreadList().AddThread(new_thread_sp);
1044 threads->AddThread(new_thread_sp);
1056 if (info->GetObjectForDotSeparatedPath(
"instrumentation_class")
1057 ->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 SetLanguage(lldb::LanguageType language)
void SetUnwindOnError(bool unwind=false)
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)
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
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)
bool GetItemAtIndexAsInteger(size_t idx, IntType &result) 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, Status &error, 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