Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Friends | List of all members
dart::ActivationFrame Class Reference

#include <debugger.h>

Inheritance diagram for dart::ActivationFrame:
dart::ZoneAllocated

Public Types

enum  Kind { kRegular , kAsyncSuspensionMarker , kAsyncAwaiter }
 
enum  Relation { kCallee , kSelf , kCaller }
 

Public Member Functions

 ActivationFrame (uword pc, uword fp, uword sp, const Code &code, const Array &deopt_frame, intptr_t deopt_frame_offset)
 
 ActivationFrame (uword pc, const Code &code, const Closure &closure)
 
 ActivationFrame (Kind kind)
 
Kind kind () const
 
uword pc () const
 
uword fp () const
 
uword sp () const
 
uword GetCallerSp () const
 
const Closureclosure () const
 
const Functionfunction () const
 
const Codecode () const
 
Relation CompareTo (uword other_fp) const
 
StringPtr QualifiedFunctionName ()
 
StringPtr SourceUrl ()
 
ScriptPtr SourceScript ()
 
LibraryPtr Library ()
 
TokenPosition TokenPos ()
 
intptr_t LineNumber ()
 
intptr_t ColumnNumber ()
 
bool IsDebuggable () const
 
bool IsRewindable () const
 
intptr_t ContextLevel ()
 
const char * ToCString ()
 
intptr_t NumLocalVariables ()
 
void VariableAt (intptr_t i, String *name, TokenPosition *declaration_token_pos, TokenPosition *visible_start_token_pos, TokenPosition *visible_end_token_pos, Object *value)
 
ArrayPtr GetLocalVariables ()
 
ObjectPtr GetParameter (intptr_t index)
 
ClosurePtr GetClosure ()
 
ObjectPtr GetReceiver ()
 
const ContextGetSavedCurrentContext ()
 
ObjectPtr GetSuspendStateVar ()
 
ObjectPtr GetSuspendableFunctionData ()
 
TypeArgumentsPtr BuildParameters (const GrowableObjectArray &param_names, const GrowableObjectArray &param_values, const GrowableObjectArray &type_params_names, const GrowableObjectArray &type_params_bounds, const GrowableObjectArray &type_params_defaults)
 
ObjectPtr EvaluateCompiledExpression (const ExternalTypedData &kernel_data, const Array &arguments, const Array &type_definitions, const TypeArguments &type_arguments)
 
void PrintToJSONObject (JSONObject *jsobj)
 
bool HandlesException (const Instance &exc_obj)
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Friends

class Debugger
 
class DebuggerStackTrace
 

Detailed Description

Definition at line 282 of file debugger.h.

Member Enumeration Documentation

◆ Kind

Enumerator
kRegular 
kAsyncSuspensionMarker 
kAsyncAwaiter 

Definition at line 284 of file debugger.h.

◆ Relation

Enumerator
kCallee 
kSelf 
kCaller 

Definition at line 324 of file debugger.h.

Constructor & Destructor Documentation

◆ ActivationFrame() [1/3]

dart::ActivationFrame::ActivationFrame ( uword  pc,
uword  fp,
uword  sp,
const Code code,
const Array deopt_frame,
intptr_t  deopt_frame_offset 
)

Definition at line 227 of file debugger.cc.

233 : pc_(pc),
234 fp_(fp),
235 sp_(sp),
236 code_(Code::ZoneHandle(code.ptr())),
237 function_(Function::ZoneHandle(code.function())),
238 closure_(Closure::null_closure()),
239 deopt_frame_(Array::ZoneHandle(deopt_frame.ptr())),
240 deopt_frame_offset_(deopt_frame_offset),
241 kind_(kRegular),
242 desc_indices_(8),
243 pc_desc_(PcDescriptors::ZoneHandle()) {
244 ASSERT(!function_.IsNull());
245}
uword fp() const
Definition: debugger.h:309
uword sp() const
Definition: debugger.h:310
uword pc() const
Definition: debugger.h:308
const Code & code() const
Definition: debugger.h:319
FunctionPtr function() const
Definition: object.h:7130
ObjectPtr ptr() const
Definition: object.h:332
bool IsNull() const
Definition: object.h:363
static Object & ZoneHandle()
Definition: object.h:419
#define ASSERT(E)

