LLDB mainline
AppleObjCRuntime.cpp
Go to the documentation of this file.
1//===-- AppleObjCRuntime.cpp ----------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "AppleObjCRuntime.h"
10#include "AppleObjCRuntimeV2.h"
16#include "lldb/Core/Module.h"
19#include "lldb/Core/Section.h"
25#include "lldb/Target/Process.h"
28#include "lldb/Target/Target.h"
29#include "lldb/Target/Thread.h"
33#include "lldb/Utility/Log.h"
34#include "lldb/Utility/Scalar.h"
35#include "lldb/Utility/Status.h"
39#include "clang/AST/Type.h"
40
42
43#include <vector>
44
45using namespace lldb;
46using namespace lldb_private;
47
49
51
53
59
61
63
65 ValueObject &valobj) {
66 CompilerType compiler_type(valobj.GetCompilerType());
67 bool is_signed;
68 // ObjC objects can only be pointers (or numbers that actually represents
69 // pointers but haven't been typecast, because reasons..)
70 if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType())
71 return llvm::createStringError("not a pointer type");
72
73 // Make the argument list: we pass one arg, the address of our pointer, to
74 // the print function.
75 Value val;
76
77 if (!valobj.ResolveValue(val.GetScalar()))
78 return llvm::createStringError("pointer value could not be resolved");
79
80 // Value Objects may not have a process in their ExecutionContextRef. But we
81 // need to have one in the ref we pass down to eventually call description.
82 // Get it from the target if it isn't present.
83 ExecutionContext exe_ctx;
84 if (valobj.GetProcessSP()) {
85 exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
86 } else {
87 exe_ctx.SetContext(valobj.GetTargetSP(), true);
88 if (!exe_ctx.HasProcessScope())
89 return llvm::createStringError("no process");
90 }
91 return GetObjectDescription(str, val, exe_ctx.GetBestExecutionContextScope());
92}
93
94llvm::Error
96 ExecutionContextScope *exe_scope) {
98 return llvm::createStringError("Objective-C runtime not loaded");
99
100 ExecutionContext exe_ctx;
101 exe_scope->CalculateExecutionContext(exe_ctx);
102 Process *process = exe_ctx.GetProcessPtr();
103 if (!process)
104 return llvm::createStringError("no process");
105
106 // We need other parts of the exe_ctx, but the processes have to match.
107 assert(m_process == process);
108
109 // Get the function address for the print function.
110 const Address *function_address = GetPrintForDebuggerAddr();
111 if (!function_address)
112 return llvm::createStringError("no print function");
113
114 Target *target = exe_ctx.GetTargetPtr();
115 CompilerType compiler_type = value.GetCompilerType();
116 if (compiler_type) {
118 return llvm::createStringError(
119 "Value doesn't point to an ObjC object.\n");
120 } else {
121 // If it is not a pointer, see if we can make it into a pointer.
122 TypeSystemClangSP scratch_ts_sp =
124 if (!scratch_ts_sp)
125 return llvm::createStringError("no scratch type system");
126
127 CompilerType opaque_type = scratch_ts_sp->GetBasicType(eBasicTypeObjCID);
128 if (!opaque_type)
129 opaque_type =
130 scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
131 // value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
132 value.SetCompilerType(opaque_type);
133 }
134
135 ValueList arg_value_list;
136 arg_value_list.PushValue(value);
137
138 // This is the return value:
139 TypeSystemClangSP scratch_ts_sp =
141 if (!scratch_ts_sp)
142 return llvm::createStringError("no scratch type system");
143
144 CompilerType return_compiler_type = scratch_ts_sp->GetCStringType(true);
145 Value ret;
146 // ret.SetContext(Value::eContextTypeClangType, return_compiler_type);
147 ret.SetCompilerType(return_compiler_type);
148
149 if (!exe_ctx.GetFramePtr()) {
150 Thread *thread = exe_ctx.GetThreadPtr();
151 if (thread == nullptr) {
152 exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread());
153 thread = exe_ctx.GetThreadPtr();
154 }
155 if (thread) {
156 exe_ctx.SetFrameSP(thread->GetSelectedFrame(DoNoSelectMostRelevantFrame));
157 }
158 }
159
160 // Now we're ready to call the function:
161
162 DiagnosticManager diagnostics;
163 lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
164
168 exe_scope->CalculateTarget()->GetFunctionCallerForLanguage(
169 eLanguageTypeObjC, return_compiler_type, *function_address,
170 arg_value_list, "objc-object-description", error));
171 if (error.Fail()) {
173 return llvm::createStringError(
174 llvm::Twine(
175 "could not get function runner to call print for debugger "
176 "function: ") +
177 error.AsCString());
178 }
179 m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr,
180 diagnostics);
181 } else {
182 m_print_object_caller_up->WriteFunctionArguments(
183 exe_ctx, wrapper_struct_addr, arg_value_list, diagnostics);
184 }
185
187 options.SetUnwindOnError(true);
188 options.SetTryAllThreads(true);
189 options.SetStopOthers(true);
190 options.SetIgnoreBreakpoints(true);
191 options.SetTimeout(process->GetUtilityExpressionTimeout());
192 options.SetIsForUtilityExpr(true);
193
194 ExpressionResults results = m_print_object_caller_up->ExecuteFunction(
195 exe_ctx, &wrapper_struct_addr, options, diagnostics, ret);
196 if (results != eExpressionCompleted)
197 return llvm::createStringError(
198 "could not evaluate print object function: " + toString(results));
199
201
202 char buf[512];
203 size_t cstr_len = 0;
204 size_t full_buffer_len = sizeof(buf) - 1;
205 size_t curr_len = full_buffer_len;
206 while (curr_len == full_buffer_len) {
208 curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf,
209 sizeof(buf), error);
210 strm.Write(buf, curr_len);
211 cstr_len += curr_len;
212 }
213 if (cstr_len > 0)
214 return llvm::Error::success();
215 return llvm::createStringError("empty object description");
216}
217
219 ModuleSP module_sp(m_objc_module_wp.lock());
220 if (module_sp)
221 return module_sp;
222
223 Process *process = GetProcess();
224 if (process) {
225 const ModuleList &modules = process->GetTarget().GetImages();
226 for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
227 module_sp = modules.GetModuleAtIndex(idx);
229 m_objc_module_wp = module_sp;
230 return module_sp;
231 }
232 }
233 }
234 return ModuleSP();
235}
236
239 const ModuleList &modules = m_process->GetTarget().GetImages();
240
241 SymbolContextList contexts;
242 SymbolContext context;
243
244 modules.FindSymbolsWithNameAndType(ConstString("_NSPrintForDebugger"),
245 eSymbolTypeCode, contexts);
246 if (contexts.IsEmpty()) {
247 modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"),
248 eSymbolTypeCode, contexts);
249 if (contexts.IsEmpty())
250 return nullptr;
251 }
252
253 contexts.GetContextAtIndex(0, context);
254
256 std::make_unique<Address>(context.symbol->GetAddress());
257 }
258
259 return m_PrintForDebugger_addr.get();
260}
261
263 return in_value.GetCompilerType().IsPossibleDynamicType(
264 nullptr,
265 false, // do not check C++
266 true); // check ObjC
267}
268
270 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
271 TypeAndOrName &class_type_or_name, Address &address,
272 Value::ValueType &value_type, llvm::ArrayRef<uint8_t> &local_buffer) {
273 return false;
274}
275
278 ValueObject &static_value) {
279 CompilerType static_type(static_value.GetCompilerType());
280 Flags static_type_flags(static_type.GetTypeInfo());
281
282 TypeAndOrName ret(type_and_or_name);
283 if (type_and_or_name.HasType()) {
284 // The type will always be the type of the dynamic object. If our parent's
285 // type was a pointer, then our type should be a pointer to the type of the
286 // dynamic object. If a reference, then the original type should be
287 // okay...
288 CompilerType orig_type = type_and_or_name.GetCompilerType();
289 CompilerType corrected_type = orig_type;
290 if (static_type_flags.AllSet(eTypeIsPointer))
291 corrected_type = orig_type.GetPointerType();
292 ret.SetCompilerType(corrected_type);
293 } else {
294 // If we are here we need to adjust our dynamic type name to include the
295 // correct & or * symbol
296 std::string corrected_name(type_and_or_name.GetName().GetCString());
297 if (static_type_flags.AllSet(eTypeIsPointer))
298 corrected_name.append(" *");
299 // the parent type should be a correctly pointer'ed or referenc'ed type
300 ret.SetCompilerType(static_type);
301 ret.SetName(corrected_name.c_str());
302 }
303 return ret;
304}
305
307 if (module_sp) {
308 const FileSpec &module_file_spec = module_sp->GetFileSpec();
309 static ConstString ObjCName("libobjc.A.dylib");
310
311 if (module_file_spec) {
312 if (module_file_spec.GetFilename() == ObjCName)
313 return true;
314 }
315 }
316 return false;
317}
318
319// we use the version of Foundation to make assumptions about the ObjC runtime
320// on a target
322 if (!m_Foundation_major) {
323 const ModuleList &modules = m_process->GetTarget().GetImages();
324 for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
325 lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
326 if (!module_sp)
327 continue;
328 if (module_sp->GetFileSpec().GetFilename() == "Foundation") {
329 m_Foundation_major = module_sp->GetVersion().getMajor();
330 return *m_Foundation_major;
331 }
332 }
334 } else
335 return *m_Foundation_major;
336}
337
339 lldb::addr_t &cf_false) {
340 cf_true = cf_false = LLDB_INVALID_ADDRESS;
341}
342
344 return AppleIsModuleObjCLibrary(module_sp);
345}
346
348 // Maybe check here and if we have a handler already, and the UUID of this
349 // module is the same as the one in the current module, then we don't have to
350 // reread it?
351 m_objc_trampoline_handler_up = std::make_unique<AppleObjCTrampolineHandler>(
352 m_process->shared_from_this(), module_sp);
353 if (m_objc_trampoline_handler_up != nullptr) {
354 m_read_objc_library = true;
355 return true;
356 } else
357 return false;
358}
359
361 bool stop_others) {
362 ThreadPlanSP thread_plan_sp;
364 thread_plan_sp = m_objc_trampoline_handler_up->GetStepThroughDispatchPlan(
365 thread, stop_others);
366 return thread_plan_sp;
367}
368
369// Static Functions
372 if (!process)
374
375 Target &target = process->GetTarget();
376 if (target.GetArchitecture().GetTriple().getVendor() !=
377 llvm::Triple::VendorType::Apple)
379
380 for (ModuleSP module_sp : target.GetImages().Modules()) {
381 // One tricky bit here is that we might get called as part of the initial
382 // module loading, but before all the pre-run libraries get winnowed from
383 // the module list. So there might actually be an old and incorrect ObjC
384 // library sitting around in the list, and we don't want to look at that.
385 // That's why we call IsLoadedInTarget.
386
387 if (AppleIsModuleObjCLibrary(module_sp) &&
388 module_sp->IsLoadedInTarget(&target)) {
389 objc_module_sp = module_sp;
390 ObjectFile *ofile = module_sp->GetObjectFile();
391 if (!ofile)
393
394 SectionList *sections = module_sp->GetSectionList();
395 if (!sections)
397 SectionSP v1_telltale_section_sp = sections->FindSectionByName("__OBJC");
398 if (v1_telltale_section_sp) {
400 "GetObjCVersion returning eAppleObjC_V1, which is no longer "
401 "supported");
403 }
405 }
406 }
407
409}
410
412 const bool catch_bp = false;
413 const bool throw_bp = true;
414 const bool is_internal = true;
415
418 m_process->GetTarget(), GetLanguageType(), catch_bp, throw_bp,
419 is_internal);
421 m_objc_exception_bp_sp->SetBreakpointKind("ObjC exception");
422 } else
423 m_objc_exception_bp_sp->SetEnabled(true);
424}
425
427 if (!m_process)
428 return;
429
430 if (m_objc_exception_bp_sp.get()) {
431 m_objc_exception_bp_sp->SetEnabled(false);
432 }
433}
434
438
440 lldb::StopInfoSP stop_reason) {
441 if (!m_process)
442 return false;
443
444 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
445 return false;
446
447 uint64_t break_site_id = stop_reason->GetValue();
448 return m_process->GetBreakpointSiteList().StopPointSiteContainsBreakpoint(
449 break_site_id, m_objc_exception_bp_sp->GetID());
450}
451
453 if (!m_process)
454 return false;
455
456 static ConstString s_method_signature(
457 "-[NSDictionary objectForKeyedSubscript:]");
458 // NSDictionary is toll-free bridged with CFDictionary, so the
459 // implementation lives in CoreFoundation, not Foundation.
460 static ModuleSpec corefoundation_module_spec(FileSpec("CoreFoundation"));
461
462 Target &target = m_process->GetTarget();
463 if (ModuleSP corefoundation_module_sp =
464 target.GetImages().FindFirstModule(corefoundation_module_spec)) {
465 if (corefoundation_module_sp->FindFirstSymbolWithNameAndType(
466 s_method_signature, eSymbolTypeCode))
467 return true;
468 }
469
470 return false;
471}
472
474 Target &target = m_process->GetTarget();
475
476 FileSpecList filter_modules;
477 if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
478 filter_modules.Append(std::get<0>(GetExceptionThrowLocation()));
479 }
480 return target.GetSearchFilterForModuleList(&filter_modules);
481}
482
484 ThreadSP thread_sp) {
485 auto *cpp_runtime = m_process->GetLanguageRuntime(eLanguageTypeC_plus_plus);
486 if (!cpp_runtime) return ValueObjectSP();
487 auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp);
488 if (!cpp_exception) return ValueObjectSP();
489
490 auto descriptor = GetClassDescriptor(*cpp_exception);
491 if (!descriptor || !descriptor->IsValid()) return ValueObjectSP();
492
493 while (descriptor) {
494 ConstString class_name(descriptor->GetClassName());
495 if (class_name == "NSException")
496 return cpp_exception;
497 descriptor = descriptor->GetSuperclass();
498 }
499
500 return ValueObjectSP();
501}
502
503/// Utility method for error handling in GetBacktraceThreadFromException.
504/// \param msg The message to add to the log.
505/// \return An invalid ThreadSP to be returned from
506/// GetBacktraceThreadFromException.
507[[nodiscard]]
508static ThreadSP FailExceptionParsing(llvm::StringRef msg) {
510 LLDB_LOG(log, "Failed getting backtrace from exception: {0}", msg);
511 return ThreadSP();
512}
513
515 lldb::ValueObjectSP exception_sp) {
516 ValueObjectSP reserved_dict =
517 exception_sp->GetChildMemberWithName("reserved");
518 if (!reserved_dict)
519 return FailExceptionParsing("Failed to get 'reserved' member.");
520
521 reserved_dict = reserved_dict->GetSyntheticValue();
522 if (!reserved_dict)
523 return FailExceptionParsing("Failed to get synthetic value.");
524
525 TypeSystemClangSP scratch_ts_sp =
526 ScratchTypeSystemClang::GetForTarget(*exception_sp->GetTargetSP());
527 if (!scratch_ts_sp)
528 return FailExceptionParsing("Failed to get scratch AST.");
529 CompilerType objc_id = scratch_ts_sp->GetBasicType(lldb::eBasicTypeObjCID);
530 ValueObjectSP return_addresses;
531
532 auto objc_object_from_address = [&exception_sp, &objc_id](uint64_t addr,
533 const char *name) {
534 Value value(addr);
535 value.SetCompilerType(objc_id);
536 auto object = ValueObjectConstResult::Create(
537 exception_sp->GetTargetSP().get(), value, ConstString(name));
538 object = object->GetDynamicValue(eDynamicDontRunTarget);
539 return object;
540 };
541
542 for (size_t idx = 0; idx < reserved_dict->GetNumChildrenIgnoringErrors();
543 idx++) {
544 ValueObjectSP dict_entry = reserved_dict->GetChildAtIndex(idx);
545
546 DataExtractor data;
547 data.SetAddressByteSize(dict_entry->GetProcessSP()->GetAddressByteSize());
549 dict_entry->GetData(data, error);
550 if (error.Fail()) return ThreadSP();
551
552 lldb::offset_t data_offset = 0;
553 auto dict_entry_key = data.GetAddress(&data_offset);
554 auto dict_entry_value = data.GetAddress(&data_offset);
555
556 auto key_nsstring = objc_object_from_address(dict_entry_key, "key");
557 StreamString key_summary;
559 *key_nsstring, key_summary, TypeSummaryOptions()) &&
560 !key_summary.Empty()) {
561 if (key_summary.GetString() == "\"callStackReturnAddresses\"") {
562 return_addresses = objc_object_from_address(dict_entry_value,
563 "callStackReturnAddresses");
564 break;
565 }
566 }
567 }
568
569 if (!return_addresses)
570 return FailExceptionParsing("Failed to get return addresses.");
571 auto frames_value = return_addresses->GetChildMemberWithName("_frames");
572 if (!frames_value)
573 return FailExceptionParsing("Failed to get frames_value.");
574 addr_t frames_addr = frames_value->GetValueAsUnsigned(0);
575 auto count_value = return_addresses->GetChildMemberWithName("_cnt");
576 if (!count_value)
577 return FailExceptionParsing("Failed to get count_value.");
578 size_t count = count_value->GetValueAsUnsigned(0);
579 auto ignore_value = return_addresses->GetChildMemberWithName("_ignore");
580 if (!ignore_value)
581 return FailExceptionParsing("Failed to get ignore_value.");
582 size_t ignore = ignore_value->GetValueAsUnsigned(0);
583
584 size_t ptr_size = m_process->GetAddressByteSize();
585 std::vector<lldb::addr_t> pcs;
586 for (size_t idx = 0; idx < count; idx++) {
588 addr_t pc = m_process->ReadPointerFromMemory(
589 frames_addr + (ignore + idx) * ptr_size, error);
590 pcs.push_back(pc);
591 }
592
593 if (pcs.empty())
594 return FailExceptionParsing("Failed to get PC list.");
595
596 ThreadSP new_thread_sp(new HistoryThread(*m_process, 0, pcs));
597 m_process->GetExtendedThreadList().AddThread(new_thread_sp);
598 return new_thread_sp;
599}
600
601std::tuple<FileSpec, ConstString>
603 return std::make_tuple(
604 FileSpec("libobjc.A.dylib"), ConstString("objc_exception_throw"));
605}
606
608 if (!HasReadObjCLibrary()) {
609 std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
610
611 size_t num_modules = module_list.GetSize();
612 for (size_t i = 0; i < num_modules; i++) {
613 auto mod = module_list.GetModuleAtIndex(i);
614 if (IsModuleObjCLibrary(mod)) {
615 ReadObjCLibrary(mod);
616 break;
617 }
618 }
619 }
620}
621
623 ReadObjCLibraryIfNeeded(module_list);
624}
static ThreadSP FailExceptionParsing(llvm::StringRef msg)
Utility method for error handling in GetBacktraceThreadFromException.
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:375
#define LLDB_PLUGIN_DEFINE(PluginName)
A section + offset based address class.
Definition Address.h:62
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false)
lldb::ThreadSP GetBacktraceThreadFromException(lldb::ValueObjectSP thread_sp) override
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer) override
This call should return true if it could set the name and/or the type Sets address to the address of ...
bool CalculateHasNewLiteralsAndIndexing() override
static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp)
bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
std::optional< uint32_t > m_Foundation_major
std::unique_ptr< Address > m_PrintForDebugger_addr
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation()
lldb::BreakpointSP m_objc_exception_bp_sp
void ReadObjCLibraryIfNeeded(const ModuleList &module_list)
lldb::SearchFilterSP CreateExceptionSearchFilter() override
static ObjCRuntimeVersions GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp)
llvm::Error GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) override
bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
std::unique_ptr< lldb_private::AppleObjCTrampolineHandler > m_objc_trampoline_handler_up
void ModulesDidLoad(const ModuleList &module_list) override
Called when modules have been loaded in the process.
bool CouldHaveDynamicValue(ValueObject &in_value) override
std::unique_ptr< FunctionCaller > m_print_object_caller_up
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition ArchSpec.h:544
Generic representation of a type in a programming language.
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
bool IsIntegerType(bool &is_signed) const
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
bool IsPointerType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
Definition ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
An data extractor class.
uint64_t GetAddress(lldb::offset_t *offset_ptr) const
Extract an address from *offset_ptr.
void SetAddressByteSize(uint32_t addr_size)
Set the address byte size.
void SetUnwindOnError(bool unwind=false)
Definition Target.h:400
void SetTryAllThreads(bool try_others=true)
Definition Target.h:433
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:421
void SetStopOthers(bool stop_others=true)
Definition Target.h:437
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:404
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
virtual lldb::TargetSP CalculateTarget()=0
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
bool HasProcessScope() const
Returns true the ExecutionContext object contains a valid target and process.
ExecutionContextScope * GetBestExecutionContextScope() const
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
Target * GetTargetPtr() const
Returns a pointer to the target object.
void SetThreadSP(const lldb::ThreadSP &thread_sp)
Set accessor to set only the thread shared pointer.
Process * GetProcessPtr() const
Returns a pointer to the process object.
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
A file collection class.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
A file utility class.
Definition FileSpec.h:57
llvm::StringRef GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:249
A class to manage flags.
Definition Flags.h:22
bool AllSet(ValueType mask) const
Test if all bits in mask are 1 in the current flags.
Definition Flags.h:83
A thread object representing a backtrace from a previous point in the process execution.
static lldb::BreakpointSP CreateExceptionBreakpoint(Target &target, lldb::LanguageType language, bool catch_bp, bool throw_bp, bool is_internal=false)
A collection class for Module objects.
Definition ModuleList.h:125
std::recursive_mutex & GetMutex() const
Definition ModuleList.h:252
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const
Finds the first module whose file specification matches module_spec.
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
ModuleIterable Modules() const
Definition ModuleList.h:570
size_t GetSize() const
Gets the size of the module list.
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
lldb::LanguageType GetLanguageType() const override
A plug-in interface definition class for object file parsers.
Definition ObjectFile.h:46
std::chrono::seconds GetUtilityExpressionTimeout() const
Definition Process.cpp:346
A plug-in interface definition class for debugging a process.
Definition Process.h:359
ThreadList & GetThreadList()
Definition Process.h:2394
size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, size_t cstr_max_len, Status &error)
Read a NULL terminated C string from memory.
Definition Process.cpp:2337
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1258
Process * m_process
Definition Runtime.h:29
Process * GetProcess()
Definition Runtime.h:22
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition Scalar.cpp:365
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
lldb::SectionSP FindSectionByName(llvm::StringRef section_name) const
Definition Section.cpp:562
An error handling class.
Definition Status.h:118
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition Stream.h:111
Defines a list of symbol context objects.
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Defines a symbol context baton that can be handed other debug core functions.
Symbol * symbol
The Symbol for a given query.
Address GetAddress() const
Definition Symbol.h:89
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:705
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1247
const ArchSpec & GetArchitecture() const
Definition Target.h:1289
lldb::ThreadSP GetSelectedThread()
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition Type.h:780
void SetName(ConstString type_name)
Definition Type.cpp:911
CompilerType GetCompilerType() const
Definition Type.h:794
ConstString GetName() const
Definition Type.cpp:903
void SetCompilerType(CompilerType compiler_type)
Definition Type.cpp:931
bool HasType() const
Definition Type.h:812
static bool IsObjCObjectPointerType(const CompilerType &type, CompilerType *target_type=nullptr)
void PushValue(const Value &value)
Definition Value.cpp:694
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS, ValueObjectManager *manager=nullptr)
These routines create ValueObjectConstResult ValueObjects from various data sources.
lldb::ProcessSP GetProcessSP() const
lldb::TargetSP GetTargetSP() const
CompilerType GetCompilerType()
virtual bool ResolveValue(Scalar &scalar)
const ExecutionContextRef & GetExecutionContextRef() const
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
Definition Value.h:114
ValueType
Type that describes Value::m_value.
Definition Value.h:42
void SetCompilerType(const CompilerType &compiler_type)
Definition Value.cpp:276
const CompilerType & GetCompilerType()
Definition Value.cpp:247
#define LLDB_INVALID_MODULE_VERSION
#define LLDB_INVALID_ADDRESS
@ DoNoSelectMostRelevantFrame
bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition NSString.cpp:33
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:338
std::string toString(FormatterBytecode::OpCodes op)
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
uint64_t offset_t
Definition lldb-types.h:85
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
ExpressionResults
The results of expression evaluation.
@ eExpressionCompleted
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
std::shared_ptr< lldb_private::Section > SectionSP
uint64_t addr_t
Definition lldb-types.h:80
@ eStopReasonBreakpoint
@ eDynamicDontRunTarget
std::shared_ptr< lldb_private::Module > ModuleSP