LLDB  mainline
AppleObjCRuntime.cpp
Go to the documentation of this file.
1 //===-- AppleObjCRuntime.cpp -------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "AppleObjCRuntime.h"
12 
13 #include "clang/AST/Type.h"
14 
16 #include "lldb/Core/Module.h"
17 #include "lldb/Core/ModuleList.h"
19 #include "lldb/Core/Section.h"
20 #include "lldb/Core/ValueObject.h"
26 #include "lldb/Symbol/ObjectFile.h"
29 #include "lldb/Target/Process.h"
31 #include "lldb/Target/StopInfo.h"
32 #include "lldb/Target/Target.h"
33 #include "lldb/Target/Thread.h"
35 #include "lldb/Utility/Log.h"
36 #include "lldb/Utility/Scalar.h"
37 #include "lldb/Utility/Status.h"
39 
42 
43 #include <vector>
44 
45 using namespace lldb;
46 using namespace lldb_private;
47 
48 AppleObjCRuntime::~AppleObjCRuntime() {}
49 
50 AppleObjCRuntime::AppleObjCRuntime(Process *process)
51  : ObjCLanguageRuntime(process), m_read_objc_library(false),
52  m_objc_trampoline_handler_up(), m_Foundation_major() {
54 }
55 
57  CompilerType compiler_type(valobj.GetCompilerType());
58  bool is_signed;
59  // ObjC objects can only be pointers (or numbers that actually represents
60  // pointers but haven't been typecast, because reasons..)
61  if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType())
62  return false;
63 
64  // Make the argument list: we pass one arg, the address of our pointer, to
65  // the print function.
66  Value val;
67 
68  if (!valobj.ResolveValue(val.GetScalar()))
69  return false;
70 
71  // Value Objects may not have a process in their ExecutionContextRef. But we
72  // need to have one in the ref we pass down to eventually call description.
73  // Get it from the target if it isn't present.
74  ExecutionContext exe_ctx;
75  if (valobj.GetProcessSP()) {
76  exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
77  } else {
78  exe_ctx.SetContext(valobj.GetTargetSP(), true);
79  if (!exe_ctx.HasProcessScope())
80  return false;
81  }
82  return GetObjectDescription(str, val, exe_ctx.GetBestExecutionContextScope());
83 }
85  ExecutionContextScope *exe_scope) {
87  return false;
88 
89  ExecutionContext exe_ctx;
90  exe_scope->CalculateExecutionContext(exe_ctx);
91  Process *process = exe_ctx.GetProcessPtr();
92  if (!process)
93  return false;
94 
95  // We need other parts of the exe_ctx, but the processes have to match.
96  assert(m_process == process);
97 
98  // Get the function address for the print function.
99  const Address *function_address = GetPrintForDebuggerAddr();
100  if (!function_address)
101  return false;
102 
103  Target *target = exe_ctx.GetTargetPtr();
104  CompilerType compiler_type = value.GetCompilerType();
105  if (compiler_type) {
106  if (!ClangASTContext::IsObjCObjectPointerType(compiler_type)) {
107  strm.Printf("Value doesn't point to an ObjC object.\n");
108  return false;
109  }
110  } else {
111  // If it is not a pointer, see if we can make it into a pointer.
112  ClangASTContext *ast_context = target->GetScratchClangASTContext();
113  CompilerType opaque_type = ast_context->GetBasicType(eBasicTypeObjCID);
114  if (!opaque_type)
115  opaque_type = ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
116  // value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
117  value.SetCompilerType(opaque_type);
118  }
119 
120  ValueList arg_value_list;
121  arg_value_list.PushValue(value);
122 
123  // This is the return value:
124  ClangASTContext *ast_context = target->GetScratchClangASTContext();
125 
126  CompilerType return_compiler_type = ast_context->GetCStringType(true);
127  Value ret;
128  // ret.SetContext(Value::eContextTypeClangType, return_compiler_type);
129  ret.SetCompilerType(return_compiler_type);
130 
131  if (exe_ctx.GetFramePtr() == NULL) {
132  Thread *thread = exe_ctx.GetThreadPtr();
133  if (thread == NULL) {
134  exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread());
135  thread = exe_ctx.GetThreadPtr();
136  }
137  if (thread) {
138  exe_ctx.SetFrameSP(thread->GetSelectedFrame());
139  }
140  }
141 
142  // Now we're ready to call the function:
143 
144  DiagnosticManager diagnostics;
145  lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
146 
148  Status error;
150  exe_scope->CalculateTarget()->GetFunctionCallerForLanguage(
151  eLanguageTypeObjC, return_compiler_type, *function_address,
152  arg_value_list, "objc-object-description", error));
153  if (error.Fail()) {
154  m_print_object_caller_up.reset();
155  strm.Printf("Could not get function runner to call print for debugger "
156  "function: %s.",
157  error.AsCString());
158  return false;
159  }
160  m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr,
161  diagnostics);
162  } else {
163  m_print_object_caller_up->WriteFunctionArguments(
164  exe_ctx, wrapper_struct_addr, arg_value_list, diagnostics);
165  }
166 
168  options.SetUnwindOnError(true);
169  options.SetTryAllThreads(true);
170  options.SetStopOthers(true);
171  options.SetIgnoreBreakpoints(true);
172  options.SetTimeout(process->GetUtilityExpressionTimeout());
173  options.SetIsForUtilityExpr(true);
174 
175  ExpressionResults results = m_print_object_caller_up->ExecuteFunction(
176  exe_ctx, &wrapper_struct_addr, options, diagnostics, ret);
177  if (results != eExpressionCompleted) {
178  strm.Printf("Error evaluating Print Object function: %d.\n", results);
179  return false;
180  }
181 
182  addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
183 
184  char buf[512];
185  size_t cstr_len = 0;
186  size_t full_buffer_len = sizeof(buf) - 1;
187  size_t curr_len = full_buffer_len;
188  while (curr_len == full_buffer_len) {
189  Status error;
190  curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf,
191  sizeof(buf), error);
192  strm.Write(buf, curr_len);
193  cstr_len += curr_len;
194  }
195  return cstr_len > 0;
196 }
197 
199  ModuleSP module_sp(m_objc_module_wp.lock());
200  if (module_sp)
201  return module_sp;
202 
203  Process *process = GetProcess();
204  if (process) {
205  const ModuleList &modules = process->GetTarget().GetImages();
206  for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
207  module_sp = modules.GetModuleAtIndex(idx);
209  m_objc_module_wp = module_sp;
210  return module_sp;
211  }
212  }
213  }
214  return ModuleSP();
215 }
216 
219  const ModuleList &modules = m_process->GetTarget().GetImages();
220 
221  SymbolContextList contexts;
222  SymbolContext context;
223 
224  if ((!modules.FindSymbolsWithNameAndType(ConstString("_NSPrintForDebugger"),
225  eSymbolTypeCode, contexts)) &&
226  (!modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"),
227  eSymbolTypeCode, contexts)))
228  return NULL;
229 
230  contexts.GetContextAtIndex(0, context);
231 
232  m_PrintForDebugger_addr.reset(new Address(context.symbol->GetAddress()));
233  }
234 
235  return m_PrintForDebugger_addr.get();
236 }
237 
239  return in_value.GetCompilerType().IsPossibleDynamicType(
240  NULL,
241  false, // do not check C++
242  true); // check ObjC
243 }
244 
246  ValueObject &in_value, lldb::DynamicValueType use_dynamic,
247  TypeAndOrName &class_type_or_name, Address &address,
248  Value::ValueType &value_type) {
249  return false;
250 }
251 
254  ValueObject &static_value) {
255  CompilerType static_type(static_value.GetCompilerType());
256  Flags static_type_flags(static_type.GetTypeInfo());
257 
258  TypeAndOrName ret(type_and_or_name);
259  if (type_and_or_name.HasType()) {
260  // The type will always be the type of the dynamic object. If our parent's
261  // type was a pointer, then our type should be a pointer to the type of the
262  // dynamic object. If a reference, then the original type should be
263  // okay...
264  CompilerType orig_type = type_and_or_name.GetCompilerType();
265  CompilerType corrected_type = orig_type;
266  if (static_type_flags.AllSet(eTypeIsPointer))
267  corrected_type = orig_type.GetPointerType();
268  ret.SetCompilerType(corrected_type);
269  } else {
270  // If we are here we need to adjust our dynamic type name to include the
271  // correct & or * symbol
272  std::string corrected_name(type_and_or_name.GetName().GetCString());
273  if (static_type_flags.AllSet(eTypeIsPointer))
274  corrected_name.append(" *");
275  // the parent type should be a correctly pointer'ed or referenc'ed type
276  ret.SetCompilerType(static_type);
277  ret.SetName(corrected_name.c_str());
278  }
279  return ret;
280 }
281 
282 bool AppleObjCRuntime::AppleIsModuleObjCLibrary(const ModuleSP &module_sp) {
283  if (module_sp) {
284  const FileSpec &module_file_spec = module_sp->GetFileSpec();
285  static ConstString ObjCName("libobjc.A.dylib");
286 
287  if (module_file_spec) {
288  if (module_file_spec.GetFilename() == ObjCName)
289  return true;
290  }
291  }
292  return false;
293 }
294 
295 // we use the version of Foundation to make assumptions about the ObjC runtime
296 // on a target
298  if (!m_Foundation_major.hasValue()) {
299  const ModuleList &modules = m_process->GetTarget().GetImages();
300  for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
301  lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
302  if (!module_sp)
303  continue;
304  if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),
305  "Foundation") == 0) {
306  m_Foundation_major = module_sp->GetVersion().getMajor();
307  return *m_Foundation_major;
308  }
309  }
311  } else
312  return m_Foundation_major.getValue();
313 }
314 
316  lldb::addr_t &cf_false) {
317  cf_true = cf_false = LLDB_INVALID_ADDRESS;
318 }
319 
320 bool AppleObjCRuntime::IsModuleObjCLibrary(const ModuleSP &module_sp) {
321  return AppleIsModuleObjCLibrary(module_sp);
322 }
323 
324 bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) {
325  // Maybe check here and if we have a handler already, and the UUID of this
326  // module is the same as the one in the current module, then we don't have to
327  // reread it?
329  new AppleObjCTrampolineHandler(m_process->shared_from_this(), module_sp));
330  if (m_objc_trampoline_handler_up != NULL) {
331  m_read_objc_library = true;
332  return true;
333  } else
334  return false;
335 }
336 
338  bool stop_others) {
339  ThreadPlanSP thread_plan_sp;
341  thread_plan_sp = m_objc_trampoline_handler_up->GetStepThroughDispatchPlan(
342  thread, stop_others);
343  return thread_plan_sp;
344 }
345 
346 // Static Functions
348 AppleObjCRuntime::GetObjCVersion(Process *process, ModuleSP &objc_module_sp) {
349  if (!process)
351 
352  Target &target = process->GetTarget();
353  if (target.GetArchitecture().GetTriple().getVendor() !=
354  llvm::Triple::VendorType::Apple)
356 
357  const ModuleList &target_modules = target.GetImages();
358  std::lock_guard<std::recursive_mutex> gaurd(target_modules.GetMutex());
359 
360  size_t num_images = target_modules.GetSize();
361  for (size_t i = 0; i < num_images; i++) {
362  ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked(i);
363  // One tricky bit here is that we might get called as part of the initial
364  // module loading, but before all the pre-run libraries get winnowed from
365  // the module list. So there might actually be an old and incorrect ObjC
366  // library sitting around in the list, and we don't want to look at that.
367  // That's why we call IsLoadedInTarget.
368 
369  if (AppleIsModuleObjCLibrary(module_sp) &&
370  module_sp->IsLoadedInTarget(&target)) {
371  objc_module_sp = module_sp;
372  ObjectFile *ofile = module_sp->GetObjectFile();
373  if (!ofile)
375 
376  SectionList *sections = module_sp->GetSectionList();
377  if (!sections)
379  SectionSP v1_telltale_section_sp =
380  sections->FindSectionByName(ConstString("__OBJC"));
381  if (v1_telltale_section_sp) {
383  }
385  }
386  }
387 
389 }
390 
392  const bool catch_bp = false;
393  const bool throw_bp = true;
394  const bool is_internal = true;
395 
396  if (!m_objc_exception_bp_sp) {
398  m_process->GetTarget(), GetLanguageType(), catch_bp, throw_bp,
399  is_internal);
401  m_objc_exception_bp_sp->SetBreakpointKind("ObjC exception");
402  } else
403  m_objc_exception_bp_sp->SetEnabled(true);
404 }
405 
407  if (!m_process)
408  return;
409 
410  if (m_objc_exception_bp_sp.get()) {
411  m_objc_exception_bp_sp->SetEnabled(false);
412  }
413 }
414 
416  return m_objc_exception_bp_sp && m_objc_exception_bp_sp->IsEnabled();
417 }
418 
420  lldb::StopInfoSP stop_reason) {
421  if (!m_process)
422  return false;
423 
424  if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
425  return false;
426 
427  uint64_t break_site_id = stop_reason->GetValue();
429  break_site_id, m_objc_exception_bp_sp->GetID());
430 }
431 
433  if (!m_process)
434  return false;
435 
436  Target &target(m_process->GetTarget());
437 
438  static ConstString s_method_signature(
439  "-[NSDictionary objectForKeyedSubscript:]");
440  static ConstString s_arclite_method_signature(
441  "__arclite_objectForKeyedSubscript");
442 
443  SymbolContextList sc_list;
444 
445  return target.GetImages().FindSymbolsWithNameAndType(
446  s_method_signature, eSymbolTypeCode, sc_list) ||
447  target.GetImages().FindSymbolsWithNameAndType(
448  s_arclite_method_signature, eSymbolTypeCode, sc_list);
449 }
450 
452  Target &target = m_process->GetTarget();
453 
454  if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
455  FileSpecList filter_modules;
456  filter_modules.Append(std::get<0>(GetExceptionThrowLocation()));
457  return target.GetSearchFilterForModuleList(&filter_modules);
458  } else {
460  }
461 }
462 
464  ThreadSP thread_sp) {
465  auto cpp_runtime = m_process->GetCPPLanguageRuntime();
466  if (!cpp_runtime) return ValueObjectSP();
467  auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp);
468  if (!cpp_exception) return ValueObjectSP();
469 
470  auto descriptor = GetClassDescriptor(*cpp_exception);
471  if (!descriptor || !descriptor->IsValid()) return ValueObjectSP();
472 
473  while (descriptor) {
474  ConstString class_name(descriptor->GetClassName());
475  if (class_name == "NSException")
476  return cpp_exception;
477  descriptor = descriptor->GetSuperclass();
478  }
479 
480  return ValueObjectSP();
481 }
482 
484  lldb::ValueObjectSP exception_sp) {
485  ValueObjectSP reserved_dict =
486  exception_sp->GetChildMemberWithName(ConstString("reserved"), true);
487  if (!reserved_dict) return ThreadSP();
488 
489  reserved_dict = reserved_dict->GetSyntheticValue();
490  if (!reserved_dict) return ThreadSP();
491 
492  CompilerType objc_id =
493  exception_sp->GetTargetSP()->GetScratchClangASTContext()->GetBasicType(
495  ValueObjectSP return_addresses;
496 
497  auto objc_object_from_address = [&exception_sp, &objc_id](uint64_t addr,
498  const char *name) {
499  Value value(addr);
500  value.SetCompilerType(objc_id);
501  auto object = ValueObjectConstResult::Create(
502  exception_sp->GetTargetSP().get(), value, ConstString(name));
503  object = object->GetDynamicValue(eDynamicDontRunTarget);
504  return object;
505  };
506 
507  for (size_t idx = 0; idx < reserved_dict->GetNumChildren(); idx++) {
508  ValueObjectSP dict_entry = reserved_dict->GetChildAtIndex(idx, true);
509 
510  DataExtractor data;
511  data.SetAddressByteSize(dict_entry->GetProcessSP()->GetAddressByteSize());
512  Status error;
513  dict_entry->GetData(data, error);
514  if (error.Fail()) return ThreadSP();
515 
516  lldb::offset_t data_offset = 0;
517  auto dict_entry_key = data.GetPointer(&data_offset);
518  auto dict_entry_value = data.GetPointer(&data_offset);
519 
520  auto key_nsstring = objc_object_from_address(dict_entry_key, "key");
521  StreamString key_summary;
523  *key_nsstring, key_summary, TypeSummaryOptions()) &&
524  !key_summary.Empty()) {
525  if (key_summary.GetString() == "\"callStackReturnAddresses\"") {
526  return_addresses = objc_object_from_address(dict_entry_value,
527  "callStackReturnAddresses");
528  break;
529  }
530  }
531  }
532 
533  if (!return_addresses) return ThreadSP();
534  auto frames_value =
535  return_addresses->GetChildMemberWithName(ConstString("_frames"), true);
536  addr_t frames_addr = frames_value->GetValueAsUnsigned(0);
537  auto count_value =
538  return_addresses->GetChildMemberWithName(ConstString("_cnt"), true);
539  size_t count = count_value->GetValueAsUnsigned(0);
540  auto ignore_value =
541  return_addresses->GetChildMemberWithName(ConstString("_ignore"), true);
542  size_t ignore = ignore_value->GetValueAsUnsigned(0);
543 
544  size_t ptr_size = m_process->GetAddressByteSize();
545  std::vector<lldb::addr_t> pcs;
546  for (size_t idx = 0; idx < count; idx++) {
547  Status error;
549  frames_addr + (ignore + idx) * ptr_size, error);
550  pcs.push_back(pc);
551  }
552 
553  if (pcs.empty()) return ThreadSP();
554 
555  ThreadSP new_thread_sp(new HistoryThread(*m_process, 0, pcs, 0, false));
556  m_process->GetExtendedThreadList().AddThread(new_thread_sp);
557  return new_thread_sp;
558 }
559 
560 std::tuple<FileSpec, ConstString>
562  return std::make_tuple(
563  FileSpec("libobjc.A.dylib"), ConstString("objc_exception_throw"));
564 }
565 
567  if (!HasReadObjCLibrary()) {
568  std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
569 
570  size_t num_modules = module_list.GetSize();
571  for (size_t i = 0; i < num_modules; i++) {
572  auto mod = module_list.GetModuleAtIndex(i);
573  if (IsModuleObjCLibrary(mod)) {
574  ReadObjCLibrary(mod);
575  break;
576  }
577  }
578  }
579 }
580 
582  ReadObjCLibraryIfNeeded(module_list);
583 }
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:289
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:369
An data extractor class.
Definition: DataExtractor.h:47
lldb::StackFrameSP GetSelectedFrame()
Definition: Thread.cpp:317
CompilerType GetCompilerType()
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) override
ThreadList & GetExtendedThreadList()
Definition: Process.h:2051
Defines a list of symbol context objects.
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
lldb::ThreadSP GetSelectedThread()
Definition: ThreadList.cpp:649
void ModulesDidLoad(const ModuleList &module_list) override
const ArchSpec & GetArchitecture() const
Definition: Target.h:941
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
Sometimes you can find the name of the type corresponding to an object, but we don&#39;t have debug infor...
Definition: Type.h:396
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object&#39;s execution context into sc.
CompilerType GetCompilerType() const
Definition: Type.h:410
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true, lldb::addr_t &cf_false)
void SetContext(const lldb::TargetSP &target_sp, bool get_process)
bool HasProcessScope() const
Returns true the ExecutionContext object contains a valid target and process.
bool GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:285
A file utility class.
Definition: FileSpec.h:55
ThreadList & GetThreadList()
Definition: Process.h:2045
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:2080
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:58
std::unique_ptr< FunctionCaller > m_print_object_caller_up
bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation()
void SetAddressByteSize(uint32_t addr_size)
Set the address byte size.
Address GetAddress() const
Definition: Symbol.h:72
lldb::TargetSP GetTargetSP() const
Definition: ValueObject.h:357
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition: Stream.h:100
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Symbol * symbol
The Symbol for a given query.
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) override
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:431
TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
virtual lldb::TargetSP CalculateTarget()=0
void SetFrameSP(const lldb::StackFrameSP &frame_sp)
Set accessor to set only the frame shared pointer.
lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const
Get the module shared pointer for the module at index idx without acquiring the ModuleList mutex...
Definition: ModuleList.cpp:331
virtual lldb::SearchFilterSP CreateExceptionSearchFilter()
virtual bool ResolveValue(Scalar &scalar)
Target * GetTargetPtr() const
Returns a pointer to the target object.
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
void SetTimeout(const Timeout< std::micro > &timeout)
Definition: Target.h:306
lldb::ModuleSP GetModuleAtIndex(size_t idx) const
Get the module shared pointer for the module at index idx.
Definition: ModuleList.cpp:326
uint64_t offset_t
Definition: lldb-types.h:87
A collection class for Module objects.
Definition: ModuleList.h:91
lldb::SectionSP FindSectionByName(ConstString section_dstr) const
Definition: Section.cpp:505
llvm::Optional< uint32_t > m_Foundation_major
BreakpointSiteList & GetBreakpointSiteList()
Definition: Process.cpp:1606
void SetCompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type)
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
size_t FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list, bool append=false) const
Definition: ModuleList.cpp:457
static bool IsObjCObjectPointerType(const CompilerType &type, CompilerType *target_type=nullptr)
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3370
llvm::StringRef GetString() const
lldb::LanguageType GetLanguageType() const override
unsigned long long ULongLong(unsigned long long fail_value=0) const
Definition: Scalar.cpp:1566
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSString.cpp:53
A plug-in interface definition class for debugging a process.
Definition: Process.h:353
Process * GetProcessPtr() const
Returns a pointer to the process object.
const ExecutionContextRef & GetExecutionContextRef() const
Definition: ValueObject.h:353
bool CouldHaveDynamicValue(ValueObject &in_value) override
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:106
const CompilerType & GetCompilerType()
Definition: Value.cpp:239
A section + offset based address class.
Definition: Address.h:80
CompilerType GetPointerType() const
A thread object representing a backtrace from a previous point in the process execution.
Definition: HistoryThread.h:34
void ReadObjCLibraryIfNeeded(const ModuleList &module_list)
ClangASTContext * GetScratchClangASTContext(bool create_on_demand=true)
Definition: Target.cpp:2299
bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override
std::chrono::seconds GetUtilityExpressionTimeout() const
Definition: Process.cpp:287
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:899
lldb::ThreadSP GetBacktraceThreadFromException(lldb::ValueObjectSP thread_sp) override
void SetStopOthers(bool stop_others=true)
Definition: Target.h:322
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition: Process.cpp:2172
A class to manage flags.
Definition: Flags.h:22
void SetThreadSP(const lldb::ThreadSP &thread_sp)
Set accessor to set only the thread shared pointer.
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1194
uint64_t addr_t
Definition: lldb-types.h:83
lldb::BreakpointSP m_objc_exception_bp_sp
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
size_t GetSize() const
Gets the size of the module list.
Definition: ModuleList.cpp:611
A uniqued constant string class.
Definition: ConstString.h:38
static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp)
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:247
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.
lldb::ProcessSP GetProcessSP() const
Definition: ValueObject.h:361
Definition: SBAddress.h:15
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:318
std::unique_ptr< Address > m_PrintForDebugger_addr
std::unique_ptr< lldb_private::AppleObjCTrampolineHandler > m_objc_trampoline_handler_up
ConstString GetName() const
Definition: Type.cpp:718
lldb::SearchFilterSP CreateExceptionSearchFilter() override
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition: Target.cpp:515
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
void AddThread(const lldb::ThreadSP &thread_sp)
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:268
const Scalar & GetScalar() const
Definition: Value.h:178
static ObjCRuntimeVersions GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp)
std::recursive_mutex & GetMutex() const
Definition: ModuleList.h:214
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
CompilerType GetCStringType(bool is_const)
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
static lldb::BreakpointSP CreateExceptionBreakpoint(Target &target, lldb::LanguageType language, bool catch_bp, bool throw_bp, bool is_internal=false)
ExecutionContextScope * GetBestExecutionContextScope() const
bool HasType() const
Definition: Type.h:426
uint64_t GetPointer(lldb::offset_t *offset_ptr) const
Extract an pointer from *offset_ptr.
CompilerType GetBasicType(lldb::BasicType type)
#define LLDB_INVALID_MODULE_VERSION
Definition: lldb-defines.h:89
virtual CPPLanguageRuntime * GetCPPLanguageRuntime(bool retry_if_null=true)
Definition: Process.cpp:1564
An error handling class.
Definition: Status.h:44
bool CalculateHasNewLiteralsAndIndexing() override
void PushValue(const Value &value)
Definition: Value.cpp:697