◆ ActivationFrame() [2/3]

dart::ActivationFrame::ActivationFrame ( uword  pc,
const Code code,
const Closure closure 
)

Definition at line 247 of file debugger.cc.

250 : pc_(pc),
251 code_(Code::ZoneHandle(code.ptr())),
252 function_(Function::ZoneHandle(code.function())),
253 closure_(Closure::ZoneHandle(closure.ptr())),
254 deopt_frame_(Array::empty_array()),
255 deopt_frame_offset_(0),
256 kind_(kAsyncAwaiter) {}
const Closure & closure() const
Definition: debugger.h:316

◆ ActivationFrame() [3/3]

dart::ActivationFrame::ActivationFrame ( Kind  kind)
explicit

Definition at line 258 of file debugger.cc.

259 : code_(Code::ZoneHandle()),
260 function_(Function::null_function()),
261 closure_(Closure::null_closure()),
262 deopt_frame_(Array::empty_array()),
263 deopt_frame_offset_(0),
264 kind_(kind) {
266}
Kind kind() const
Definition: debugger.h:306

Member Function Documentation

◆ BuildParameters()

TypeArgumentsPtr dart::ActivationFrame::BuildParameters ( const GrowableObjectArray param_names,
const GrowableObjectArray param_values,
const GrowableObjectArray type_params_names,
const GrowableObjectArray type_params_bounds,
const GrowableObjectArray type_params_defaults 
)

Definition at line 1099 of file debugger.cc.

1104 {
1105 GetDescIndices();
1106 bool type_arguments_available = false;
1107 String& name = String::Handle();
1108 String& existing_name = String::Handle();
1109 Object& value = Instance::Handle();
1110 TypeArguments& type_arguments = TypeArguments::Handle();
1111 intptr_t num_variables = desc_indices_.length();
1112 for (intptr_t i = 0; i < num_variables; i++) {
1113 TokenPosition ignore = TokenPosition::kNoSource;
1114 VariableAt(i, &name, &ignore, &ignore, &ignore, &value);
1115 if (name.Equals(Symbols::FunctionTypeArgumentsVar())) {
1116 type_arguments_available = true;
1117 type_arguments ^= value.ptr();
1118 } else if (!name.Equals(Symbols::This()) &&
1120 value.ptr() != Object::optimized_out().ptr()) {
1123 }
1124 bool conflict = false;
1125 for (intptr_t j = 0; j < param_names.Length(); j++) {
1126 existing_name ^= param_names.At(j);
1127 if (name.Equals(existing_name)) {
1128 conflict = true;
1129 break;
1130 }
1131 }
1132 // If local has the same name as a binding in the incoming scope, prefer
1133 // the one from the incoming scope, since it is logically a child scope
1134 // of the activation's current scope.
1135 if (!conflict) {
1136 param_names.Add(name);
1137 param_values.Add(value);
1138 }
1139 }
1140 }
1141
1142 if ((function().IsGeneric() || function().HasGenericParent()) &&
1143 type_arguments_available) {
1144 intptr_t num_vars = function().NumTypeArguments();
1145 type_params_names.Grow(num_vars);
1146 type_params_names.SetLength(num_vars);
1147 type_params_bounds.Grow(num_vars);
1148 type_params_bounds.SetLength(num_vars);
1149 type_params_defaults.Grow(num_vars);
1150 type_params_defaults.SetLength(num_vars);
1151 AbstractType& bound = AbstractType::Handle();
1152 AbstractType& defaultType = AbstractType::Handle();
1153 TypeParameters& type_params = TypeParameters::Handle();
1154 Function& current = Function::Handle(function().ptr());
1155 intptr_t mapping_offset = num_vars;
1156 for (; !current.IsNull(); current = current.parent_function()) {
1157 type_params = current.type_parameters();
1158 if (type_params.IsNull()) continue;
1159 intptr_t size = current.NumTypeParameters();
1160 ASSERT(size > 0 && type_params.Length() == size);
1161 ASSERT(mapping_offset >= size);
1162 mapping_offset -= size;
1163 for (intptr_t j = 0; j < size; ++j) {
1164 name = type_params.NameAt(j);
1165 bound = type_params.BoundAt(j);
1166 defaultType = type_params.DefaultAt(j);
1167 // Write the names in backwards in terms of chain of functions.
1168 // But keep the order of names within the same function. so they
1169 // match up with the order of the types in 'type_arguments'.
1170 // Index:0 1 2 3 ...
1171 // |Names in Grandparent| |Names in Parent| ..|Names in Child|
1172 type_params_names.SetAt(mapping_offset + j, name);
1173 type_params_bounds.SetAt(mapping_offset + j, bound);
1174 type_params_defaults.SetAt(mapping_offset + j, defaultType);
1175 }
1176 }
1177 if (!type_arguments.IsNull()) {
1178 if (type_arguments.Length() == 0) {
1179 for (intptr_t i = 0; i < num_vars; ++i) {
1180 type_arguments.SetTypeAt(i, Object::dynamic_type());
1181 }
1182 }
1183 ASSERT(type_arguments.Length() == num_vars);
1184 }
1185 }
1186
1187 return type_arguments.ptr();
1188}
const Function & function() const
Definition: debugger.h:318
void VariableAt(intptr_t i, String *name, TokenPosition *declaration_token_pos, TokenPosition *visible_start_token_pos, TokenPosition *visible_end_token_pos, Object *value)
Definition: debugger.cc:956
intptr_t length() const
intptr_t NumTypeArguments() const
Definition: object.cc:8853
static Object & Handle()
Definition: object.h:407
static const char * ScrubName(const String &name, bool is_extension=false)
Definition: object.cc:287
static const String & This()
Definition: symbols.h:692
static StringPtr New(Thread *thread, const char *cstr)
Definition: symbols.h:723
static Thread * Current()
Definition: thread.h:362
uint8_t value
static bool IsPrivateVariableName(const String &var_name)
Definition: debugger.cc:1067
const char *const name
static bool IsSyntheticVariableName(const String &var_name)
Definition: debugger.cc:1063
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ closure()

