25int __asan_report_present();
26void *__asan_get_report_pc();
27void *__asan_get_report_bp();
28void *__asan_get_report_sp();
29void *__asan_get_report_address();
30const char *__asan_get_report_description();
31int __asan_get_report_access_type();
32size_t __asan_get_report_access_size();
45 const char *description;
48t.present = __asan_report_present();
49t.access_type = __asan_get_report_access_type();
50t.pc = __asan_get_report_pc();
51t.bp = __asan_get_report_bp();
52t.sp = __asan_get_report_sp();
53t.address = __asan_get_report_address();
54t.access_size = __asan_get_report_access_size();
55t.description = __asan_get_report_description();
65 process_sp->GetThreadList().GetExpressionExecutionThread();
81 options.
SetTimeout(process_sp->GetUtilityExpressionTimeout());
94 frame_sp->CalculateExecutionContext(exe_ctx);
100 ss <<
"cannot evaluate AddressSanitizer expression:\n";
102 ss << return_value_sp->GetError().AsCString();
104 process_sp->GetTarget().GetDebugger().GetID());
108 int present = return_value_sp->GetValueForExpressionPath(
".present")
109 ->GetValueAsUnsigned(0);
114 return_value_sp->GetValueForExpressionPath(
".pc")->GetValueAsUnsigned(0);
116 return_value_sp->GetValueForExpressionPath(
".bp")->GetValueAsUnsigned(0);
118 return_value_sp->GetValueForExpressionPath(
".sp")->GetValueAsUnsigned(0);
119 addr_t address = return_value_sp->GetValueForExpressionPath(
".address")
120 ->GetValueAsUnsigned(0);
122 return_value_sp->GetValueForExpressionPath(
".access_type")
123 ->GetValueAsUnsigned(0);
125 return_value_sp->GetValueForExpressionPath(
".access_size")
126 ->GetValueAsUnsigned(0);
128 return_value_sp->GetValueForExpressionPath(
".description")
129 ->GetValueAsUnsigned(0);
130 std::string description;
132 process_sp->ReadCStringFromMemory(description_ptr, description,
error);
134 auto dict = std::make_shared<StructuredData::Dictionary>();
138 dict->AddStringItem(
"instrumentation_class",
"AddressSanitizer");
139 dict->AddStringItem(
"stop_type",
"fatal_error");
140 dict->AddIntegerItem(
"pc",
pc);
141 dict->AddIntegerItem(
"bp", bp);
142 dict->AddIntegerItem(
"sp",
sp);
143 dict->AddIntegerItem(
"address", address);
144 dict->AddIntegerItem(
"access_type", access_type);
145 dict->AddIntegerItem(
"access_size", access_size);
146 dict->AddStringItem(
"description", description);
153 std::string description = std::string(report->GetAsDictionary()
154 ->GetValueForKey(
"description")
157 return llvm::StringSwitch<std::string>(description)
158 .Case(
"heap-use-after-free",
"Use of deallocated memory")
159 .Case(
"heap-buffer-overflow",
"Heap buffer overflow")
160 .Case(
"stack-buffer-underflow",
"Stack buffer underflow")
161 .Case(
"initialization-order-fiasco",
"Initialization order problem")
162 .Case(
"stack-buffer-overflow",
"Stack buffer overflow")
163 .Case(
"stack-use-after-return",
"Use of stack memory after return")
164 .Case(
"use-after-poison",
"Use of poisoned memory")
165 .Case(
"container-overflow",
"Container overflow")
166 .Case(
"stack-use-after-scope",
"Use of out-of-scope stack memory")
167 .Case(
"global-buffer-overflow",
"Global buffer overflow")
168 .Case(
"unknown-crash",
"Invalid memory access")
169 .Case(
"stack-overflow",
"Stack space exhausted")
170 .Case(
"null-deref",
"Dereference of null pointer")
171 .Case(
"wild-jump",
"Jump to non-executable address")
172 .Case(
"wild-addr-write",
"Write through wild pointer")
173 .Case(
"wild-addr-read",
"Read from wild pointer")
174 .Case(
"wild-addr",
"Access through wild pointer")
175 .Case(
"signal",
"Deadly signal")
176 .Case(
"double-free",
"Deallocation of freed memory")
177 .Case(
"new-delete-type-mismatch",
178 "Deallocation size different from allocation size")
179 .Case(
"bad-free",
"Deallocation of non-allocated memory")
180 .Case(
"alloc-dealloc-mismatch",
181 "Mismatch between allocation and deallocation APIs")
182 .Case(
"bad-malloc_usable_size",
"Invalid argument to malloc_usable_size")
183 .Case(
"bad-__sanitizer_get_allocated_size",
184 "Invalid argument to __sanitizer_get_allocated_size")
185 .Case(
"param-overlap",
186 "Call to function disallowing overlapping memory ranges")
187 .Case(
"negative-size-param",
"Negative size used when accessing memory")
188 .Case(
"bad-__sanitizer_annotate_contiguous_container",
189 "Invalid argument to __sanitizer_annotate_contiguous_container")
190 .Case(
"odr-violation",
"Symbol defined in multiple translation units")
192 "invalid-pointer-pair",
193 "Comparison or arithmetic on pointers from different memory regions")
195 .Default(
"AddressSanitizer detected: " + description);
206 if (process_sp->GetModIDRef().IsLastResumeForUserExpression())
216 thread_sp->SetStopInfo(
218 *thread_sp, description, report));
221 process_sp->GetTarget().GetDebugger().GetAsyncOutputStream())
222 stream_sp->Printf(
"AddressSanitizer report breakpoint hit. Use 'thread "
223 "info -s' to get extended information about the "
232 if (!module_sp || !process_sp)
236 module_sp->FindFirstSymbolWithNameAndType(symbol_name,
eSymbolTypeCode);
238 if (symbol ==
nullptr)
245 const bool internal =
true;
246 const bool hardware =
false;
static llvm::raw_ostream & error(Stream &strm)
const char * address_sanitizer_retrieve_report_data_command
const char * address_sanitizer_retrieve_report_data_prefix
A section + offset based address class.
bool IsValid() const
Check if the object state is valid.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Target & GetTarget()
Accessor for the breakpoint Target.
A uniqued constant string class.
static void ReportWarning(std::string message, std::optional< lldb::user_id_t > debugger_id=std::nullopt, std::once_flag *once=nullptr)
Report warning events.
void SetPreferredSymbolContexts(SymbolContextList contexts)
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)
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.
static lldb::StopInfoSP CreateStopReasonWithInstrumentationData(Thread &thread, std::string description, StructuredData::ObjectSP additional_data)
static StructuredData::ObjectSP RetrieveReportData(const lldb::ProcessSP process_sp)
static bool NotifyBreakpointHit(lldb::ProcessSP process_sp, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
static std::string FormatDescription(StructuredData::ObjectSP report)
static Breakpoint * SetupBreakpoint(lldb::ModuleSP, lldb::ProcessSP, ConstString)
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
ExecutionContextRef exe_ctx_ref
llvm::StringRef GetString() const
std::shared_ptr< Object > ObjectSP
Defines a list of symbol context objects.
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
Defines a symbol context baton that can be handed other debug core functions.
bool ValueIsAddress() const
Address & GetAddressRef()
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...
@ DoNoSelectMostRelevantFrame
A class that represents a running process on the host machine.
std::tuple< lldb::ModuleSP, HistoryPCType > GetPreferredAsanModule(const Target &target)
On Darwin, if LLDB loaded libclang_rt, it's coming from a locally built compiler-rt,...
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++.
std::shared_ptr< lldb_private::Stream > StreamSP
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Process > ProcessSP
@ eStructuredDataTypeDictionary
std::shared_ptr< lldb_private::Module > ModuleSP