class StackVisitor { public: // This enum defines a flag to control whether inlined frames are included // when walking the stack. enumclass StackWalkKind {
kIncludeInlinedFrames,
kSkipInlinedFrames,
};
// Sets this stack frame's method pointer. This requires a full lock of the MutatorLock. This // doesn't work with inlined methods.
EXPORT void SetMethod(ArtMethod* method) REQUIRES(Locks::mutator_lock_);
// Returns a vector of the inlined dex pcs, in order from outermost to innermost but it replaces // the innermost one with `handler_dex_pc`. In essence, (outermost dex pc, mid dex pc #1, ..., mid // dex pc #n-1, `handler_dex_pc`).
std::vector<uint32_t> ComputeDexPcList(uint32_t handler_dex_pc) const
REQUIRES_SHARED(Locks::mutator_lock_);
// Returns the height of the stack in the managed stack frames, including transitions.
size_t GetFrameHeight() REQUIRES_SHARED(Locks::mutator_lock_) { return GetNumFrames() - cur_depth_ - 1;
}
// Returns a frame ID for JDWP use, starting from 1.
size_t GetFrameId() REQUIRES_SHARED(Locks::mutator_lock_) { return GetFrameHeight() + 1;
}
// Get the method and dex pc immediately after the one that's currently being visited. bool GetNextMethodAndDexPc(ArtMethod** next_method, uint32_t* next_dex_pc)
REQUIRES_SHARED(Locks::mutator_lock_);
// Values will be set in debugger shadow frames. Debugger will make sure deoptimization // is triggered to make the values effective.
EXPORT bool SetVReg(ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind)
REQUIRES_SHARED(Locks::mutator_lock_);
// Values will be set in debugger shadow frames. Debugger will make sure deoptimization // is triggered to make the values effective.
EXPORT bool SetVRegReference(ArtMethod* m, uint16_t vreg, ObjPtr<mirror::Object> new_value)
REQUIRES_SHARED(Locks::mutator_lock_);
// Values will be set in debugger shadow frames. Debugger will make sure deoptimization // is triggered to make the values effective.
EXPORT bool SetVRegPair(ArtMethod* m,
uint16_t vreg,
uint64_t new_value,
VRegKind kind_lo,
VRegKind kind_hi) REQUIRES_SHARED(Locks::mutator_lock_);
// Return the number of dex register in the map from the outermost frame to the number of inlined // frames indicated by `depth`. If `depth` is 0, grab just the registers from the outermost level. // If it is greater than 0, grab as many inline frames as `depth` indicates.
size_t GetNumberOfRegisters(CodeInfo* code_info, int depth) const;
private: // Private constructor known in the case that num_frames_ has already been computed.
EXPORT StackVisitor(Thread* thread,
Context* context,
StackWalkKind walk_kind,
size_t num_frames, bool check_suspended = true) REQUIRES_SHARED(Locks::mutator_lock_);
Thread* const thread_; const StackWalkKind walk_kind_;
ShadowFrame* cur_shadow_frame_;
ArtMethod** cur_quick_frame_;
uintptr_t cur_quick_frame_pc_; const OatQuickMethodHeader* cur_oat_quick_method_header_; // Lazily computed, number of frames in the stack.
size_t num_frames_; // Depth of the frame we're currently at.
size_t cur_depth_; // Current inlined frames of the method we are currently at. // We keep poping frames from the end as we visit the frames.
BitTableRange<InlineInfo> current_inline_frames_;
// Cache the most recently decoded inline info data. // The 'current_inline_frames_' refers to this data, so we need to keep it alive anyway. // Marked mutable since the cache fields are updated from const getters. mutable std::pair<const OatQuickMethodHeader*, CodeInfo> cur_inline_info_; mutable std::pair<uintptr_t, StackMap> cur_stack_map_;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.