const Closure & dart::ActivationFrame::closure ( ) const
inline

Definition at line 316 of file debugger.h.

316{ return closure_; }

◆ code()

const Code & dart::ActivationFrame::code ( ) const
inline

Definition at line 319 of file debugger.h.

319 {
320 ASSERT(!code_.IsNull());
321 return code_;
322 }

◆ ColumnNumber()

intptr_t dart::ActivationFrame::ColumnNumber ( )

Definition at line 562 of file debugger.cc.

562 {
563 // Compute column number lazily since it causes scanning of the script.
564 const TokenPosition& token_pos = TokenPos();
565 if ((column_number_ < 0) && token_pos.IsReal()) {
566 const Script& script = Script::Handle(SourceScript());
567 script.GetTokenLocation(token_pos, &line_number_, &column_number_);
568 }
569 return column_number_;
570}
ScriptPtr SourceScript()
Definition: debugger.cc:501
TokenPosition TokenPos()
Definition: debugger.cc:519

◆ CompareTo()

ActivationFrame::Relation dart::ActivationFrame::CompareTo ( uword  other_fp) const

Definition at line 485 of file debugger.cc.

485 {
486 if (fp() == other_fp) {
487 return kSelf;
488 }
489 return IsCalleeFrameOf(other_fp, fp()) ? kCallee : kCaller;
490}
static DART_FORCE_INLINE bool IsCalleeFrameOf(uword fp, uword other_fp)
Definition: stack_frame.h:422

◆ ContextLevel()

intptr_t dart::ActivationFrame::ContextLevel ( )

Definition at line 624 of file debugger.cc.

