LLDB  mainline
SBFrame.cpp
Go to the documentation of this file.
1 //===-- SBFrame.cpp ---------------------------------------------*- C++ -*-===//
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 <algorithm>
10 #include <set>
11 #include <string>
12 
13 #include "lldb/API/SBFrame.h"
14 
15 #include "lldb/lldb-types.h"
16 
18 #include "SBReproducerPrivate.h"
19 #include "Utils.h"
20 #include "lldb/Core/Address.h"
21 #include "lldb/Core/StreamFile.h"
25 #include "lldb/Host/Host.h"
26 #include "lldb/Symbol/Block.h"
27 #include "lldb/Symbol/Function.h"
28 #include "lldb/Symbol/Symbol.h"
30 #include "lldb/Symbol/Variable.h"
33 #include "lldb/Target/Process.h"
35 #include "lldb/Target/StackFrame.h"
37 #include "lldb/Target/StackID.h"
38 #include "lldb/Target/Target.h"
39 #include "lldb/Target/Thread.h"
41 #include "lldb/Utility/Stream.h"
42 
43 #include "lldb/API/SBAddress.h"
44 #include "lldb/API/SBDebugger.h"
46 #include "lldb/API/SBStream.h"
48 #include "lldb/API/SBThread.h"
49 #include "lldb/API/SBValue.h"
51 
52 #include "llvm/Support/PrettyStackTrace.h"
53 
54 using namespace lldb;
55 using namespace lldb_private;
56 
57 SBFrame::SBFrame() : m_opaque_sp(new ExecutionContextRef()) {
59 }
60 
61 SBFrame::SBFrame(const StackFrameSP &lldb_object_sp)
62  : m_opaque_sp(new ExecutionContextRef(lldb_object_sp)) {
63  LLDB_RECORD_CONSTRUCTOR(SBFrame, (const lldb::StackFrameSP &),
64  lldb_object_sp);
65 }
66 
69 
71 }
72 
73 SBFrame::~SBFrame() = default;
74 
75 const SBFrame &SBFrame::operator=(const SBFrame &rhs) {
77  SBFrame, operator=,(const lldb::SBFrame &), rhs);
78 
79  if (this != &rhs)
81  return LLDB_RECORD_RESULT(*this);
82 }
83 
84 StackFrameSP SBFrame::GetFrameSP() const {
85  return (m_opaque_sp ? m_opaque_sp->GetFrameSP() : StackFrameSP());
86 }
87 
88 void SBFrame::SetFrameSP(const StackFrameSP &lldb_object_sp) {
89  return m_opaque_sp->SetFrameSP(lldb_object_sp);
90 }
91 
92 bool SBFrame::IsValid() const {
94  return this->operator bool();
95 }
96 SBFrame::operator bool() const {
97  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBFrame, operator bool);
98 
99  std::unique_lock<std::recursive_mutex> lock;
100  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
101 
102  Target *target = exe_ctx.GetTargetPtr();
103  Process *process = exe_ctx.GetProcessPtr();
104  if (target && process) {
105  Process::StopLocker stop_locker;
106  if (stop_locker.TryLock(&process->GetRunLock()))
107  return GetFrameSP().get() != nullptr;
108  }
109 
110  // Without a target & process we can't have a valid stack frame.
111  return false;
112 }
113 
116  (uint32_t), resolve_scope);
117 
118  SBSymbolContext sb_sym_ctx;
119  std::unique_lock<std::recursive_mutex> lock;
120  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
121  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
122  StackFrame *frame = nullptr;
123  Target *target = exe_ctx.GetTargetPtr();
124  Process *process = exe_ctx.GetProcessPtr();
125  if (target && process) {
126  Process::StopLocker stop_locker;
127  if (stop_locker.TryLock(&process->GetRunLock())) {
128  frame = exe_ctx.GetFramePtr();
129  if (frame)
130  sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(scope));
131  }
132  }
133 
134  return LLDB_RECORD_RESULT(sb_sym_ctx);
135 }
136 
139 
140  SBModule sb_module;
141  ModuleSP module_sp;
142  std::unique_lock<std::recursive_mutex> lock;
143  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
144 
145  StackFrame *frame = nullptr;
146  Target *target = exe_ctx.GetTargetPtr();
147  Process *process = exe_ctx.GetProcessPtr();
148  if (target && process) {
149  Process::StopLocker stop_locker;
150  if (stop_locker.TryLock(&process->GetRunLock())) {
151  frame = exe_ctx.GetFramePtr();
152  if (frame) {
153  module_sp = frame->GetSymbolContext(eSymbolContextModule).module_sp;
154  sb_module.SetSP(module_sp);
155  }
156  }
157  }
158 
159  return LLDB_RECORD_RESULT(sb_module);
160 }
161 
165 
166  SBCompileUnit sb_comp_unit;
167  std::unique_lock<std::recursive_mutex> lock;
168  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
169 
170  StackFrame *frame = nullptr;
171  Target *target = exe_ctx.GetTargetPtr();
172  Process *process = exe_ctx.GetProcessPtr();
173  if (target && process) {
174  Process::StopLocker stop_locker;
175  if (stop_locker.TryLock(&process->GetRunLock())) {
176  frame = exe_ctx.GetFramePtr();
177  if (frame) {
178  sb_comp_unit.reset(
179  frame->GetSymbolContext(eSymbolContextCompUnit).comp_unit);
180  }
181  }
182  }
183 
184  return LLDB_RECORD_RESULT(sb_comp_unit);
185 }
186 
189 
190  SBFunction sb_function;
191  std::unique_lock<std::recursive_mutex> lock;
192  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
193 
194  StackFrame *frame = nullptr;
195  Target *target = exe_ctx.GetTargetPtr();
196  Process *process = exe_ctx.GetProcessPtr();
197  if (target && process) {
198  Process::StopLocker stop_locker;
199  if (stop_locker.TryLock(&process->GetRunLock())) {
200  frame = exe_ctx.GetFramePtr();
201  if (frame) {
202  sb_function.reset(
203  frame->GetSymbolContext(eSymbolContextFunction).function);
204  }
205  }
206  }
207 
208  return LLDB_RECORD_RESULT(sb_function);
209 }
210 
213 
214  SBSymbol sb_symbol;
215  std::unique_lock<std::recursive_mutex> lock;
216  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
217 
218  StackFrame *frame = nullptr;
219  Target *target = exe_ctx.GetTargetPtr();
220  Process *process = exe_ctx.GetProcessPtr();
221  if (target && process) {
222  Process::StopLocker stop_locker;
223  if (stop_locker.TryLock(&process->GetRunLock())) {
224  frame = exe_ctx.GetFramePtr();
225  if (frame) {
226  sb_symbol.reset(frame->GetSymbolContext(eSymbolContextSymbol).symbol);
227  }
228  }
229  }
230 
231  return LLDB_RECORD_RESULT(sb_symbol);
232 }
233 
236 
237  SBBlock sb_block;
238  std::unique_lock<std::recursive_mutex> lock;
239  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
240 
241  StackFrame *frame = nullptr;
242  Target *target = exe_ctx.GetTargetPtr();
243  Process *process = exe_ctx.GetProcessPtr();
244  if (target && process) {
245  Process::StopLocker stop_locker;
246  if (stop_locker.TryLock(&process->GetRunLock())) {
247  frame = exe_ctx.GetFramePtr();
248  if (frame)
249  sb_block.SetPtr(frame->GetSymbolContext(eSymbolContextBlock).block);
250  }
251  }
252  return LLDB_RECORD_RESULT(sb_block);
253 }
254 
257 
258  SBBlock sb_block;
259  std::unique_lock<std::recursive_mutex> lock;
260  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
261 
262  StackFrame *frame = nullptr;
263  Target *target = exe_ctx.GetTargetPtr();
264  Process *process = exe_ctx.GetProcessPtr();
265  if (target && process) {
266  Process::StopLocker stop_locker;
267  if (stop_locker.TryLock(&process->GetRunLock())) {
268  frame = exe_ctx.GetFramePtr();
269  if (frame)
270  sb_block.SetPtr(frame->GetFrameBlock());
271  }
272  }
273  return LLDB_RECORD_RESULT(sb_block);
274 }
275 
278 
279  SBLineEntry sb_line_entry;
280  std::unique_lock<std::recursive_mutex> lock;
281  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
282 
283  StackFrame *frame = nullptr;
284  Target *target = exe_ctx.GetTargetPtr();
285  Process *process = exe_ctx.GetProcessPtr();
286  if (target && process) {
287  Process::StopLocker stop_locker;
288  if (stop_locker.TryLock(&process->GetRunLock())) {
289  frame = exe_ctx.GetFramePtr();
290  if (frame) {
291  sb_line_entry.SetLineEntry(
292  frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
293  }
294  }
295  }
296  return LLDB_RECORD_RESULT(sb_line_entry);
297 }
298 
301 
302  uint32_t frame_idx = UINT32_MAX;
303 
304  std::unique_lock<std::recursive_mutex> lock;
305  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
306 
307  StackFrame *frame = exe_ctx.GetFramePtr();
308  if (frame)
309  frame_idx = frame->GetFrameIndex();
310 
311  return frame_idx;
312 }
313 
316 
317  std::unique_lock<std::recursive_mutex> lock;
318  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
319 
320  StackFrame *frame = exe_ctx.GetFramePtr();
321  if (frame)
322  return frame->GetStackID().GetCallFrameAddress();
323  return LLDB_INVALID_ADDRESS;
324 }
325 
328 
330  std::unique_lock<std::recursive_mutex> lock;
331  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
332 
333  StackFrame *frame = nullptr;
334  Target *target = exe_ctx.GetTargetPtr();
335  Process *process = exe_ctx.GetProcessPtr();
336  if (target && process) {
337  Process::StopLocker stop_locker;
338  if (stop_locker.TryLock(&process->GetRunLock())) {
339  frame = exe_ctx.GetFramePtr();
340  if (frame) {
341  addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress(
342  target, AddressClass::eCode);
343  }
344  }
345  }
346 
347  return addr;
348 }
349 
350 bool SBFrame::SetPC(addr_t new_pc) {
351  LLDB_RECORD_METHOD(bool, SBFrame, SetPC, (lldb::addr_t), new_pc);
352 
353  bool ret_val = false;
354  std::unique_lock<std::recursive_mutex> lock;
355  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
356 
357  StackFrame *frame = nullptr;
358  Target *target = exe_ctx.GetTargetPtr();
359  Process *process = exe_ctx.GetProcessPtr();
360  if (target && process) {
361  Process::StopLocker stop_locker;
362  if (stop_locker.TryLock(&process->GetRunLock())) {
363  frame = exe_ctx.GetFramePtr();
364  if (frame) {
365  ret_val = frame->GetRegisterContext()->SetPC(new_pc);
366  }
367  }
368  }
369 
370  return ret_val;
371 }
372 
375 
377  std::unique_lock<std::recursive_mutex> lock;
378  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
379 
380  StackFrame *frame = nullptr;
381  Target *target = exe_ctx.GetTargetPtr();
382  Process *process = exe_ctx.GetProcessPtr();
383  if (target && process) {
384  Process::StopLocker stop_locker;
385  if (stop_locker.TryLock(&process->GetRunLock())) {
386  frame = exe_ctx.GetFramePtr();
387  if (frame) {
388  addr = frame->GetRegisterContext()->GetSP();
389  }
390  }
391  }
392 
393  return addr;
394 }
395 
398 
400  std::unique_lock<std::recursive_mutex> lock;
401  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
402 
403  StackFrame *frame = nullptr;
404  Target *target = exe_ctx.GetTargetPtr();
405  Process *process = exe_ctx.GetProcessPtr();
406  if (target && process) {
407  Process::StopLocker stop_locker;
408  if (stop_locker.TryLock(&process->GetRunLock())) {
409  frame = exe_ctx.GetFramePtr();
410  if (frame)
411  addr = frame->GetRegisterContext()->GetFP();
412  }
413  }
414 
415  return addr;
416 }
417 
420 
421  SBAddress sb_addr;
422  std::unique_lock<std::recursive_mutex> lock;
423  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
424 
425  StackFrame *frame = exe_ctx.GetFramePtr();
426  Target *target = exe_ctx.GetTargetPtr();
427  Process *process = exe_ctx.GetProcessPtr();
428  if (target && process) {
429  Process::StopLocker stop_locker;
430  if (stop_locker.TryLock(&process->GetRunLock())) {
431  frame = exe_ctx.GetFramePtr();
432  if (frame)
433  sb_addr.SetAddress(&frame->GetFrameCodeAddress());
434  }
435  }
436  return LLDB_RECORD_RESULT(sb_addr);
437 }
438 
441 
442  m_opaque_sp->Clear();
443 }
444 
447  (const char *), var_path);
448 
449  SBValue sb_value;
450  std::unique_lock<std::recursive_mutex> lock;
451  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
452 
453  StackFrame *frame = exe_ctx.GetFramePtr();
454  Target *target = exe_ctx.GetTargetPtr();
455  if (frame && target) {
456  lldb::DynamicValueType use_dynamic =
457  frame->CalculateTarget()->GetPreferDynamicValue();
458  sb_value = GetValueForVariablePath(var_path, use_dynamic);
459  }
460  return LLDB_RECORD_RESULT(sb_value);
461 }
462 
464  DynamicValueType use_dynamic) {
466  (const char *, lldb::DynamicValueType), var_path,
467  use_dynamic);
468 
469  SBValue sb_value;
470  if (var_path == nullptr || var_path[0] == '\0') {
471  return LLDB_RECORD_RESULT(sb_value);
472  }
473 
474  std::unique_lock<std::recursive_mutex> lock;
475  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
476 
477  StackFrame *frame = nullptr;
478  Target *target = exe_ctx.GetTargetPtr();
479  Process *process = exe_ctx.GetProcessPtr();
480  if (target && process) {
481  Process::StopLocker stop_locker;
482  if (stop_locker.TryLock(&process->GetRunLock())) {
483  frame = exe_ctx.GetFramePtr();
484  if (frame) {
485  VariableSP var_sp;
486  Status error;
487  ValueObjectSP value_sp(frame->GetValueForVariableExpressionPath(
488  var_path, eNoDynamicValues,
489  StackFrame::eExpressionPathOptionCheckPtrVsMember |
490  StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,
491  var_sp, error));
492  sb_value.SetSP(value_sp, use_dynamic);
493  }
494  }
495  }
496  return LLDB_RECORD_RESULT(sb_value);
497 }
498 
499 SBValue SBFrame::FindVariable(const char *name) {
501  name);
502 
503  SBValue value;
504  std::unique_lock<std::recursive_mutex> lock;
505  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
506 
507  StackFrame *frame = exe_ctx.GetFramePtr();
508  Target *target = exe_ctx.GetTargetPtr();
509  if (frame && target) {
510  lldb::DynamicValueType use_dynamic =
511  frame->CalculateTarget()->GetPreferDynamicValue();
512  value = FindVariable(name, use_dynamic);
513  }
514  return LLDB_RECORD_RESULT(value);
515 }
516 
518  lldb::DynamicValueType use_dynamic) {
520  (const char *, lldb::DynamicValueType), name, use_dynamic);
521 
522  VariableSP var_sp;
523  SBValue sb_value;
524 
525  if (name == nullptr || name[0] == '\0') {
526  return LLDB_RECORD_RESULT(sb_value);
527  }
528 
529  ValueObjectSP value_sp;
530  std::unique_lock<std::recursive_mutex> lock;
531  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
532 
533  StackFrame *frame = nullptr;
534  Target *target = exe_ctx.GetTargetPtr();
535  Process *process = exe_ctx.GetProcessPtr();
536  if (target && process) {
537  Process::StopLocker stop_locker;
538  if (stop_locker.TryLock(&process->GetRunLock())) {
539  frame = exe_ctx.GetFramePtr();
540  if (frame) {
541  value_sp = frame->FindVariable(ConstString(name));
542 
543  if (value_sp)
544  sb_value.SetSP(value_sp, use_dynamic);
545  }
546  }
547  }
548 
549  return LLDB_RECORD_RESULT(sb_value);
550 }
551 
552 SBValue SBFrame::FindValue(const char *name, ValueType value_type) {
554  (const char *, lldb::ValueType), name, value_type);
555 
556  SBValue value;
557  std::unique_lock<std::recursive_mutex> lock;
558  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
559 
560  StackFrame *frame = exe_ctx.GetFramePtr();
561  Target *target = exe_ctx.GetTargetPtr();
562  if (frame && target) {
563  lldb::DynamicValueType use_dynamic =
564  frame->CalculateTarget()->GetPreferDynamicValue();
565  value = FindValue(name, value_type, use_dynamic);
566  }
567  return LLDB_RECORD_RESULT(value);
568 }
569 
570 SBValue SBFrame::FindValue(const char *name, ValueType value_type,
571  lldb::DynamicValueType use_dynamic) {
573  (const char *, lldb::ValueType, lldb::DynamicValueType),
574  name, value_type, use_dynamic);
575 
576  SBValue sb_value;
577 
578  if (name == nullptr || name[0] == '\0') {
579  return LLDB_RECORD_RESULT(sb_value);
580  }
581 
582  ValueObjectSP value_sp;
583  std::unique_lock<std::recursive_mutex> lock;
584  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
585 
586  StackFrame *frame = nullptr;
587  Target *target = exe_ctx.GetTargetPtr();
588  Process *process = exe_ctx.GetProcessPtr();
589  if (target && process) {
590  Process::StopLocker stop_locker;
591  if (stop_locker.TryLock(&process->GetRunLock())) {
592  frame = exe_ctx.GetFramePtr();
593  if (frame) {
594  VariableList variable_list;
595 
596  switch (value_type) {
597  case eValueTypeVariableGlobal: // global variable
598  case eValueTypeVariableStatic: // static variable
599  case eValueTypeVariableArgument: // function argument variables
600  case eValueTypeVariableLocal: // function local variables
601  case eValueTypeVariableThreadLocal: // thread local variables
602  {
603  SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
604 
605  const bool can_create = true;
606  const bool get_parent_variables = true;
607  const bool stop_if_block_is_inlined_function = true;
608 
609  if (sc.block)
611  can_create, get_parent_variables,
612  stop_if_block_is_inlined_function,
613  [frame](Variable *v) { return v->IsInScope(frame); },
614  &variable_list);
615  if (value_type == eValueTypeVariableGlobal) {
616  const bool get_file_globals = true;
617  VariableList *frame_vars = frame->GetVariableList(get_file_globals);
618  if (frame_vars)
619  frame_vars->AppendVariablesIfUnique(variable_list);
620  }
621  ConstString const_name(name);
622  VariableSP variable_sp(
623  variable_list.FindVariable(const_name, value_type));
624  if (variable_sp) {
625  value_sp = frame->GetValueObjectForFrameVariable(variable_sp,
627  sb_value.SetSP(value_sp, use_dynamic);
628  }
629  } break;
630 
631  case eValueTypeRegister: // stack frame register value
632  {
633  RegisterContextSP reg_ctx(frame->GetRegisterContext());
634  if (reg_ctx) {
635  const uint32_t num_regs = reg_ctx->GetRegisterCount();
636  for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
637  const RegisterInfo *reg_info =
638  reg_ctx->GetRegisterInfoAtIndex(reg_idx);
639  if (reg_info &&
640  ((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
641  (reg_info->alt_name &&
642  strcasecmp(reg_info->alt_name, name) == 0))) {
643  value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
644  sb_value.SetSP(value_sp);
645  break;
646  }
647  }
648  }
649  } break;
650 
651  case eValueTypeRegisterSet: // A collection of stack frame register
652  // values
653  {
654  RegisterContextSP reg_ctx(frame->GetRegisterContext());
655  if (reg_ctx) {
656  const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
657  for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
658  const RegisterSet *reg_set = reg_ctx->GetRegisterSet(set_idx);
659  if (reg_set &&
660  ((reg_set->name && strcasecmp(reg_set->name, name) == 0) ||
661  (reg_set->short_name &&
662  strcasecmp(reg_set->short_name, name) == 0))) {
663  value_sp =
664  ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx);
665  sb_value.SetSP(value_sp);
666  break;
667  }
668  }
669  }
670  } break;
671 
672  case eValueTypeConstResult: // constant result variables
673  {
674  ConstString const_name(name);
675  ExpressionVariableSP expr_var_sp(
676  target->GetPersistentVariable(const_name));
677  if (expr_var_sp) {
678  value_sp = expr_var_sp->GetValueObject();
679  sb_value.SetSP(value_sp, use_dynamic);
680  }
681  } break;
682 
683  default:
684  break;
685  }
686  }
687  }
688  }
689 
690  return LLDB_RECORD_RESULT(sb_value);
691 }
692 
693 bool SBFrame::IsEqual(const SBFrame &that) const {
695  that);
696 
697  lldb::StackFrameSP this_sp = GetFrameSP();
698  lldb::StackFrameSP that_sp = that.GetFrameSP();
699  return (this_sp && that_sp && this_sp->GetStackID() == that_sp->GetStackID());
700 }
701 
702 bool SBFrame::operator==(const SBFrame &rhs) const {
703  LLDB_RECORD_METHOD_CONST(bool, SBFrame, operator==,(const lldb::SBFrame &),
704  rhs);
705 
706  return IsEqual(rhs);
707 }
708 
709 bool SBFrame::operator!=(const SBFrame &rhs) const {
710  LLDB_RECORD_METHOD_CONST(bool, SBFrame, operator!=,(const lldb::SBFrame &),
711  rhs);
712 
713  return !IsEqual(rhs);
714 }
715 
718 
719  std::unique_lock<std::recursive_mutex> lock;
720  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
721 
722  ThreadSP thread_sp(exe_ctx.GetThreadSP());
723  SBThread sb_thread(thread_sp);
724 
725  return LLDB_RECORD_RESULT(sb_thread);
726 }
727 
728 const char *SBFrame::Disassemble() const {
730 
731  const char *disassembly = nullptr;
732  std::unique_lock<std::recursive_mutex> lock;
733  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
734 
735  StackFrame *frame = nullptr;
736  Target *target = exe_ctx.GetTargetPtr();
737  Process *process = exe_ctx.GetProcessPtr();
738  if (target && process) {
739  Process::StopLocker stop_locker;
740  if (stop_locker.TryLock(&process->GetRunLock())) {
741  frame = exe_ctx.GetFramePtr();
742  if (frame) {
743  disassembly = frame->Disassemble();
744  }
745  }
746  }
747 
748  return disassembly;
749 }
750 
751 SBValueList SBFrame::GetVariables(bool arguments, bool locals, bool statics,
752  bool in_scope_only) {
754  (bool, bool, bool, bool), arguments, locals, statics,
755  in_scope_only);
756 
757  SBValueList value_list;
758  std::unique_lock<std::recursive_mutex> lock;
759  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
760 
761  StackFrame *frame = exe_ctx.GetFramePtr();
762  Target *target = exe_ctx.GetTargetPtr();
763  if (frame && target) {
764  lldb::DynamicValueType use_dynamic =
765  frame->CalculateTarget()->GetPreferDynamicValue();
766  const bool include_runtime_support_values =
767  target ? target->GetDisplayRuntimeSupportValues() : false;
768 
769  SBVariablesOptions options;
770  options.SetIncludeArguments(arguments);
771  options.SetIncludeLocals(locals);
772  options.SetIncludeStatics(statics);
773  options.SetInScopeOnly(in_scope_only);
774  options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
775  options.SetUseDynamic(use_dynamic);
776 
777  value_list = GetVariables(options);
778  }
779  return LLDB_RECORD_RESULT(value_list);
780 }
781 
782 lldb::SBValueList SBFrame::GetVariables(bool arguments, bool locals,
783  bool statics, bool in_scope_only,
784  lldb::DynamicValueType use_dynamic) {
786  (bool, bool, bool, bool, lldb::DynamicValueType),
787  arguments, locals, statics, in_scope_only, use_dynamic);
788 
789  std::unique_lock<std::recursive_mutex> lock;
790  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
791 
792  Target *target = exe_ctx.GetTargetPtr();
793  const bool include_runtime_support_values =
794  target ? target->GetDisplayRuntimeSupportValues() : false;
795  SBVariablesOptions options;
796  options.SetIncludeArguments(arguments);
797  options.SetIncludeLocals(locals);
798  options.SetIncludeStatics(statics);
799  options.SetInScopeOnly(in_scope_only);
800  options.SetIncludeRuntimeSupportValues(include_runtime_support_values);
801  options.SetUseDynamic(use_dynamic);
802  return LLDB_RECORD_RESULT(GetVariables(options));
803 }
804 
807  (const lldb::SBVariablesOptions &), options);
808 
809  SBValueList value_list;
810  std::unique_lock<std::recursive_mutex> lock;
811  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
812 
813  StackFrame *frame = nullptr;
814  Target *target = exe_ctx.GetTargetPtr();
815 
816  const bool statics = options.GetIncludeStatics();
817  const bool arguments = options.GetIncludeArguments();
818  const bool recognized_arguments =
819  options.GetIncludeRecognizedArguments(SBTarget(exe_ctx.GetTargetSP()));
820  const bool locals = options.GetIncludeLocals();
821  const bool in_scope_only = options.GetInScopeOnly();
822  const bool include_runtime_support_values =
824  const lldb::DynamicValueType use_dynamic = options.GetUseDynamic();
825 
826 
827  std::set<VariableSP> variable_set;
828  Process *process = exe_ctx.GetProcessPtr();
829  if (target && process) {
830  Process::StopLocker stop_locker;
831  if (stop_locker.TryLock(&process->GetRunLock())) {
832  frame = exe_ctx.GetFramePtr();
833  if (frame) {
834  size_t i;
835  VariableList *variable_list = nullptr;
836  variable_list = frame->GetVariableList(true);
837  if (variable_list) {
838  const size_t num_variables = variable_list->GetSize();
839  if (num_variables) {
840  for (i = 0; i < num_variables; ++i) {
841  VariableSP variable_sp(variable_list->GetVariableAtIndex(i));
842  if (variable_sp) {
843  bool add_variable = false;
844  switch (variable_sp->GetScope()) {
848  add_variable = statics;
849  break;
850 
852  add_variable = arguments;
853  break;
854 
856  add_variable = locals;
857  break;
858 
859  default:
860  break;
861  }
862  if (add_variable) {
863  // Only add variables once so we don't end up with duplicates
864  if (variable_set.find(variable_sp) == variable_set.end())
865  variable_set.insert(variable_sp);
866  else
867  continue;
868 
869  if (in_scope_only && !variable_sp->IsInScope(frame))
870  continue;
871 
872  ValueObjectSP valobj_sp(frame->GetValueObjectForFrameVariable(
873  variable_sp, eNoDynamicValues));
874 
875  if (!include_runtime_support_values && valobj_sp != nullptr &&
876  valobj_sp->IsRuntimeSupportValue())
877  continue;
878 
879  SBValue value_sb;
880  value_sb.SetSP(valobj_sp, use_dynamic);
881  value_list.Append(value_sb);
882  }
883  }
884  }
885  }
886  }
887  if (recognized_arguments) {
888  auto recognized_frame = frame->GetRecognizedFrame();
889  if (recognized_frame) {
890  ValueObjectListSP recognized_arg_list =
891  recognized_frame->GetRecognizedArguments();
892  if (recognized_arg_list) {
893  for (auto &rec_value_sp : recognized_arg_list->GetObjects()) {
894  SBValue value_sb;
895  value_sb.SetSP(rec_value_sp, use_dynamic);
896  value_list.Append(value_sb);
897  }
898  }
899  }
900  }
901  }
902  }
903  }
904 
905  return LLDB_RECORD_RESULT(value_list);
906 }
907 
910 
911  SBValueList value_list;
912  std::unique_lock<std::recursive_mutex> lock;
913  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
914 
915  StackFrame *frame = nullptr;
916  Target *target = exe_ctx.GetTargetPtr();
917  Process *process = exe_ctx.GetProcessPtr();
918  if (target && process) {
919  Process::StopLocker stop_locker;
920  if (stop_locker.TryLock(&process->GetRunLock())) {
921  frame = exe_ctx.GetFramePtr();
922  if (frame) {
923  RegisterContextSP reg_ctx(frame->GetRegisterContext());
924  if (reg_ctx) {
925  const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
926  for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx) {
927  value_list.Append(
928  ValueObjectRegisterSet::Create(frame, reg_ctx, set_idx));
929  }
930  }
931  }
932  }
933  }
934 
935  return LLDB_RECORD_RESULT(value_list);
936 }
937 
938 SBValue SBFrame::FindRegister(const char *name) {
940  name);
941 
942  SBValue result;
943  ValueObjectSP value_sp;
944  std::unique_lock<std::recursive_mutex> lock;
945  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
946 
947  StackFrame *frame = nullptr;
948  Target *target = exe_ctx.GetTargetPtr();
949  Process *process = exe_ctx.GetProcessPtr();
950  if (target && process) {
951  Process::StopLocker stop_locker;
952  if (stop_locker.TryLock(&process->GetRunLock())) {
953  frame = exe_ctx.GetFramePtr();
954  if (frame) {
955  RegisterContextSP reg_ctx(frame->GetRegisterContext());
956  if (reg_ctx) {
957  const uint32_t num_regs = reg_ctx->GetRegisterCount();
958  for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
959  const RegisterInfo *reg_info =
960  reg_ctx->GetRegisterInfoAtIndex(reg_idx);
961  if (reg_info &&
962  ((reg_info->name && strcasecmp(reg_info->name, name) == 0) ||
963  (reg_info->alt_name &&
964  strcasecmp(reg_info->alt_name, name) == 0))) {
965  value_sp = ValueObjectRegister::Create(frame, reg_ctx, reg_idx);
966  result.SetSP(value_sp);
967  break;
968  }
969  }
970  }
971  }
972  }
973  }
974 
975  return LLDB_RECORD_RESULT(result);
976 }
977 
978 bool SBFrame::GetDescription(SBStream &description) {
980  description);
981 
982  Stream &strm = description.ref();
983 
984  std::unique_lock<std::recursive_mutex> lock;
985  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
986 
987  StackFrame *frame;
988  Target *target = exe_ctx.GetTargetPtr();
989  Process *process = exe_ctx.GetProcessPtr();
990  if (target && process) {
991  Process::StopLocker stop_locker;
992  if (stop_locker.TryLock(&process->GetRunLock())) {
993  frame = exe_ctx.GetFramePtr();
994  if (frame) {
995  frame->DumpUsingSettingsFormat(&strm);
996  }
997  }
998 
999  } else
1000  strm.PutCString("No value");
1001 
1002  return true;
1003 }
1004 
1007  expr);
1008 
1009  SBValue result;
1010  std::unique_lock<std::recursive_mutex> lock;
1011  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1012 
1013  StackFrame *frame = exe_ctx.GetFramePtr();
1014  Target *target = exe_ctx.GetTargetPtr();
1015  if (frame && target) {
1016  SBExpressionOptions options;
1017  lldb::DynamicValueType fetch_dynamic_value =
1018  frame->CalculateTarget()->GetPreferDynamicValue();
1019  options.SetFetchDynamicValue(fetch_dynamic_value);
1020  options.SetUnwindOnError(true);
1021  options.SetIgnoreBreakpoints(true);
1022  if (target->GetLanguage() != eLanguageTypeUnknown)
1023  options.SetLanguage(target->GetLanguage());
1024  else
1025  options.SetLanguage(frame->GetLanguage());
1026  return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
1027  }
1028  return LLDB_RECORD_RESULT(result);
1029 }
1030 
1031 SBValue
1033  lldb::DynamicValueType fetch_dynamic_value) {
1035  (const char *, lldb::DynamicValueType), expr,
1036  fetch_dynamic_value);
1037 
1038  SBExpressionOptions options;
1039  options.SetFetchDynamicValue(fetch_dynamic_value);
1040  options.SetUnwindOnError(true);
1041  options.SetIgnoreBreakpoints(true);
1042  std::unique_lock<std::recursive_mutex> lock;
1043  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1044 
1045  StackFrame *frame = exe_ctx.GetFramePtr();
1046  Target *target = exe_ctx.GetTargetPtr();
1047  if (target && target->GetLanguage() != eLanguageTypeUnknown)
1048  options.SetLanguage(target->GetLanguage());
1049  else if (frame)
1050  options.SetLanguage(frame->GetLanguage());
1051  return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
1052 }
1053 
1055  lldb::DynamicValueType fetch_dynamic_value,
1056  bool unwind_on_error) {
1058  (const char *, lldb::DynamicValueType, bool), expr,
1059  fetch_dynamic_value, unwind_on_error);
1060 
1061  SBExpressionOptions options;
1062  std::unique_lock<std::recursive_mutex> lock;
1063  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1064 
1065  options.SetFetchDynamicValue(fetch_dynamic_value);
1066  options.SetUnwindOnError(unwind_on_error);
1067  options.SetIgnoreBreakpoints(true);
1068  StackFrame *frame = exe_ctx.GetFramePtr();
1069  Target *target = exe_ctx.GetTargetPtr();
1070  if (target && target->GetLanguage() != eLanguageTypeUnknown)
1071  options.SetLanguage(target->GetLanguage());
1072  else if (frame)
1073  options.SetLanguage(frame->GetLanguage());
1074  return LLDB_RECORD_RESULT(EvaluateExpression(expr, options));
1075 }
1076 
1078  const SBExpressionOptions &options) {
1080  (const char *, const lldb::SBExpressionOptions &), expr,
1081  options);
1082 
1084 
1085  SBValue expr_result;
1086 
1087  if (expr == nullptr || expr[0] == '\0') {
1088  return LLDB_RECORD_RESULT(expr_result);
1089  }
1090 
1091  ValueObjectSP expr_value_sp;
1092 
1093  std::unique_lock<std::recursive_mutex> lock;
1094  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1095 
1096 
1097  StackFrame *frame = nullptr;
1098  Target *target = exe_ctx.GetTargetPtr();
1099  Process *process = exe_ctx.GetProcessPtr();
1100 
1101  if (target && process) {
1102  Process::StopLocker stop_locker;
1103  if (stop_locker.TryLock(&process->GetRunLock())) {
1104  frame = exe_ctx.GetFramePtr();
1105  if (frame) {
1106  std::unique_ptr<llvm::PrettyStackTraceFormat> stack_trace;
1107  if (target->GetDisplayExpressionsInCrashlogs()) {
1108  StreamString frame_description;
1109  frame->DumpUsingSettingsFormat(&frame_description);
1110  stack_trace = llvm::make_unique<llvm::PrettyStackTraceFormat>(
1111  "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
1112  "= %u) %s",
1113  expr, options.GetFetchDynamicValue(),
1114  frame_description.GetData());
1115  }
1116 
1117  target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());
1118  expr_result.SetSP(expr_value_sp, options.GetFetchDynamicValue());
1119  }
1120  }
1121  }
1122 
1123  if (expr_log)
1124  expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is "
1125  "%s, summary %s **",
1126  expr_result.GetValue(), expr_result.GetSummary());
1127 
1128  return LLDB_RECORD_RESULT(expr_result);
1129 }
1130 
1133 
1134  return static_cast<const SBFrame *>(this)->IsInlined();
1135 }
1136 
1137 bool SBFrame::IsInlined() const {
1139 
1140  std::unique_lock<std::recursive_mutex> lock;
1141  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1142 
1143  StackFrame *frame = nullptr;
1144  Target *target = exe_ctx.GetTargetPtr();
1145  Process *process = exe_ctx.GetProcessPtr();
1146  if (target && process) {
1147  Process::StopLocker stop_locker;
1148  if (stop_locker.TryLock(&process->GetRunLock())) {
1149  frame = exe_ctx.GetFramePtr();
1150  if (frame) {
1151 
1152  Block *block = frame->GetSymbolContext(eSymbolContextBlock).block;
1153  if (block)
1154  return block->GetContainingInlinedBlock() != nullptr;
1155  }
1156  }
1157  }
1158  return false;
1159 }
1160 
1163 
1164  return static_cast<const SBFrame *>(this)->IsArtificial();
1165 }
1166 
1169 
1170  std::unique_lock<std::recursive_mutex> lock;
1171  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1172 
1173  StackFrame *frame = exe_ctx.GetFramePtr();
1174  if (frame)
1175  return frame->IsArtificial();
1176 
1177  return false;
1178 }
1179 
1182 
1183  return static_cast<const SBFrame *>(this)->GetFunctionName();
1184 }
1185 
1188 
1189  std::unique_lock<std::recursive_mutex> lock;
1190  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1191 
1192  StackFrame *frame = nullptr;
1193  Target *target = exe_ctx.GetTargetPtr();
1194  Process *process = exe_ctx.GetProcessPtr();
1195  if (target && process) {
1196  Process::StopLocker stop_locker;
1197  if (stop_locker.TryLock(&process->GetRunLock())) {
1198  frame = exe_ctx.GetFramePtr();
1199  if (frame) {
1200  return frame->GuessLanguage();
1201  }
1202  }
1203  }
1204  return eLanguageTypeUnknown;
1205 }
1206 
1207 const char *SBFrame::GetFunctionName() const {
1209 
1210  const char *name = nullptr;
1211  std::unique_lock<std::recursive_mutex> lock;
1212  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1213 
1214  StackFrame *frame = nullptr;
1215  Target *target = exe_ctx.GetTargetPtr();
1216  Process *process = exe_ctx.GetProcessPtr();
1217  if (target && process) {
1218  Process::StopLocker stop_locker;
1219  if (stop_locker.TryLock(&process->GetRunLock())) {
1220  frame = exe_ctx.GetFramePtr();
1221  if (frame) {
1222  SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1223  eSymbolContextBlock |
1224  eSymbolContextSymbol));
1225  if (sc.block) {
1226  Block *inlined_block = sc.block->GetContainingInlinedBlock();
1227  if (inlined_block) {
1228  const InlineFunctionInfo *inlined_info =
1229  inlined_block->GetInlinedFunctionInfo();
1230  name =
1231  inlined_info->GetName(sc.function->GetLanguage()).AsCString();
1232  }
1233  }
1234 
1235  if (name == nullptr) {
1236  if (sc.function)
1237  name = sc.function->GetName().GetCString();
1238  }
1239 
1240  if (name == nullptr) {
1241  if (sc.symbol)
1242  name = sc.symbol->GetName().GetCString();
1243  }
1244  }
1245  }
1246  }
1247  return name;
1248 }
1249 
1252 
1253  const char *name = nullptr;
1254 
1255  std::unique_lock<std::recursive_mutex> lock;
1256  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1257 
1258  StackFrame *frame = nullptr;
1259  Target *target = exe_ctx.GetTargetPtr();
1260  Process *process = exe_ctx.GetProcessPtr();
1261  if (target && process) {
1262  Process::StopLocker stop_locker;
1263  if (stop_locker.TryLock(&process->GetRunLock())) {
1264  frame = exe_ctx.GetFramePtr();
1265  if (frame) {
1266  SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
1267  eSymbolContextBlock |
1268  eSymbolContextSymbol));
1269  if (sc.block) {
1270  Block *inlined_block = sc.block->GetContainingInlinedBlock();
1271  if (inlined_block) {
1272  const InlineFunctionInfo *inlined_info =
1273  inlined_block->GetInlinedFunctionInfo();
1274  name = inlined_info->GetDisplayName(sc.function->GetLanguage())
1275  .AsCString();
1276  }
1277  }
1278 
1279  if (name == nullptr) {
1280  if (sc.function)
1281  name = sc.function->GetDisplayName().GetCString();
1282  }
1283 
1284  if (name == nullptr) {
1285  if (sc.symbol)
1286  name = sc.symbol->GetDisplayName().GetCString();
1287  }
1288  }
1289  }
1290  }
1291  return name;
1292 }
1293 
1294 namespace lldb_private {
1295 namespace repro {
1296 
1297 template <>
1300  LLDB_REGISTER_CONSTRUCTOR(SBFrame, (const lldb::StackFrameSP &));
1303  SBFrame, operator=,(const lldb::SBFrame &));
1305  LLDB_REGISTER_METHOD_CONST(bool, SBFrame, operator bool, ());
1307  (uint32_t));
1310  ());
1323  LLDB_REGISTER_METHOD(void, SBFrame, Clear, ());
1325  (const char *));
1327  (const char *, lldb::DynamicValueType));
1330  (const char *, lldb::DynamicValueType));
1332  (const char *, lldb::ValueType));
1335  (const char *, lldb::ValueType, lldb::DynamicValueType));
1338  SBFrame, operator==,(const lldb::SBFrame &));
1340  SBFrame, operator!=,(const lldb::SBFrame &));
1342  LLDB_REGISTER_METHOD_CONST(const char *, SBFrame, Disassemble, ());
1344  (bool, bool, bool, bool));
1346  (bool, bool, bool, bool, lldb::DynamicValueType));
1348  (const lldb::SBVariablesOptions &));
1353  (const char *));
1355  (const char *, lldb::DynamicValueType));
1357  (const char *, lldb::DynamicValueType, bool));
1359  (const char *, const lldb::SBExpressionOptions &));
1364  LLDB_REGISTER_METHOD(const char *, SBFrame, GetFunctionName, ());
1368 }
1369 
1370 }
1371 }
const char * Disassemble() const
Definition: SBFrame.cpp:728
lldb::LanguageType GuessLanguage() const
Definition: SBFrame.cpp:1186
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:61
void RegisterMethods< SBFrame >(Registry &R)
Definition: SBFrame.cpp:1298
The registry contains a unique mapping between functions and their ID.
lldb_private::EvaluateExpressionOptions & ref() const
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
ConstString GetDisplayName(lldb::LanguageType language) const
Definition: Function.cpp:110
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
lldb::SBValue FindRegister(const char *name)
Definition: SBFrame.cpp:938
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
bool IsInScope(StackFrame *frame)
Definition: Variable.cpp:276
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition: SBFrame.cpp:88
bool GetDisplayRuntimeSupportValues() const
Definition: Target.cpp:4071
class LLDB_API SBTarget
Definition: SBDefines.h:72
lldb::addr_t GetCallFrameAddress() const
Definition: StackID.h:35
lldb::ExpressionResults EvaluateExpression(llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, const EvaluateExpressionOptions &options=EvaluateExpressionOptions(), std::string *fixed_expression=nullptr, ValueObject *ctx_obj=nullptr)
Definition: Target.cpp:2375
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const
void SetAddress(lldb::SBSection section, lldb::addr_t offset)
Definition: SBAddress.cpp:95
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const char * GetData() const
Definition: StreamString.h:43
A class that describes a single lexical block.
Definition: Block.h:41
void SetSP(const lldb::ValueObjectSP &sp)
Definition: SBValue.cpp:1117
bool IsArtificial() const
Query whether this frame is artificial (e.g a synthesized result of inferring missing tail call frame...
lldb::ExecutionContextRefSP m_opaque_sp
Definition: SBFrame.h:200
bool GetDisplayExpressionsInCrashlogs() const
Definition: Target.cpp:4028
lldb::SBValue FindValue(const char *name, ValueType value_type)
Find variables, register sets, registers, or persistent variables using the frame as the scope...
Definition: SBFrame.cpp:552
bool operator==(const lldb::SBFrame &rhs) const
Definition: SBFrame.cpp:702
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame&#39;s current pc value.
Definition: StackFrame.cpp:267
lldb::SBAddress GetPCAddress() const
Definition: SBFrame.cpp:418
void SetUseDynamic(lldb::DynamicValueType)
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb::VariableSP GetVariableAtIndex(size_t idx) const
lldb::SBValueList GetRegisters()
Definition: SBFrame.cpp:908
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
bool IsEqual(const lldb::SBFrame &that) const
Definition: SBFrame.cpp:693
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
bool operator!=(const lldb::SBFrame &rhs) const
Definition: SBFrame.cpp:709
LanguageType
Programming language type.
void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr)
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition: Utils.h:17
const char * GetFunctionName()
Get the appropriate function name for this frame.
Definition: SBFrame.cpp:1180
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:57
uint32_t GetFrameID() const
Definition: SBFrame.cpp:299
uint32_t AppendVariables(bool can_create, bool get_parent_variables, bool stop_if_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Appends the variables from this block, and optionally from all parent blocks, to variable_list.
Definition: Block.cpp:432
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
void Clear()
Definition: SBFrame.cpp:439
ConstString GetName(lldb::LanguageType language) const
Definition: Function.cpp:104
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
bool GetDescription(lldb::SBStream &description)
Definition: SBFrame.cpp:978
size_t AppendVariablesIfUnique(VariableList &var_list)
bool IsValid() const
Definition: SBFrame.cpp:92
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Definition: Block.cpp:198
bool IsArtificial()
Definition: SBFrame.cpp:1161
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
lldb::DynamicValueType GetFetchDynamicValue() const
A plug-in interface definition class for debugging a process.
Definition: Process.h:353
const lldb::SBFrame & operator=(const lldb::SBFrame &rhs)
Definition: SBFrame.cpp:75
void SetLanguage(lldb::LanguageType language)
Execution context objects refer to objects in the execution of the program that is being debugged...
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name)
Definition: Target.cpp:2430
lldb::SBValue EvaluateExpression(const char *expr)
The version that doesn&#39;t supply a &#39;use_dynamic&#39; value will use the target&#39;s default.
Definition: SBFrame.cpp:1005
lldb_private::Stream & ref()
Definition: SBStream.cpp:162
const char * GetDisplayFunctionName()
Definition: SBFrame.cpp:1250
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
Definition: Block.h:296
#define LLDB_RECORD_METHOD_CONST(Result, Class, Method, Signature,...)
bool GetIncludeRuntimeSupportValues() const
lldb::SBFunction GetFunction() const
Definition: SBFrame.cpp:187
const char * GetSummary()
Definition: SBValue.cpp:442
lldb::DynamicValueType GetUseDynamic() const
A class that describes information for an inlined function.
Definition: Function.h:122
uint64_t addr_t
Definition: lldb-types.h:83
lldb::StackFrameSP GetFrameSP() const
Definition: SBFrame.cpp:84
A uniqued constant string class.
Definition: ConstString.h:38
Unknown or invalid language value.
lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic)
Definition: SBFrame.cpp:463
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:247
ProcessRunLock & GetRunLock()
Definition: Process.cpp:5576
bool IsInlined()
Return true if this frame represents an inlined function.
Definition: SBFrame.cpp:1131
Definition: SBAddress.h:15
lldb::SBCompileUnit GetCompileUnit() const
Definition: SBFrame.cpp:162
lldb::addr_t GetCFA() const
Definition: SBFrame.cpp:314
void SetIgnoreBreakpoints(bool ignore=true)
lldb::SBLineEntry GetLineEntry() const
Definition: SBFrame.cpp:276
lldb::SBThread GetThread() const
Definition: SBFrame.cpp:716
lldb::SBValue FindVariable(const char *var_name)
The version that doesn&#39;t supply a &#39;use_dynamic&#39; value will use the target&#39;s default.
Definition: SBFrame.cpp:499
lldb::addr_t GetSP() const
Definition: SBFrame.cpp:373
lldb::SBBlock GetBlock() const
Gets the deepest block that contains the frame PC.
Definition: SBFrame.cpp:234
int strcasecmp(const char *s1, const char *s2)
lldb::addr_t GetFP() const
Definition: SBFrame.cpp:396
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
void SetFetchDynamicValue(lldb::DynamicValueType dynamic=lldb::eDynamicCanRunTarget)
#define LIBLLDB_LOG_EXPRESSIONS
Definition: Logging.h:22
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope) const
Definition: SBFrame.cpp:114
lldb::SBModule GetModule() const
Definition: SBFrame.cpp:137
lldb::SBValueList GetVariables(bool arguments, bool locals, bool statics, bool in_scope_only)
The version that doesn&#39;t supply a &#39;use_dynamic&#39; value will use the target&#39;s default.
Definition: SBFrame.cpp:751
void reset(lldb_private::Function *lldb_object_ptr)
Definition: SBFunction.cpp:153
lldb::SBSymbol GetSymbol() const
Definition: SBFrame.cpp:211
Block * block
The Block for a given query.
void Printf(const char *format,...) __attribute__((format(printf
Definition: Log.cpp:113
bool SetPC(lldb::addr_t new_pc)
Definition: SBFrame.cpp:350
lldb::LanguageType GetLanguage()
Query this frame to determine what the default language should be when parsing expressions given the ...
void reset(lldb_private::Symbol *)
Definition: SBSymbol.cpp:154
lldb::LanguageType GetLanguage() const
Definition: Target.cpp:3986
#define LLDB_RECORD_RESULT(Result)
lldb::SBBlock GetFrameBlock() const
Gets the lexical block that defines the stack frame.
Definition: SBFrame.cpp:255
lldb::addr_t GetPC() const
Definition: SBFrame.cpp:326
This base class provides an interface to stack frames.
Definition: StackFrame.h:40
const char * GetValue()
Definition: SBValue.cpp:356
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
void SetUnwindOnError(bool unwind=true)
An error handling class.
Definition: Status.h:44
lldb::TargetSP CalculateTarget() override
Definition: Target.cpp:2145
void Append(const lldb::SBValue &val_obj)