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"
18 #include "lldb/Core/ModuleList.h"
20 #include "lldb/Core/Section.h"
21 #include "lldb/Core/ValueObject.h"
26 #include "lldb/Symbol/ObjectFile.h"
28 #include "lldb/Target/Process.h"
30 #include "lldb/Target/StopInfo.h"
31 #include "lldb/Target/Target.h"
32 #include "lldb/Target/Thread.h"
34 #include "lldb/Utility/LLDBLog.h"
35 #include "lldb/Utility/Log.h"
36 #include "lldb/Utility/Scalar.h"
37 #include "lldb/Utility/Status.h"
39 #include "clang/AST/Type.h"
40 
42 
43 #include <vector>
44 
45 using namespace lldb;
46 using namespace lldb_private;
47 
49 
50 char AppleObjCRuntime::ID = 0;
51 
52 AppleObjCRuntime::~AppleObjCRuntime() = default;
53 
54 AppleObjCRuntime::AppleObjCRuntime(Process *process)
55  : ObjCLanguageRuntime(process), m_read_objc_library(false),
56  m_objc_trampoline_handler_up(), m_Foundation_major() {
58 }
59 
63 }
64 
68 }
69 
71  CompilerType compiler_type(valobj.GetCompilerType());
72  bool is_signed;
73  // ObjC objects can only be pointers (or numbers that actually represents
74  // pointers but haven't been typecast, because reasons..)
75  if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType())
76  return false;
77 
78  // Make the argument list: we pass one arg, the address of our pointer, to
79  // the print function.
80  Value val;
81 
82  if (!valobj.ResolveValue(val.GetScalar()))
83  return false;
84 
85  // Value Objects may not have a process in their ExecutionContextRef. But we
86  // need to have one in the ref we pass down to eventually call description.
87  // Get it from the target if it isn't present.
88  ExecutionContext exe_ctx;
89  if (valobj.GetProcessSP()) {
90  exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
91  } else {
92  exe_ctx.SetContext(valobj.GetTargetSP(), true);
93  if (!exe_ctx.HasProcessScope())
94  return false;
95  }
96  return GetObjectDescription(str, val, exe_ctx.GetBestExecutionContextScope());
97 }
99  ExecutionContextScope *exe_scope) {
100  if (!m_read_objc_library)
101  return false;
102 
103  ExecutionContext exe_ctx;
104  exe_scope->CalculateExecutionContext(exe_ctx);
105  Process *process = exe_ctx.GetProcessPtr();
106  if (!process)
107  return false;
108 
109  // We need other parts of the exe_ctx, but the processes have to match.
110  assert(m_process == process);
111 
112  // Get the function address for the print function.
113  const Address *function_address = GetPrintForDebuggerAddr();
114  if (!function_address)
115  return false;
116 
117  Target *target = exe_ctx.GetTargetPtr();
118  CompilerType compiler_type = value.GetCompilerType();
119  if (compiler_type) {
120  if (!TypeSystemClang::IsObjCObjectPointerType(compiler_type)) {
121  strm.Printf("Value doesn't point to an ObjC object.\n");
122  return false;
123  }
124  } else {
125  // If it is not a pointer, see if we can make it into a pointer.
126  TypeSystemClang *ast_context =
128  if (!ast_context)
129  return false;
130 
131  CompilerType opaque_type = ast_context->GetBasicType(eBasicTypeObjCID);
132  if (!opaque_type)
133  opaque_type = ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
134  // value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
135  value.SetCompilerType(opaque_type);
136  }
137 
138  ValueList arg_value_list;
139  arg_value_list.PushValue(value);
140 
141  // This is the return value:
143  if (!ast_context)
144  return false;
145 
146  CompilerType return_compiler_type = ast_context->GetCStringType(true);
147  Value ret;
148  // ret.SetContext(Value::eContextTypeClangType, return_compiler_type);
149  ret.SetCompilerType(return_compiler_type);
150 
151  if (exe_ctx.GetFramePtr() == nullptr) {
152  Thread *thread = exe_ctx.GetThreadPtr();
153  if (thread == nullptr) {
154  exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread());
155  thread = exe_ctx.GetThreadPtr();
156  }
157  if (thread) {
158  exe_ctx.SetFrameSP(thread->GetSelectedFrame());
159  }
160  }
161 
162  // Now we're ready to call the function:
163 
164  DiagnosticManager diagnostics;
165  lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
166 
168  Status error;
170  exe_scope->CalculateTarget()->GetFunctionCallerForLanguage(
171  eLanguageTypeObjC, return_compiler_type, *function_address,
172  arg_value_list, "objc-object-description", error));
173  if (error.Fail()) {
174  m_print_object_caller_up.reset();
175  strm.Printf("Could not get function runner to call print for debugger "
176  "function: %s.",
177  error.AsCString());
178  return false;
179  }
180  m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr,
181  diagnostics);
182  } else {
183  m_print_object_caller_up->WriteFunctionArguments(
184  exe_ctx, wrapper_struct_addr, arg_value_list, diagnostics);
185  }
186 
188  options.SetUnwindOnError(true);
189  options.SetTryAllThreads(true);
190  options.SetStopOthers(true);
191  options.SetIgnoreBreakpoints(true);
192  options.SetTimeout(process->GetUtilityExpressionTimeout());
193  options.SetIsForUtilityExpr(true);
194 
195  ExpressionResults results = m_print_object_caller_up->ExecuteFunction(
196  exe_ctx, &wrapper_struct_addr, options, diagnostics, ret);
197  if (results != eExpressionCompleted) {
198  strm.Printf("Error evaluating Print Object function: %d.\n", results);
199  return false;
200  }
201 
202  addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
203 
204  char buf[512];
205  size_t cstr_len = 0;
206  size_t full_buffer_len = sizeof(buf) - 1;
207  size_t curr_len = full_buffer_len;
208  while (curr_len == full_buffer_len) {
209  Status error;
210  curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf,
211  sizeof(buf), error);
212  strm.Write(buf, curr_len);
213  cstr_len += curr_len;
214  }
215  return cstr_len > 0;
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) {
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 
306 bool AppleObjCRuntime::AppleIsModuleObjCLibrary(const ModuleSP &module_sp) {
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 (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),
329  "Foundation") == 0) {
330  m_Foundation_major = module_sp->GetVersion().getMajor();
331  return *m_Foundation_major;
332  }
333  }
335  } else
336  return *m_Foundation_major;
337 }
338 
340  lldb::addr_t &cf_false) {
341  cf_true = cf_false = LLDB_INVALID_ADDRESS;
342 }
343 
344 bool AppleObjCRuntime::IsModuleObjCLibrary(const ModuleSP &module_sp) {
345  return AppleIsModuleObjCLibrary(module_sp);
346 }
347 
348 bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) {
349  // Maybe check here and if we have a handler already, and the UUID of this
350  // module is the same as the one in the current module, then we don't have to
351  // reread it?
352  m_objc_trampoline_handler_up = std::make_unique<AppleObjCTrampolineHandler>(
353  m_process->shared_from_this(), module_sp);
354  if (m_objc_trampoline_handler_up != nullptr) {
355  m_read_objc_library = true;
356  return true;
357  } else
358  return false;
359 }
360 
362  bool stop_others) {
363  ThreadPlanSP thread_plan_sp;
365  thread_plan_sp = m_objc_trampoline_handler_up->GetStepThroughDispatchPlan(
366  thread, stop_others);
367  return thread_plan_sp;
368 }
369 
370 // Static Functions
372 AppleObjCRuntime::GetObjCVersion(Process *process, ModuleSP &objc_module_sp) {
373  if (!process)
375 
376  Target &target = process->GetTarget();
377  if (target.GetArchitecture().GetTriple().getVendor() !=
378  llvm::Triple::VendorType::Apple)
380 
381  for (ModuleSP module_sp : target.GetImages().Modules()) {
382  // One tricky bit here is that we might get called as part of the initial
383  // module loading, but before all the pre-run libraries get winnowed from
384  // the module list. So there might actually be an old and incorrect ObjC
385  // library sitting around in the list, and we don't want to look at that.
386  // That's why we call IsLoadedInTarget.
387 
388  if (AppleIsModuleObjCLibrary(module_sp) &&
389  module_sp->IsLoadedInTarget(&target)) {
390  objc_module_sp = module_sp;
391  ObjectFile *ofile = module_sp->GetObjectFile();
392  if (!ofile)
394 
395  SectionList *sections = module_sp->GetSectionList();
396  if (!sections)
398  SectionSP v1_telltale_section_sp =
399  sections->FindSectionByName(ConstString("__OBJC"));
400  if (v1_telltale_section_sp) {
402  }
404  }
405  }
406 
408 }
409 
411  const bool catch_bp = false;
412  const bool throw_bp = true;
413  const bool is_internal = true;
414 
415  if (!m_objc_exception_bp_sp) {
417  m_process->GetTarget(), GetLanguageType(), catch_bp, throw_bp,
418  is_internal);
420  m_objc_exception_bp_sp->SetBreakpointKind("ObjC exception");
421  } else
422  m_objc_exception_bp_sp->SetEnabled(true);
423 }
424 
426  if (!m_process)
427  return;
428 
429  if (m_objc_exception_bp_sp.get()) {
430  m_objc_exception_bp_sp->SetEnabled(false);
431  }
432 }
433 
435  return m_objc_exception_bp_sp && m_objc_exception_bp_sp->IsEnabled();
436 }
437 
439  lldb::StopInfoSP stop_reason) {
440  if (!m_process)
441  return false;
442 
443  if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
444  return false;
445 
446  uint64_t break_site_id = stop_reason->GetValue();
448  break_site_id, m_objc_exception_bp_sp->GetID());
449 }
450 
452  if (!m_process)
453  return false;
454 
455  Target &target(m_process->GetTarget());
456 
457  static ConstString s_method_signature(
458  "-[NSDictionary objectForKeyedSubscript:]");
459  static ConstString s_arclite_method_signature(
460  "__arclite_objectForKeyedSubscript");
461 
462  SymbolContextList sc_list;
463 
464  target.GetImages().FindSymbolsWithNameAndType(s_method_signature,
465  eSymbolTypeCode, sc_list);
466  if (sc_list.IsEmpty())
467  target.GetImages().FindSymbolsWithNameAndType(s_arclite_method_signature,
468  eSymbolTypeCode, sc_list);
469  return !sc_list.IsEmpty();
470 }
471 
473  Target &target = m_process->GetTarget();
474 
475  FileSpecList filter_modules;
476  if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
477  filter_modules.Append(std::get<0>(GetExceptionThrowLocation()));
478  }
479  return target.GetSearchFilterForModuleList(&filter_modules);
480 }
481 
483  ThreadSP thread_sp) {
485  if (!cpp_runtime) return ValueObjectSP();
486  auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp);
487  if (!cpp_exception) return ValueObjectSP();
488 
489  auto descriptor = GetClassDescriptor(*cpp_exception);
490  if (!descriptor || !descriptor->IsValid()) return ValueObjectSP();
491 
492  while (descriptor) {
493  ConstString class_name(descriptor->GetClassName());
494  if (class_name == "NSException")
495  return cpp_exception;
496  descriptor = descriptor->GetSuperclass();
497  }
498 
499  return ValueObjectSP();
500 }
501 
502 /// Utility method for error handling in GetBacktraceThreadFromException.
503 /// \param msg The message to add to the log.
504 /// \return An invalid ThreadSP to be returned from
505 /// GetBacktraceThreadFromException.
506 LLVM_NODISCARD
507 static ThreadSP FailExceptionParsing(llvm::StringRef msg) {
508  Log *log = GetLog(LLDBLog::Language);
509  LLDB_LOG(log, "Failed getting backtrace from exception: {0}", msg);
510  return ThreadSP();
511 }
512 
514  lldb::ValueObjectSP exception_sp) {
515  ValueObjectSP reserved_dict =
516  exception_sp->GetChildMemberWithName(ConstString("reserved"), true);
517  if (!reserved_dict)
518  return FailExceptionParsing("Failed to get 'reserved' member.");
519 
520  reserved_dict = reserved_dict->GetSyntheticValue();
521  if (!reserved_dict)
522  return FailExceptionParsing("Failed to get synthetic value.");
523 
524  TypeSystemClang *clang_ast_context =
525  ScratchTypeSystemClang::GetForTarget(*exception_sp->GetTargetSP());
526  if (!clang_ast_context)
527  return FailExceptionParsing("Failed to get scratch AST.");
528  CompilerType objc_id =
529  clang_ast_context->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->GetNumChildren(); idx++) {
543  ValueObjectSP dict_entry = reserved_dict->GetChildAtIndex(idx, true);
544 
545  DataExtractor data;
546  data.SetAddressByteSize(dict_entry->GetProcessSP()->GetAddressByteSize());
547  Status error;
548  dict_entry->GetData(data, error);
549  if (error.Fail()) return ThreadSP();
550 
551  lldb::offset_t data_offset = 0;
552  auto dict_entry_key = data.GetAddress(&data_offset);
553  auto dict_entry_value = data.GetAddress(&data_offset);
554 
555  auto key_nsstring = objc_object_from_address(dict_entry_key, "key");
556  StreamString key_summary;
558  *key_nsstring, key_summary, TypeSummaryOptions()) &&
559  !key_summary.Empty()) {
560  if (key_summary.GetString() == "\"callStackReturnAddresses\"") {
561  return_addresses = objc_object_from_address(dict_entry_value,
562  "callStackReturnAddresses");
563  break;
564  }
565  }
566  }
567 
568  if (!return_addresses)
569  return FailExceptionParsing("Failed to get return addresses.");
570  auto frames_value =
571  return_addresses->GetChildMemberWithName(ConstString("_frames"), true);
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 =
576  return_addresses->GetChildMemberWithName(ConstString("_cnt"), true);
577  if (!count_value)
578  return FailExceptionParsing("Failed to get count_value.");
579  size_t count = count_value->GetValueAsUnsigned(0);
580  auto ignore_value =
581  return_addresses->GetChildMemberWithName(ConstString("_ignore"), true);
582  if (!ignore_value)
583  return FailExceptionParsing("Failed to get ignore_value.");
584  size_t ignore = ignore_value->GetValueAsUnsigned(0);
585 
586  size_t ptr_size = m_process->GetAddressByteSize();
587  std::vector<lldb::addr_t> pcs;
588  for (size_t idx = 0; idx < count; idx++) {
589  Status error;
591  frames_addr + (ignore + idx) * ptr_size, error);
592  pcs.push_back(pc);
593  }
594 
595  if (pcs.empty())
596  return FailExceptionParsing("Failed to get PC list.");
597 
598  ThreadSP new_thread_sp(new HistoryThread(*m_process, 0, pcs));
599  m_process->GetExtendedThreadList().AddThread(new_thread_sp);
600  return new_thread_sp;
601 }
602 
603 std::tuple<FileSpec, ConstString>
605  return std::make_tuple(
606  FileSpec("libobjc.A.dylib"), ConstString("objc_exception_throw"));
607 }
608 
610  if (!HasReadObjCLibrary()) {
611  std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
612 
613  size_t num_modules = module_list.GetSize();
614  for (size_t i = 0; i < num_modules; i++) {
615  auto mod = module_list.GetModuleAtIndex(i);
616  if (IsModuleObjCLibrary(mod)) {
617  ReadObjCLibrary(mod);
618  break;
619  }
620  }
621  }
622 }
623 
625  ReadObjCLibraryIfNeeded(module_list);
626 }
lldb_private::AppleObjCRuntime::Terminate
static void Terminate()
Definition: AppleObjCRuntime.cpp:65
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::SectionList::FindSectionByName
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition: Section.cpp:546
Scalar.h
FailExceptionParsing
static LLVM_NODISCARD ThreadSP FailExceptionParsing(llvm::StringRef msg)
Utility method for error handling in GetBacktraceThreadFromException.
Definition: AppleObjCRuntime.cpp:507
lldb_private::DataExtractor::GetAddress
uint64_t GetAddress(lldb::offset_t *offset_ptr) const
Extract an address from *offset_ptr.
Definition: DataExtractor.cpp:649
lldb_private::TypeAndOrName::GetCompilerType
CompilerType GetCompilerType() const
Definition: Type.h:411
lldb_private::AppleObjCRuntimeV1::Terminate
static void Terminate()
Definition: AppleObjCRuntimeV1.cpp:92
lldb::eSymbolTypeCode
@ eSymbolTypeCode
Definition: lldb-enumerations.h:622
lldb_private::AppleObjCRuntime::GetPrintForDebuggerAddr
Address * GetPrintForDebuggerAddr()
Definition: AppleObjCRuntime.cpp:237
lldb_private::ModuleList::Modules
ModuleIterable Modules() const
Definition: ModuleList.h:491
FunctionCaller.h
lldb_private::LLDBLog::Language
@ Language
lldb_private::EvaluateExpressionOptions::SetTimeout
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:349
lldb_private::ObjCLanguageRuntime::GetLanguageType
lldb::LanguageType GetLanguageType() const override
Definition: ObjCLanguageRuntime.h:236
lldb_private::ObjCLanguageRuntime
Definition: ObjCLanguageRuntime.h:35
lldb_private::TypeAndOrName::SetName
void SetName(ConstString type_name)
Definition: Type.cpp:769
lldb_private::Value
Definition: Value.h:38
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:206
lldb_private::AppleObjCRuntime::GetDynamicTypeAndAddress
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) override
Definition: AppleObjCRuntime.cpp:269
lldb_private::AppleObjCRuntime::ReadObjCLibraryIfNeeded
void ReadObjCLibraryIfNeeded(const ModuleList &module_list)
Definition: AppleObjCRuntime.cpp:609
lldb::ExpressionResults
ExpressionResults
The results of expression evaluation.
Definition: lldb-enumerations.h:270
lldb_private::TypeAndOrName::SetCompilerType
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:785
lldb_private::LanguageRuntime::CreateExceptionBreakpoint
static lldb::BreakpointSP CreateExceptionBreakpoint(Target &target, lldb::LanguageType language, bool catch_bp, bool throw_bp, bool is_internal=false)
Definition: LanguageRuntime.cpp:238
lldb_private::AppleObjCRuntime::SetExceptionBreakpoints
void SetExceptionBreakpoints() override
Definition: AppleObjCRuntime.cpp:410
lldb_private::ProcessProperties::GetUtilityExpressionTimeout
std::chrono::seconds GetUtilityExpressionTimeout() const
Definition: Process.cpp:308
lldb_private::Process
Definition: Process.h:338
lldb_private::ModuleList::GetMutex
std::recursive_mutex & GetMutex() const
Definition: ModuleList.h:208
lldb_private::Process::GetBreakpointSiteList
BreakpointSiteList & GetBreakpointSiteList()
Definition: Process.cpp:1561
lldb_private::EvaluateExpressionOptions::SetIsForUtilityExpr
void SetIsForUtilityExpr(bool b)
Definition: Target.h:436
Module.h
lldb_private::AppleObjCRuntime::m_objc_exception_bp_sp
lldb::BreakpointSP m_objc_exception_bp_sp
Definition: AppleObjCRuntime.h:126
lldb_private::Process::GetThreadList
ThreadList & GetThreadList()
Definition: Process.h:2073
BreakpointLocation.h
lldb_private::BreakpointSiteList::BreakpointSiteContainsBreakpoint
bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
Returns whether the breakpoint site bp_site_id has bp_id.
Definition: BreakpointSiteList.cpp:141
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1206
lldb_private::EvaluateExpressionOptions
Definition: Target.h:281
lldb_private::Flags
Definition: Flags.h:22
lldb_private::HistoryThread
Definition: HistoryThread.h:33
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::SymbolContextList::GetContextAtIndex
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Definition: SymbolContext.cpp:1260
lldb_private::ExecutionContext::GetFramePtr
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Definition: ExecutionContext.h:408
lldb_private::SectionList
Definition: Section.h:34
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::ValueList
Definition: Value.h:157
lldb_private::TypeSystemClang::IsObjCObjectPointerType
static bool IsObjCObjectPointerType(const CompilerType &type, CompilerType *target_type=nullptr)
Definition: TypeSystemClang.cpp:3730
HistoryThread.h
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Process::ReadCStringFromMemory
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:1987
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:455
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
pc
@ pc
Definition: CompactUnwindInfo.cpp:1251
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2
@ eAppleObjC_V2
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:473
lldb_private::AppleObjCRuntime::GetExceptionObjectForThread
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
Definition: AppleObjCRuntime.cpp:482
Section.h
lldb_private::ExecutionContext::GetThreadPtr
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
Definition: ExecutionContext.h:399
lldb_private::AppleObjCRuntimeV2::Terminate
static void Terminate()
Definition: AppleObjCRuntimeV2.cpp:1158
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:947
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::AppleObjCRuntime::m_Foundation_major
llvm::Optional< uint32_t > m_Foundation_major
Definition: AppleObjCRuntime.h:130
Process.h
lldb_private::AppleObjCRuntime::m_print_object_caller_up
std::unique_ptr< FunctionCaller > m_print_object_caller_up
Definition: AppleObjCRuntime.h:128
lldb_private::formatters::NSStringSummaryProvider
bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSString.cpp:33
lldb_private::Value::SetCompilerType
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:251
lldb_private::AppleObjCRuntime::m_objc_module_wp
lldb::ModuleWP m_objc_module_wp
Definition: AppleObjCRuntime.h:127
lldb_private::ModuleList::FindSymbolsWithNameAndType
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:504
Target.h
lldb_private::AppleObjCRuntime::GetBacktraceThreadFromException
lldb::ThreadSP GetBacktraceThreadFromException(lldb::ValueObjectSP thread_sp) override
Definition: AppleObjCRuntime.cpp:513
lldb_private::ValueObject::GetProcessSP
lldb::ProcessSP GetProcessSP() const
Definition: ValueObject.h:338
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
lldb_private::AppleObjCRuntime::GetObjectDescription
bool GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override
Definition: AppleObjCRuntime.cpp:98
lldb_private::ModuleList::GetSize
size_t GetSize() const
Gets the size of the module list.
Definition: ModuleList.cpp:630
lldb_private::ValueList::PushValue
void PushValue(const Value &value)
Definition: Value.cpp:665
lldb::eDynamicDontRunTarget
@ eDynamicDontRunTarget
Definition: lldb-enumerations.h:497
lldb_private::CompilerType::IsPossibleDynamicType
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
Definition: CompilerType.cpp:214
ID
static char ID
Definition: IRDynamicChecks.cpp:33
lldb_private::TypeAndOrName::GetName
ConstString GetName() const
Definition: Type.cpp:761
ModuleList.h
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ModuleList
Definition: ModuleList.h:81
lldb_private::Scalar::ULongLong
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:334
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
TypeSystemClang.h
lldb_private::AppleObjCRuntime::GetObjCVersion
static ObjCRuntimeVersions GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp)
Definition: AppleObjCRuntime.cpp:372
lldb_private::Thread
Definition: Thread.h:61
lldb_private::TypeSystemClang::GetCStringType
CompilerType GetCStringType(bool is_const)
Definition: TypeSystemClang.cpp:1159
lldb_private::Runtime::m_process
Process * m_process
Definition: Runtime.h:29
lldb::eExpressionCompleted
@ eExpressionCompleted
Definition: lldb-enumerations.h:271
lldb_private::ValueObject::ResolveValue
virtual bool ResolveValue(Scalar &scalar)
Definition: ValueObject.cpp:332
lldb_private::ExecutionContext::SetThreadSP
void SetThreadSP(const lldb::ThreadSP &thread_sp)
Set accessor to set only the thread shared pointer.
Definition: ExecutionContext.cpp:252
lldb_private::AppleObjCRuntime::CouldHaveDynamicValue
bool CouldHaveDynamicValue(ValueObject &in_value) override
Definition: AppleObjCRuntime.cpp:262
lldb_private::ObjCLanguageRuntime::GetClassDescriptor
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
Definition: ObjCLanguageRuntime.cpp:258
lldb_private::DataExtractor::SetAddressByteSize
void SetAddressByteSize(uint32_t addr_size)
Set the address byte size.
Definition: DataExtractor.h:845
StreamString.h
lldb_private::Process::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3345
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::ExecutionContext::SetContext
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
Definition: ExecutionContext.cpp:288
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::AppleObjCRuntime::GetStepThroughTrampolinePlan
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) override
Definition: AppleObjCRuntime.cpp:361
lldb_private::EvaluateExpressionOptions::SetTryAllThreads
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:361
lldb_private::AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing
bool CalculateHasNewLiteralsAndIndexing() override
Definition: AppleObjCRuntime.cpp:451
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eObjC_VersionUnknown
@ eObjC_VersionUnknown
lldb_private::Value::ValueType
ValueType
Type that describes Value::m_value.
Definition: Value.h:41
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions
ObjCRuntimeVersions
Definition: ObjCLanguageRuntime.h:37
lldb_private::AppleObjCRuntime
Definition: AppleObjCRuntime.h:23
lldb_private::Flags::AllSet
bool AllSet(ValueType mask) const
Test if all bits in mask are 1 in the current flags.
Definition: Flags.h:83
lldb::eBasicTypeVoid
@ eBasicTypeVoid
Definition: lldb-enumerations.h:749
lldb_private::AppleObjCRuntime::Initialize
static void Initialize()
Definition: AppleObjCRuntime.cpp:60
lldb_private::AppleObjCRuntime::GetObjCModule
lldb::ModuleSP GetObjCModule()
Definition: AppleObjCRuntime.cpp:218
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb_private::ValueObject::GetExecutionContextRef
const ExecutionContextRef & GetExecutionContextRef() const
Definition: ValueObject.h:330
lldb_private::StreamString::Empty
bool Empty() const
Definition: StreamString.cpp:36
lldb_private::CompilerType::IsIntegerType
bool IsIntegerType(bool &is_signed) const
Definition: CompilerType.cpp:141
lldb::eLanguageTypeObjC
@ eLanguageTypeObjC
Objective-C.
Definition: lldb-enumerations.h:453
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::AppleObjCRuntime::IsModuleObjCLibrary
bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override
Definition: AppleObjCRuntime.cpp:344
lldb_private::EvaluateExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:328
CPPLanguageRuntime.h
Thread.h
lldb_private::ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V1
@ eAppleObjC_V1
lldb_private::AppleObjCRuntime::GetExceptionThrowLocation
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation()
Definition: AppleObjCRuntime.cpp:604
lldb_private::AppleObjCRuntime::HasReadObjCLibrary
bool HasReadObjCLibrary() override
Definition: AppleObjCRuntime.h:69
lldb_private::AppleObjCRuntime::ExceptionBreakpointsExplainStop
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
Definition: AppleObjCRuntime.cpp:438
lldb_private::AppleObjCRuntime::FixUpDynamicType
TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
Definition: AppleObjCRuntime.cpp:277
lldb_private::AppleObjCRuntime::GetValuesForGlobalCFBooleans
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false)
Definition: AppleObjCRuntime.cpp:339
ValueObject.h
ObjectFile.h
ValueObjectConstResult.h
AppleObjCRuntimeV2.h
lldb::eBasicTypeObjCID
@ eBasicTypeObjCID
Definition: lldb-enumerations.h:777
lldb_private::EvaluateExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:332
lldb_private::Process::GetExtendedThreadList
ThreadList & GetExtendedThreadList()
Definition: Process.h:2079
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:989
lldb_private::AppleObjCRuntime::ModulesDidLoad
void ModulesDidLoad(const ModuleList &module_list) override
Called when modules have been loaded in the process.
Definition: AppleObjCRuntime.cpp:624
lldb_private::Status
Definition: Status.h:44
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
lldb_private::CompilerType::GetPointerType
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
Definition: CompilerType.cpp:407
lldb_private::AppleObjCRuntime::m_PrintForDebugger_addr
std::unique_ptr< Address > m_PrintForDebugger_addr
Definition: AppleObjCRuntime.h:122
uint32_t
lldb_private::ExecutionContext::GetBestExecutionContextScope
ExecutionContextScope * GetBestExecutionContextScope() const
Definition: ExecutionContext.cpp:214
lldb_private::AppleObjCRuntime::CreateExceptionSearchFilter
lldb::SearchFilterSP CreateExceptionSearchFilter() override
Definition: AppleObjCRuntime.cpp:472
lldb_private::Runtime::GetProcess
Process * GetProcess()
Definition: Runtime.h:22
lldb_private::Address
Definition: Address.h:59
lldb_private::CompilerType::IsPointerType
bool IsPointerType(CompilerType *pointee_type=nullptr) const
Definition: CompilerType.cpp:157
lldb_private::AppleObjCRuntime::m_objc_trampoline_handler_up
std::unique_ptr< lldb_private::AppleObjCTrampolineHandler > m_objc_trampoline_handler_up
Definition: AppleObjCRuntime.h:125
lldb_private::AppleObjCRuntime::GetFoundationVersion
uint32_t GetFoundationVersion()
Definition: AppleObjCRuntime.cpp:321
lldb_private::CompilerType::GetTypeInfo
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
Definition: CompilerType.cpp:290
lldb_private::DiagnosticManager
Definition: DiagnosticManager.h:93
lldb_private::Target::GetSearchFilterForModuleList
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:545
lldb_private::Process::GetLanguageRuntime
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
Definition: Process.cpp:1508
AppleObjCRuntimeV1.h
lldb_private::ValueObject::GetCompilerType
CompilerType GetCompilerType()
Definition: ValueObject.h:352
lldb_private::Thread::GetSelectedFrame
lldb::StackFrameSP GetSelectedFrame()
Definition: Thread.cpp:265
lldb_private::TypeSummaryOptions
Definition: TypeSummary.h:26
StopInfo.h
lldb_private::ScratchTypeSystemClang::GetForTarget
static TypeSystemClang * GetForTarget(Target &target, llvm::Optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
Definition: TypeSystemClang.cpp:9797
lldb::eStopReasonBreakpoint
@ eStopReasonBreakpoint
Definition: lldb-enumerations.h:243
PluginManager.h
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
lldb_private::AppleObjCRuntime::AppleIsModuleObjCLibrary
static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp)
Definition: AppleObjCRuntime.cpp:306
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:336
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::ValueObjectConstResult::Create
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
Definition: ValueObjectConstResult.cpp:28
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::Value::GetCompilerType
const CompilerType & GetCompilerType()
Definition: Value.cpp:222
lldb_private::SymbolContextList::IsEmpty
bool IsEmpty() const
Definition: SymbolContext.cpp:1278
DiagnosticManager.h
Status.h
NSString.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TypeAndOrName::HasType
bool HasType() const
Definition: Type.h:427
lldb_private::ExecutionContextScope::CalculateTarget
virtual lldb::TargetSP CalculateTarget()=0
lldb_private::ModuleList::GetModuleAtIndex
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
Definition: ModuleList.cpp:405
lldb_private::TypeSystemClang::GetBasicType
CompilerType GetBasicType(lldb::BasicType type)
Definition: TypeSystemClang.cpp:930
lldb_private::Stream::Write
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition: Stream.h:101
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:105
ConstString.h
lldb_private::ValueObject::GetTargetSP
lldb::TargetSP GetTargetSP() const
Definition: ValueObject.h:334
lldb_private::ThreadCollection::AddThread
void AddThread(const lldb::ThreadSP &thread_sp)
Definition: ThreadCollection.cpp:24
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:115
lldb_private::Process::ReadPointerFromMemory
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2084
lldb_private::EvaluateExpressionOptions::SetStopOthers
void SetStopOthers(bool stop_others=true)
Definition: Target.h:365
lldb_private::TypeAndOrName
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:397
lldb_private::AppleObjCRuntime::m_read_objc_library
bool m_read_objc_library
Definition: AppleObjCRuntime.h:123
lldb_private::ExecutionContextScope::CalculateExecutionContext
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
lldb_private::ExecutionContext::SetFrameSP
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
Definition: ExecutionContext.cpp:256
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:308
lldb_private::AppleObjCRuntime::ExceptionBreakpointsAreSet
bool ExceptionBreakpointsAreSet() override
Definition: AppleObjCRuntime.cpp:434
lldb_private::ThreadList::GetSelectedThread
lldb::ThreadSP GetSelectedThread()
Definition: ThreadList.cpp:649
FormattersHelpers.h
lldb_private::ExecutionContext::HasProcessScope
bool HasProcessScope() const
Returns true the ExecutionContext object contains a valid target and process.
Definition: ExecutionContext.cpp:383
lldb_private::AppleObjCRuntime::ClearExceptionBreakpoints
void ClearExceptionBreakpoints() override
Definition: AppleObjCRuntime.cpp:425
lldb
Definition: SBAddress.h:15
RegisterContext.h
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:340
AppleObjCRuntime.h
LLDBLog.h
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
lldb_private::ObjectFile
Definition: ObjectFile.h:60
ExecutionContext.h
LLDB_INVALID_MODULE_VERSION
#define LLDB_INVALID_MODULE_VERSION
Definition: lldb-defines.h:78
lldb_private::AppleObjCRuntimeV1::Initialize
static void Initialize()
Definition: AppleObjCRuntimeV1.cpp:85
AppleObjCTrampolineHandler.h
lldb_private::AppleObjCRuntimeV2::Initialize
static void Initialize()
Definition: AppleObjCRuntimeV2.cpp:1148
lldb::eLanguageTypeC_plus_plus
@ eLanguageTypeC_plus_plus
ISO C++:1998.
Definition: lldb-enumerations.h:441
lldb_private::Symbol::GetAddress
Address GetAddress() const
Definition: Symbol.h:73
lldb_private::AppleObjCRuntime::ReadObjCLibrary
bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override
Definition: AppleObjCRuntime.cpp:348