624 {
625 ASSERT(kind_ == kRegular);
626 const Context& ctx = GetSavedCurrentContext();
627 if (context_level_ < 0 && !ctx.IsNull()) {
628 ASSERT(!code_.is_optimized());
629 GetVarDescriptors();
630 intptr_t deopt_id = DeoptId();
631 if (deopt_id == DeoptId::kNone) {
632 PrintDescriptorsError("Missing deopt id");
633 }
634 intptr_t var_desc_len = var_descriptors_.Length();
635 bool found = false;
636 // We store the deopt ids as real token positions.
637 const auto to_compare = TokenPosition::Deserialize(deopt_id);
638 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
639 UntaggedLocalVarDescriptors::VarInfo var_info;
640 var_descriptors_.GetInfo(cur_idx, &var_info);
641 const int8_t kind = var_info.kind();
643 to_compare.IsWithin(var_info.begin_pos, var_info.end_pos)) {
644 context_level_ = var_info.index();
645 found = true;
646 break;
647 }
648 }
649 if (!found) {
650 PrintDescriptorsError("Missing context level in var descriptors");
651 }
652 ASSERT(context_level_ >= 0);
653 }
654 return context_level_;
655}
const Context & GetSavedCurrentContext()
Definition: debugger.cc:700
bool is_optimized() const
Definition: object.h:6817
static constexpr intptr_t kNone
Definition: deopt_id.h:27
intptr_t Length() const
Definition: object.cc:16149
void GetInfo(intptr_t var_index, UntaggedLocalVarDescriptors::VarInfo *info) const
Definition: object.cc:16046
static TokenPosition Deserialize(int32_t value)

◆ EvaluateCompiledExpression()

ObjectPtr dart::ActivationFrame::EvaluateCompiledExpression ( const ExternalTypedData kernel_data,
const Array arguments,
const Array type_definitions,
const TypeArguments type_arguments 
)

Definition at line 1071 of file debugger.cc.

