Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ProfilerNativeStackWalker Class Reference
Inheritance diagram for dart::ProfilerNativeStackWalker:
dart::ProfilerStackWalker dart::ValueObject

Public Member Functions

 ProfilerNativeStackWalker (ProfilerCounters *counters, Dart_Port port_id, Sample *sample, SampleBuffer *sample_buffer, uword stack_lower, uword stack_upper, uword pc, uword fp, uword sp, intptr_t skip_count=0)
 
void walk ()
 
- Public Member Functions inherited from dart::ProfilerStackWalker
 ProfilerStackWalker (Dart_Port port_id, Sample *head_sample, SampleBuffer *sample_buffer, intptr_t skip_count=0)
 
bool Append (uword pc, uword fp)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Additional Inherited Members

- Protected Attributes inherited from dart::ProfilerStackWalker
Dart_Port port_id_
 
Samplesample_
 
SampleBuffersample_buffer_
 
intptr_t skip_count_
 
intptr_t frames_skipped_
 
intptr_t frame_index_
 
intptr_t total_frames_
 

Detailed Description

Definition at line 217 of file profiler.cc.

Constructor & Destructor Documentation

◆ ProfilerNativeStackWalker()

dart::ProfilerNativeStackWalker::ProfilerNativeStackWalker ( ProfilerCounters counters,
Dart_Port  port_id,
Sample sample,
SampleBuffer sample_buffer,
uword  stack_lower,
uword  stack_upper,
uword  pc,
uword  fp,
uword  sp,
intptr_t  skip_count = 0 
)
inline

Definition at line 219 of file profiler.cc.

229 : ProfilerStackWalker(port_id, sample, sample_buffer, skip_count),
230 counters_(counters),
231 stack_upper_(stack_upper),
232 original_pc_(pc),
233 original_fp_(fp),
234 original_sp_(sp),
235 lower_bound_(stack_lower) {}
ProfilerStackWalker(Dart_Port port_id, Sample *head_sample, SampleBuffer *sample_buffer, intptr_t skip_count=0)
Definition: profiler.cc:126
const uint32_t fp

Member Function Documentation

◆ walk()

void dart::ProfilerNativeStackWalker::walk ( )
inline

Definition at line 237 of file profiler.cc.

237 {
238 Append(original_pc_, original_fp_);
239
240 uword* pc = reinterpret_cast<uword*>(original_pc_);
241 uword* fp = reinterpret_cast<uword*>(original_fp_);
242 uword* previous_fp = fp;
243
244 if (!ValidFramePointer(fp)) {
245 counters_->incomplete_sample_fp_bounds.fetch_add(1);
246 return;
247 }
248
249 while (true) {
250 pc = CallerPC(fp);
251 previous_fp = fp;
252 fp = CallerFP(fp);
253
254 if (fp == nullptr) {
255 return;
256 }
257
258 if (fp <= previous_fp) {
259 // Frame pointer did not move to a higher address.
260 counters_->incomplete_sample_fp_step.fetch_add(1);
261 return;
262 }
263
264 if (!ValidFramePointer(fp)) {
265 // Frame pointer is outside of isolate stack boundary.
266 counters_->incomplete_sample_fp_bounds.fetch_add(1);
267 return;
268 }
269
270 const uword pc_value = reinterpret_cast<uword>(pc);
271 if ((pc_value + 1) < pc_value) {
272 // It is not uncommon to encounter an invalid pc as we
273 // traverse a stack frame. Most of these we can tolerate. If
274 // the pc is so large that adding one to it will cause an
275 // overflow it is invalid and it will cause headaches later
276 // while we are building the profile. Discard it.
277 counters_->incomplete_sample_bad_pc.fetch_add(1);
278 return;
279 }
280
281 // Move the lower bound up.
282 lower_bound_ = reinterpret_cast<uword>(fp);
283
284 if (!Append(pc_value, reinterpret_cast<uword>(fp))) {
285 return;
286 }
287 }
288 }
bool Append(uword pc, uword fp)
Definition: profiler.cc:145
uintptr_t uword
Definition: globals.h:501

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