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 "AppleObjCRuntimeV1.h"
11#include "AppleObjCRuntimeV2.h"
17#include "lldb/Core/Module.h"
20#include "lldb/Core/Section.h"
26#include "lldb/Target/Process.h"
29#include "lldb/Target/Target.h"
30#include "lldb/Target/Thread.h"
34#include "lldb/Utility/Log.h"
35#include "lldb/Utility/Scalar.h"
36#include "lldb/Utility/Status.h"
40#include "clang/AST/Type.h"
41
43
44#include <vector>
45
46using namespace lldb;
47using namespace lldb_private;
48
50
52
54
60
65
70
72 ValueObject &valobj) {
73 CompilerType compiler_type(valobj.GetCompilerType());
74 bool is_signed;
75 // ObjC objects can only be pointers (or numbers that actually represents
76 // pointers but haven't been typecast, because reasons..)
77 if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType())
78 return llvm::createStringError("not a pointer type");
79
80 // Make the argument list: we pass one arg, the address of our pointer, to
81 // the print function.
82 Value val;
83
84 if (!valobj.ResolveValue(val.GetScalar()))
85 return llvm::createStringError("pointer value could not be resolved");
86
87 // Value Objects may not have a process in their ExecutionContextRef. But we
88 // need to have one in the ref we pass down to eventually call description.
89 // Get it from the target if it isn't present.
90 ExecutionContext exe_ctx;
91 if (valobj.GetProcessSP()) {
92 exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
93 } else {
94 exe_ctx.SetContext(valobj.GetTargetSP(), true);
95 if (!exe_ctx.HasProcessScope())
96 return llvm::createStringError("no process");
97 }
98 return GetObjectDescription(str, val, exe_ctx.GetBestExecutionContextScope());
99}
100
101llvm::Error
103 ExecutionContextScope *exe_scope) {
105 return llvm::createStringError("Objective-C runtime not loaded");
106
107 ExecutionContext exe_ctx;
108 exe_scope->CalculateExecutionContext(exe_ctx);
109 Process *process = exe_ctx.GetProcessPtr();
110 if (!process)
111 return llvm::createStringError("no process");
112
113 // We need other parts of the exe_ctx, but the processes have to match.
114 assert(m_process == process);
115
116 // Get the function address for the print function.
117 const Address *function_address = GetPrintForDebuggerAddr();
118 if (!function_address)
119 return llvm::createStringError("no print function");
120
121 Target *target = exe_ctx.GetTargetPtr();
122 CompilerType compiler_type = value.GetCompilerType();
123 if (compiler_type) {
125 return llvm::createStringError(
126 "Value doesn't point to an ObjC object.\n");
127 } else {
128 // If it is not a pointer, see if we can make it into a pointer.
129 TypeSystemClangSP scratch_ts_sp =
131 if (!scratch_ts_sp)
132 return llvm::createStringError("no scratch type system");
133
134 CompilerType opaque_type = scratch_ts_sp->GetBasicType(eBasicTypeObjCID);
135 if (!opaque_type)
136 opaque_type =
137 scratch_ts_sp->GetBasicType(eBasicTypeVoid).GetPointerType();
138 // value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
139 value.SetCompilerType(opaque_type);
140 }
141
142 ValueList arg_value_list;
143 arg_value_list.PushValue(value);
144
145 // This is the return value:
146 TypeSystemClangSP scratch_ts_sp =
148 if (!scratch_ts_sp)
149 return llvm::createStringError("no scratch type system");
150
151 CompilerType return_compiler_type = scratch_ts_sp->GetCStringType(true);
152 Value ret;
153 // ret.SetContext(Value::eContextTypeClangType, return_compiler_type);
154 ret.SetCompilerType(return_compiler_type);
155
156 if (!exe_ctx.GetFramePtr()) {
157 Thread *thread = exe_ctx.GetThreadPtr();
158 if (thread == nullptr) {
159 exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread());
160 thread = exe_ctx.GetThreadPtr();
161 }
162 if (thread) {
163 exe_ctx.SetFrameSP(thread->GetSelectedFrame(DoNoSelectMostRelevantFrame));
164 }
165 }
166
167 // Now we're ready to call the function:
168
169 DiagnosticManager diagnostics;
170 lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
171
175 exe_scope->CalculateTarget()->GetFunctionCallerForLanguage(
176 eLanguageTypeObjC, return_compiler_type, *function_address,
177 arg_value_list, "objc-object-description", error));
178 if (error.Fail()) {
180 return llvm::createStringError(
181 llvm::Twine(
182 "could not get function runner to call print for debugger "
183 "function: ") +
184 error.AsCString());
185 }
186 m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr,
187 diagnostics);
188 } else {
189 m_print_object_caller_up->WriteFunctionArguments(
190 exe_ctx, wrapper_struct_addr, arg_value_list, diagnostics);
191 }
192
194 options.SetUnwindOnError(true);
195 options.SetTryAllThreads(true);
196 options.SetStopOthers(true);
197 options.SetIgnoreBreakpoints(true);
198 options.SetTimeout(process->GetUtilityExpressionTimeout());
199 options.SetIsForUtilityExpr(true);
200
201 ExpressionResults results = m_print_object_caller_up->ExecuteFunction(
202 exe_ctx, &wrapper_struct_addr, options, diagnostics, ret);
203 if (results != eExpressionCompleted)
204 return llvm::createStringError(
205 "could not evaluate print object function: " + toString(results));
206
208
209 char buf[512];
210 size_t cstr_len = 0;
211 size_t full_buffer_len = sizeof(buf) - 1;
212 size_t curr_len = full_buffer_len;
213 while (curr_len == full_buffer_len) {
215 curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf,
216 sizeof(buf), error);
217 strm.Write(buf, curr_len);
218 cstr_len += curr_len;
219 }
220 if (cstr_len > 0)
221 return llvm::Error::success();
222 return llvm::createStringError("empty object description");
223}
224
226 ModuleSP module_sp(m_objc_module_wp.lock());
227 if (module_sp)
228 return module_sp;
229
230 Process *process = GetProcess();
231 if (process) {
232 const ModuleList &modules = process->GetTarget().GetImages();
233 for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
234 module_sp = modules.GetModuleAtIndex(idx);
236 m_objc_module_wp = module_sp;
237 return module_sp;
238 }
239 }
240 }
241 return ModuleSP();
242}
243
246 const ModuleList &modules = m_process->GetTarget().GetImages();
247
248 SymbolContextList contexts;
249 SymbolContext context;
250
251 modules.FindSymbolsWithNameAndType(ConstString("_NSPrintForDebugger"),
252 eSymbolTypeCode, contexts);
253 if (contexts.IsEmpty()) {
254 modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"),
255 eSymbolTypeCode, contexts);
256 if (contexts.IsEmpty())
257 return nullptr;
258 }
259
260 contexts.GetContextAtIndex(0, context);
261
263 std::make_unique<Address>(context.symbol->GetAddress());
264 }
265
266 return m_PrintForDebugger_addr.get();
267}
268
270 return in_value.GetCompilerType().IsPossibleDynamicType(
271 nullptr,
272 false, // do not check C++
273 true); // check ObjC
274}
275
277 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
278 TypeAndOrName &class_type_or_name, Address &address,
279 Value::ValueType &value_type, llvm::ArrayRef<uint8_t> &local_buffer) {
280 return false;
281}
282
285 ValueObject &static_value) {
286 CompilerType static_type(static_value.GetCompilerType());
287 Flags static_type_flags(static_type.GetTypeInfo());
288
289 TypeAndOrName ret(type_and_or_name);
290 if (type_and_or_name.HasType()) {
291 // The type will always be the type of the dynamic object. If our parent's
292 // type was a pointer, then our type should be a pointer to the type of the
293 // dynamic object. If a reference, then the original type should be
294 // okay...
295 CompilerType orig_type = type_and_or_name.GetCompilerType();
296 CompilerType corrected_type = orig_type;
297 if (static_type_flags.AllSet(eTypeIsPointer))
298 corrected_type = orig_type.GetPointerType();
299 ret.SetCompilerType(corrected_type);
300 } else {
301 // If we are here we need to adjust our dynamic type name to include the
302 // correct & or * symbol
303 std::string corrected_name(type_and_or_name.GetName().GetCString());
304 if (static_type_flags.AllSet(eTypeIsPointer))
305 corrected_name.append(" *");
306 // the parent type should be a correctly pointer'ed or referenc'ed type
307 ret.SetCompilerType(static_type);
308 ret.SetName(corrected_name.c_str());
309 }
310 return ret;
311}
312
314 if (module_sp) {
315 const FileSpec &module_file_spec = module_sp->GetFileSpec();
316 static ConstString ObjCName("libobjc.A.dylib");
317
318 if (module_file_spec) {
319 if (module_file_spec.GetFilename() == ObjCName)
320 return true;
321 }
322 }
323 return false;
324}
325
326// we use the version of Foundation to make assumptions about the ObjC runtime
327// on a target
329 if (!m_Foundation_major) {
330 const ModuleList &modules = m_process->GetTarget().GetImages();
331 for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
332 lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
333 if (!module_sp)
334 continue;
335 if (module_sp->GetFileSpec().GetFilename() == "Foundation") {
336 m_Foundation_major = module_sp->GetVersion().getMajor();
337 return *m_Foundation_major;
338 }
339 }
341 } else
342 return *m_Foundation_major;
343}
344
346 lldb::addr_t &cf_false) {
347 cf_true = cf_false = LLDB_INVALID_ADDRESS;
348}
349
351 return AppleIsModuleObjCLibrary(module_sp);
352}
353
355 // Maybe check here and if we have a handler already, and the UUID of this
356 // module is the same as the one in the current module, then we don't have to
357 // reread it?
358 m_objc_trampoline_handler_up = std::make_unique<AppleObjCTrampolineHandler>(
359 m_process->shared_from_this(), module_sp);
360 if (m_objc_trampoline_handler_up != nullptr) {
361 m_read_objc_library = true;
362 return true;
363 } else
364 return false;
365}
366
368 bool stop_others) {
369 ThreadPlanSP thread_plan_sp;
371 thread_plan_sp = m_objc_trampoline_handler_up->GetStepThroughDispatchPlan(
372 thread, stop_others);
373 return thread_plan_sp;
374}
375
376// Static Functions
379 if (!process)
381
382 Target &target = process->GetTarget();
383 if (target.GetArchitecture().GetTriple().getVendor() !=
384 llvm::Triple::VendorType::Apple)
386
387 for (ModuleSP module_sp : target.GetImages().Modules()) {
388 // One tricky bit here is that we might get called as part of the initial
389 // module loading, but before all the pre-run libraries get winnowed from
390 // the module list. So there might actually be an old and incorrect ObjC
391 // library sitting around in the list, and we don't want to look at that.
392 // That's why we call IsLoadedInTarget.
393
394 if (AppleIsModuleObjCLibrary(module_sp) &&
395 module_sp->IsLoadedInTarget(&target)) {
396 objc_module_sp = module_sp;
397 ObjectFile *ofile = module_sp->GetObjectFile();
398 if (!ofile)
400
401 SectionList *sections = module_sp->GetSectionList();
402 if (!sections)
404 SectionSP v1_telltale_section_sp = sections->FindSectionByName("__OBJC");
405 if (v1_telltale_section_sp) {
407 }
409 }
410 }
411
413}
414
416 const bool catch_bp = false;
417 const bool throw_bp = true;
418 const bool is_internal = true;
419
422 m_process->GetTarget(), GetLanguageType(), catch_bp, throw_bp,
423 is_internal);
425 m_objc_exception_bp_sp->SetBreakpointKind("ObjC exception");
426 } else
427 m_objc_exception_bp_sp->SetEnabled(true);
428}
429
431 if (!m_process)
432 return;
433
434 if (m_objc_exception_bp_sp.get()) {
435 m_objc_exception_bp_sp->SetEnabled(false);
436 }
437}
438
442
444 lldb::StopInfoSP stop_reason) {
445 if (!m_process)
446 return false;
447
448 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
449 return false;
450
451 uint64_t break_site_id = stop_reason->GetValue();
452 return m_process->GetBreakpointSiteList().StopPointSiteContainsBreakpoint(
453 break_site_id, m_objc_exception_bp_sp->GetID());
454}
455
457 if (!m_process)
458 return false;
459
460 static ConstString s_method_signature(
461 "-[NSDictionary objectForKeyedSubscript:]");
462 // NSDictionary is toll-free bridged with CFDictionary, so the
463 // implementation lives in CoreFoundation, not Foundation.
464 static ModuleSpec corefoundation_module_spec(FileSpec("CoreFoundation"));
465
466 Target &target = m_process->GetTarget();
467 if (ModuleSP corefoundation_module_sp =
468 target.GetImages().FindFirstModule(corefoundation_module_spec)) {
469 if (corefoundation_module_sp->FindFirstSymbolWithNameAndType(
470 s_method_signature, eSymbolTypeCode))
471 return true;
472 }
473
474 return false;
475}
476
478 Target &target = m_process->GetTarget();
479
480 FileSpecList filter_modules;
481 if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
482 filter_modules.Append(std::get<0>(GetExceptionThrowLocation()));
483 }
484 return target.GetSearchFilterForModuleList(&filter_modules);
485}
486
488 ThreadSP thread_sp) {
489 auto *cpp_runtime = m_process->GetLanguageRuntime(eLanguageTypeC_plus_plus);
490 if (!cpp_runtime) return ValueObjectSP();
491 auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp);
492 if (!cpp_exception) return ValueObjectSP();
493
494 auto descriptor = GetClassDescriptor(*cpp_exception);
495 if (!descriptor || !descriptor->IsValid()) return ValueObjectSP();
496
497 while (descriptor) {
498 ConstString class_name(descriptor->GetClassName());
499 if (class_name == "NSException")
500 return cpp_exception;
501 descriptor = descriptor->GetSuperclass();
502 }
503
504 return ValueObjectSP();
505}
506
507/// Utility method for error handling in GetBacktraceThreadFromException.
508/// \param msg The message to add to the log.
509/// \return An invalid ThreadSP to be returned from
510/// GetBacktraceThreadFromException.
511[[nodiscard]]
512static ThreadSP FailExceptionParsing(llvm::StringRef msg) {
514 LLDB_LOG(log, "Failed getting backtrace from exception: {0}", msg);
515 return ThreadSP();
516}
517
519 lldb::ValueObjectSP exception_sp) {
520 ValueObjectSP reserved_dict =
521 exception_sp->GetChildMemberWithName("reserved");
522 if (!reserved_dict)
523 return FailExceptionParsing("Failed to get 'reserved' member.");
524
525 reserved_dict = reserved_dict->GetSyntheticValue();
526 if (!reserved_dict)
527 return FailExceptionParsing("Failed to get synthetic value.");
528
529 TypeSystemClangSP scratch_ts_sp =
530 ScratchTypeSystemClang::GetForTarget(*exception_sp->GetTargetSP());
531 if (!scratch_ts_sp)
532 return FailExceptionParsing("Failed to get scratch AST.");
533 CompilerType objc_id = scratch_ts_sp->GetBasicType(lldb::eBasicTypeObjCID);
534 ValueObjectSP return_addresses;
535
536 auto objc_object_from_address = [&exception_sp, &objc_id](uint64_t addr,
537 const char *name) {
538 Value value(addr);
539 value.SetCompilerType(objc_id);
540 auto object = ValueObjectConstResult::Create(
541 exception_sp->GetTargetSP().get(), value, ConstString(name));
542 object = object->GetDynamicValue(eDynamicDontRunTarget);
543 return object;
544 };
545
546 for (size_t idx = 0; idx < reserved_dict->GetNumChildrenIgnoringErrors();
547 idx++) {
548 ValueObjectSP dict_entry = reserved_dict->GetChildAtIndex(idx);
549
550 DataExtractor data;
551 data.SetAddressByteSize(dict_entry->GetProcessSP()->GetAddressByteSize());
553 dict_entry->GetData(data, error);
554 if (error.Fail()) return ThreadSP();
555
556 lldb::offset_t data_offset = 0;
557 auto dict_entry_key = data.GetAddress(&data_offset);
558 auto dict_entry_value = data.GetAddress(&data_offset);
559
560 auto key_nsstring = objc_object_from_address(dict_entry_key, "key");
561 StreamString key_summary;
563 *key_nsstring, key_summary, TypeSummaryOptions()) &&
564 !key_summary.Empty()) {
565 if (key_summary.GetString() == "\"callStackReturnAddresses\"") {
566 return_addresses = objc_object_from_address(dict_entry_value,
567 "callStackReturnAddresses");
568 break;
569 }
570 }
571 }
572
573 if (!return_addresses)
574 return FailExceptionParsing("Failed to get return addresses.");
575 auto frames_value = return_addresses->GetChildMemberWithName("_frames");
576 if (!frames_value)
577 return FailExceptionParsing("Failed to get frames_value.");
578 addr_t frames_addr = frames_value->GetValueAsUnsigned(0);
579 auto count_value = return_addresses->GetChildMemberWithName("_cnt");
580 if (!count_value)
581 return FailExceptionParsing("Failed to get count_value.");
582 size_t count = count_value->GetValueAsUnsigned(0);
583 auto ignore_value = return_addresses->GetChildMemberWithName("_ignore");
584 if (!ignore_value)
585 return FailExceptionParsing("Failed to get ignore_value.");
586 size_t ignore = ignore_value->GetValueAsUnsigned(0);
587
588 size_t ptr_size = m_process->GetAddressByteSize();
589 std::vector<lldb::addr_t> pcs;
590 for (size_t idx = 0; idx < count; idx++) {
592 addr_t pc = m_process->ReadPointerFromMemory(
593 frames_addr + (ignore + idx) * ptr_size, error);
594 pcs.push_back(pc);
595 }
596
597 if (pcs.empty())
598 return FailExceptionParsing("Failed to get PC list.");
599
600 ThreadSP new_thread_sp(new HistoryThread(*m_process, 0, pcs));
601 m_process->GetExtendedThreadList().AddThread(new_thread_sp);
602 return new_thread_sp;
603}
604
605std::tuple<FileSpec, ConstString>
607 return std::make_tuple(
608 FileSpec("libobjc.A.dylib"), ConstString("objc_exception_throw"));
609}
610
612 if (!HasReadObjCLibrary()) {
613 std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
614
615 size_t num_modules = module_list.GetSize();
616 for (size_t i = 0; i < num_modules; i++) {
617 auto mod = module_list.GetModuleAtIndex(i);
618 if (IsModuleObjCLibrary(mod)) {
619 ReadObjCLibrary(mod);
620 break;
621 }
622 }
623 }
624}
625
627 ReadObjCLibraryIfNeeded(module_list);
628}
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:376
#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:396
void SetTryAllThreads(bool try_others=true)
Definition Target.h:429
void SetTimeout(const Timeout< std::micro > &timeout)
Definition Target.h:417
void SetStopOthers(bool stop_others=true)
Definition Target.h:433
void SetIgnoreBreakpoints(bool ignore=false)
Definition Target.h:400
"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:559
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:706
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1243
const ArchSpec & GetArchitecture() const
Definition Target.h:1285
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:339
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