1075 {
1076 auto thread = Thread::Current();
1077 auto zone = thread->zone();
1078
1079 // The expression evaluation function will get all it's captured state passed
1080 // as parameters (with `this` being the exception). As a result, we treat the
1081 // expression evaluation function as either a top-level, static or instance
1082 // method.
1083 const auto& outermost =
1084 Function::Handle(zone, function().GetOutermostFunction());
1085 const auto& klass = Class::Handle(zone, outermost.Owner());
1086 const auto& library = Library::Handle(zone, klass.library());
1087
1088 auto& receiver = Object::Handle(zone);
1089 if (!klass.IsTopLevel() && !outermost.is_static()) {
1090 receiver = GetReceiver();
1091 RELEASE_ASSERT(receiver.IsInstance() ||
1092 receiver.ptr() == Object::optimized_out().ptr());
1093 }
1094 return Instance::EvaluateCompiledExpression(thread, receiver, library, klass,
1095 kernel_buffer, type_definitions,
1096 arguments, type_arguments);
1097}
#define RELEASE_ASSERT(cond)
Definition: assert.h:327
ObjectPtr GetReceiver()
Definition: debugger.cc:1048
ObjectPtr EvaluateCompiledExpression(const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
Definition: object.cc:4833

◆ fp()

uword dart::ActivationFrame::fp ( ) const
inline

Definition at line 309 of file debugger.h.

309{ return fp_; }

◆ function()

const Function & dart::ActivationFrame::function ( ) const
inline

Definition at line 318 of file debugger.h.

318{ return function_; }

◆ GetCallerSp()

uword dart::ActivationFrame::GetCallerSp ( ) const
inline

Definition at line 312 of file debugger.h.

312{ return fp() + (kCallerSpSlotFromFp * kWordSize); }
static constexpr int kCallerSpSlotFromFp
constexpr intptr_t kWordSize
Definition: globals.h:509

◆ GetClosure()

ClosurePtr dart::ActivationFrame::GetClosure ( )

Definition at line 860 of file debugger.cc.

860 {
861 ASSERT(function().IsClosureFunction());
862 Object& param = Object::Handle(GetParameter(0));
863 ASSERT(param.IsInstance());
864 ASSERT(Instance::Cast(param).IsClosure());
865 return Closure::Cast(param).ptr();
866}
ObjectPtr GetParameter(intptr_t index)
Definition: debugger.cc:838

◆ GetLocalVariables()

ArrayPtr dart::ActivationFrame::GetLocalVariables ( )

Definition at line 1033 of file debugger.cc.

1033 {
1034 GetDescIndices();
1035 intptr_t num_variables = desc_indices_.length();
1036 String& var_name = String::Handle();
1037 Object& value = Instance::Handle();
1038 const Array& list = Array::Handle(Array::New(2 * num_variables));
1039 for (intptr_t i = 0; i < num_variables; i++) {
1040 TokenPosition ignore = TokenPosition::kNoSource;
1041 VariableAt(i, &var_name, &ignore, &ignore, &ignore, &value);
1042 list.SetAt(2 * i, var_name);
1043 list.SetAt((2 * i) + 1, value);
1044 }
1045 return list.ptr();
1046}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959

◆ GetParameter()

ObjectPtr dart::ActivationFrame::GetParameter ( intptr_t  index)

Definition at line 838 of file debugger.cc.

838 {
839 intptr_t num_parameters = function().num_fixed_parameters();
840 ASSERT(0 <= index && index < num_parameters);
841
842 // fp will be a nullptr if the frame isn't active on the stack.
843 if (fp() == 0) {
844 return Object::null();
845 }
846
847 if (function().MakesCopyOfParameters()) {
848 // Function parameters are copied to a fixed place in the callee's frame.
849 if (function().IsSuspendableFunction()) {
850 ++index; // Skip slot reserved for :suspend_state variable.
851 }
854 } else {
855 intptr_t reverse_index = num_parameters - index;
856 return GetVariableValue(ParamAddress(fp(), reverse_index));
857 }
858}
intptr_t num_fixed_parameters() const
Definition: object.cc:8856
static ObjectPtr null()
Definition: object.h:433
static DART_FORCE_INLINE uword ParamAddress(uword fp, intptr_t reverse_index)
Definition: stack_frame.h:417
FrameLayout runtime_frame_layout
Definition: stack_frame.cc:81
static DART_FORCE_INLINE ObjectPtr GetVariableValue(uword addr)
Definition: debugger.cc:833
static DART_FORCE_INLINE uword LocalVarAddress(uword fp, intptr_t index)
Definition: stack_frame.h:429
intptr_t FrameSlotForVariableIndex(intptr_t index) const
Definition: stack_frame.cc:89

◆ GetReceiver()

ObjectPtr dart::ActivationFrame::GetReceiver ( )

Definition at line 1048 of file debugger.cc.

1048 {
1049 GetDescIndices();
1050 intptr_t num_variables = desc_indices_.length();
1051 String& var_name = String::Handle();
1052 Instance& value = Instance::Handle();
1053 for (intptr_t i = 0; i < num_variables; i++) {
1054 TokenPosition ignore = TokenPosition::kNoSource;
1055 VariableAt(i, &var_name, &ignore, &ignore, &ignore, &value);
1056 if (var_name.Equals(Symbols::This())) {
1057 return value.ptr();
1058 }
1059 }
1060 return Object::optimized_out().ptr();
1061}

◆ GetSavedCurrentContext()

const Context & dart::ActivationFrame::GetSavedCurrentContext ( )

Definition at line 700 of file debugger.cc.

700 {
701 if (!ctx_.IsNull()) return ctx_;
702 GetVarDescriptors();
703 intptr_t var_desc_len = var_descriptors_.Length();
704 Object& obj = Object::Handle();
705 for (intptr_t i = 0; i < var_desc_len; i++) {
706 UntaggedLocalVarDescriptors::VarInfo var_info;
707 var_descriptors_.GetInfo(i, &var_info);
708 const int8_t kind = var_info.kind();
710 if (FLAG_trace_debugger_stacktrace) {
711 OS::PrintErr("\tFound saved current ctx at index %d\n",
712 var_info.index());
713 }
714 const auto variable_index = VariableIndex(var_info.index());
715 obj = GetStackVar(variable_index);
716 if (obj.IsClosure()) {
717 ASSERT(function().name() == Symbols::call().ptr());
718 ASSERT(function().IsInvokeFieldDispatcher());
719 // Closure.call frames.
720 ctx_ = Closure::Cast(obj).GetContext();
721 } else if (obj.IsContext()) {
722 ctx_ = Context::Cast(obj).ptr();
723 } else {
724 ASSERT(obj.IsNull() || obj.ptr() == Object::optimized_out().ptr());
725 ctx_ = Context::null();
726 }
727 return ctx_;
728 }
729 }
730 return ctx_;
731}
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
def call(args)
Definition: dom.py:159

◆ GetSuspendableFunctionData()

ObjectPtr dart::ActivationFrame::GetSuspendableFunctionData ( )

Definition at line 873 of file debugger.cc.

873 {
874 Object& suspend_state = Object::Handle(GetSuspendStateVar());
875 if (suspend_state.IsSuspendState()) {
876 return SuspendState::Cast(suspend_state).function_data();
877 }
878 return suspend_state.ptr();
879}
ObjectPtr GetSuspendStateVar()
Definition: debugger.cc:868

◆ GetSuspendStateVar()

ObjectPtr dart::ActivationFrame::GetSuspendStateVar ( )

Definition at line 868 of file debugger.cc.

868 {
869 ASSERT(function().IsSuspendableFunction());
870 return GetStackVar(VariableIndex(SuspendState::kSuspendStateVarIndex));
871}
static constexpr intptr_t kSuspendStateVarIndex
Definition: object.h:12617

◆ HandlesException()

bool dart::ActivationFrame::HandlesException ( const Instance exc_obj)

Definition at line 657 of file debugger.cc.

657 {
658 if (kind_ == kAsyncSuspensionMarker) {
659 return false;
660 }
661 intptr_t try_index = TryIndex();
662 const auto& handlers = ExceptionHandlers::Handle(code().exception_handlers());
663 ASSERT(!handlers.IsNull());
664 if ((try_index < 0) && !handlers.has_async_handler()) {
665 return false;
666 }
667 Array& handled_types = Array::Handle();
668 AbstractType& type = Type::Handle();
669 intptr_t num_handlers_checked = 0;
670 while (try_index != kInvalidTryIndex) {
671 // Detect circles in the exception handler data.
672 num_handlers_checked++;
673 ASSERT(num_handlers_checked <= handlers.num_entries());
674 // Only consider user written handlers and ignore synthesized try/catch in
675 // async methods as well as synthetic try/catch hiding inside try/finally.
676 if (!handlers.IsGenerated(try_index)) {
677 handled_types = handlers.GetHandledTypes(try_index);
678 const intptr_t num_types = handled_types.Length();
679 for (intptr_t k = 0; k < num_types; k++) {
680 type ^= handled_types.At(k);
681 ASSERT(!type.IsNull());
682 // Uninstantiated types are not added to ExceptionHandlers data.
683 ASSERT(type.IsInstantiated());
684 if (type.IsDynamicType()) {
685 return true;
686 }
687 if (exc_obj.IsInstanceOf(type, Object::null_type_arguments(),
688 Object::null_type_arguments())) {
689 return true;
690 }
691 }
692 }
693 try_index = handlers.OuterTryIndex(try_index);
694 }
695
696 return false;
697}
GLenum type
static constexpr intptr_t kInvalidTryIndex

◆ IsDebuggable()

bool dart::ActivationFrame::IsDebuggable ( ) const

Definition at line 595 of file debugger.cc.

595 {
596 ASSERT(!function().IsNull());
598}
static bool IsDebuggable(const Function &func)
Definition: debugger.cc:3426
DART_EXPORT bool IsNull(Dart_Handle object)

◆ IsRewindable()

bool dart::ActivationFrame::IsRewindable ( ) const

Definition at line 891 of file debugger.cc.

891 {
892 if (deopt_frame_.IsNull()) {
893 return true;
894 }
895 // TODO(turnidge): This is conservative. It looks at all values in
896 // the deopt_frame_ even though some of them may correspond to other
897 // inlined frames.
898 Object& obj = Object::Handle();
899 for (int i = 0; i < deopt_frame_.Length(); i++) {
900 obj = deopt_frame_.At(i);
901 if (obj.ptr() == Object::optimized_out().ptr()) {
902 return false;
903 }
904 }
905 return true;
906}
ObjectPtr At(intptr_t index) const
Definition: object.h:10875
intptr_t Length() const
Definition: object.h:10829

◆ kind()

Kind dart::ActivationFrame::kind ( ) const
inline

Definition at line 306 of file debugger.h.

306{ return kind_; }

◆ Library()

LibraryPtr dart::ActivationFrame::Library ( )

Definition at line 505 of file debugger.cc.

505 {
506 const Class& cls = Class::Handle(function().Owner());
507 return cls.library();
508}

◆ LineNumber()

intptr_t dart::ActivationFrame::LineNumber ( )

Definition at line 552 of file debugger.cc.

552 {
553 // Compute line number lazily since it causes scanning of the script.
554 const TokenPosition& token_pos = TokenPos();
555 if ((line_number_ < 0) && token_pos.IsReal()) {
556 const Script& script = Script::Handle(SourceScript());
557 script.GetTokenLocation(token_pos, &line_number_, &column_number_);
558 }
559 return line_number_;
560}

◆ NumLocalVariables()

intptr_t dart::ActivationFrame::NumLocalVariables ( )

Definition at line 828 of file debugger.cc.

828 {
829 GetDescIndices();
830 return desc_indices_.length();
831}

◆ pc()

uword dart::ActivationFrame::pc ( ) const
inline

Definition at line 308 of file debugger.h.

308{ return pc_; }

◆ PrintToJSONObject()

void dart::ActivationFrame::PrintToJSONObject ( JSONObject jsobj)

Definition at line 1221 of file debugger.cc.

1221 {
1222 if (kind_ == kRegular) {
1223 PrintToJSONObjectRegular(jsobj);
1224 } else if (kind_ == kAsyncAwaiter) {
1225 PrintToJSONObjectAsyncAwaiter(jsobj);
1226 } else if (kind_ == kAsyncSuspensionMarker) {
1227 PrintToJSONObjectAsyncSuspensionMarker(jsobj);
1228 } else {
1229 UNIMPLEMENTED();
1230 }
1231}
#define UNIMPLEMENTED

◆ QualifiedFunctionName()

StringPtr dart::ActivationFrame::QualifiedFunctionName ( )

Definition at line 492 of file debugger.cc.

492 {
494}
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
static const char * QualifiedFunctionName(const Function &func)
Definition: debugger.cc:366

◆ SourceScript()

ScriptPtr dart::ActivationFrame::SourceScript ( )

Definition at line 501 of file debugger.cc.

501 {
502 return function().script();
503}
ScriptPtr script() const
Definition: object.cc:10881

◆ SourceUrl()

StringPtr dart::ActivationFrame::SourceUrl ( )

Definition at line 496 of file debugger.cc.

496 {
497 const Script& script = Script::Handle(SourceScript());
498 return script.url();
499}

◆ sp()

uword dart::ActivationFrame::sp ( ) const
inline

Definition at line 310 of file debugger.h.

310{ return sp_; }

◆ ToCString()

const char * dart::ActivationFrame::ToCString ( )

Definition at line 1190 of file debugger.cc.

1190 {
1191 if (function().IsNull()) {
1192 return Thread::Current()->zone()->PrintToString("[ Frame kind: %s]\n",
1193 KindToCString(kind_));
1194 }
1195 const String& url = String::Handle(SourceUrl());
1196 intptr_t line = LineNumber();
1197 const char* func_name = function().ToFullyQualifiedCString();
1198 if (kind_ == kRegular) {
1199 return Thread::Current()->zone()->PrintToString(
1200 "[ Frame pc(0x%" Px " code offset:0x%" Px ") fp(0x%" Px ") sp(0x%" Px
1201 ")\n"
1202 "\tfunction = %s\n"
1203 "\turl = %s\n"
1204 "\tline = %" Pd
1205 "\n"
1206 "\tcontext = %s\n"
1207 "\tcontext level = %" Pd " ]\n",
1208 pc(), pc() - code().PayloadStart(), fp(), sp(), func_name,
1209 url.ToCString(), line, ctx_.ToCString(), ContextLevel());
1210 } else {
1211 return Thread::Current()->zone()->PrintToString(
1212 "[ Frame code function = %s\n"
1213 "\turl = %s\n"
1214 "\tline = %" Pd
1215 "\n"
1216 "\tcontext = %s]\n",
1217 func_name, url.ToCString(), line, ctx_.ToCString());
1218 }
1219}
intptr_t LineNumber()
Definition: debugger.cc:552
StringPtr SourceUrl()
Definition: debugger.cc:496
intptr_t ContextLevel()
Definition: debugger.cc:624
const char * ToFullyQualifiedCString() const
Definition: object.cc:9762
virtual const char * ToCString() const
Definition: object.h:366
Zone * zone() const
Definition: thread_state.h:37
char * PrintToString(const char *format,...) PRINTF_ATTRIBUTE(2
Definition: zone.cc:313
#define Px
Definition: globals.h:410
#define Pd
Definition: globals.h:408

◆ TokenPos()

TokenPosition dart::ActivationFrame::TokenPos ( )

Definition at line 519 of file debugger.cc.

519 {
520 if (!token_pos_initialized_) {
521 token_pos_initialized_ = true;
522 token_pos_ = TokenPosition::kNoSource;
523 GetPcDescriptors();
524 PcDescriptors::Iterator iter(pc_desc_, UntaggedPcDescriptors::kAnyKind);
525 const uword pc_offset = pc_ - code().PayloadStart();
526 while (iter.MoveNext()) {
527 if (iter.PcOffset() == pc_offset) {
528 try_index_ = iter.TryIndex();
529 token_pos_ = iter.TokenPos();
530 deopt_id_ = iter.DeoptId();
531 break;
532 }
533 }
534 }
535 return token_pos_;
536}
uword PayloadStart() const
Definition: object.h:6850
uintptr_t uword
Definition: globals.h:501

◆ VariableAt()

void dart::ActivationFrame::VariableAt ( intptr_t  i,
String name,
TokenPosition declaration_token_pos,
TokenPosition visible_start_token_pos,
TokenPosition visible_end_token_pos,
Object value 
)

Definition at line 956 of file debugger.cc.

961 {
962 GetDescIndices();
963 ASSERT(i < desc_indices_.length());
964 intptr_t desc_index = desc_indices_[i];
965 ASSERT(name != nullptr);
966
967 *name = var_descriptors_.GetName(desc_index);
968
969 UntaggedLocalVarDescriptors::VarInfo var_info;
970 var_descriptors_.GetInfo(desc_index, &var_info);
971 ASSERT(declaration_token_pos != nullptr);
972 *declaration_token_pos = var_info.declaration_pos;
973 ASSERT(visible_start_token_pos != nullptr);
974 *visible_start_token_pos = var_info.begin_pos;
975 ASSERT(visible_end_token_pos != nullptr);
976 *visible_end_token_pos = var_info.end_pos;
977 ASSERT(value != nullptr);
978 const int8_t kind = var_info.kind();
979 const auto variable_index = VariableIndex(var_info.index());
981 *value = GetStackVar(variable_index);
982 } else {
984 *value = GetContextVar(var_info.scope_id, variable_index.value());
985 }
986}
StringPtr GetName(intptr_t var_index) const
Definition: object.cc:16030

Friends And Related Function Documentation

◆ Debugger

friend class Debugger
friend

Definition at line 454 of file debugger.h.

◆ DebuggerStackTrace

friend class DebuggerStackTrace
friend

Definition at line 455 of file debugger.h.


The documentation for this class was generated from the following files: