OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/address_sanitizer.h" | 5 #include "platform/address_sanitizer.h" |
6 #include "platform/memory_sanitizer.h" | 6 #include "platform/memory_sanitizer.h" |
7 #include "platform/utils.h" | 7 #include "platform/utils.h" |
8 | 8 |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 void ClearProfileVisitor::VisitSample(Sample* sample) { | 328 void ClearProfileVisitor::VisitSample(Sample* sample) { |
329 sample->Clear(); | 329 sample->Clear(); |
330 } | 330 } |
331 | 331 |
332 | 332 |
333 static void DumpStackFrame(intptr_t frame_index, uword pc) { | 333 static void DumpStackFrame(intptr_t frame_index, uword pc) { |
334 uintptr_t start = 0; | 334 uintptr_t start = 0; |
335 char* native_symbol_name = | 335 char* native_symbol_name = |
336 NativeSymbolResolver::LookupSymbolName(pc, &start); | 336 NativeSymbolResolver::LookupSymbolName(pc, &start); |
337 if (native_symbol_name != NULL) { | 337 if (native_symbol_name == NULL) { |
338 OS::PrintErr(" %" Pp " [native] %s\n", pc, native_symbol_name); | 338 OS::PrintErr("Frame[%" Pd "] = `unknown symbol` [0x%" Px "]\n", |
| 339 frame_index, pc); |
| 340 } else { |
| 341 OS::PrintErr("Frame[%" Pd "] = `%s` [0x%" Px "]\n", |
| 342 frame_index, native_symbol_name, pc); |
339 NativeSymbolResolver::FreeSymbolName(native_symbol_name); | 343 NativeSymbolResolver::FreeSymbolName(native_symbol_name); |
340 return; | |
341 } | 344 } |
342 | |
343 Code& code = Code::Handle(Code::LookupCodeInVmIsolate(pc)); | |
344 if (code.IsNull()) { | |
345 code = Code::LookupCode(pc); // In current isolate. | |
346 } | |
347 if (code.IsNull()) { | |
348 OS::PrintErr(" %" Pp " [unknown]\n", pc); | |
349 return; | |
350 } | |
351 | |
352 const Object& owner = Object::Handle(code.owner()); | |
353 if (owner.IsFunction()) { | |
354 OS::PrintErr(" %" Pp " [dart] %s\n", pc, | |
355 Function::Cast(owner).ToFullyQualifiedCString()); | |
356 return; | |
357 } | |
358 | |
359 OS::PrintErr(" %" Pp " [stub] %s\n", pc, code.ToCString()); | |
360 } | 345 } |
361 | 346 |
362 | 347 |
363 static void DumpStackFrame(intptr_t frame_index, | 348 static void DumpStackFrame(intptr_t frame_index, |
364 uword pc, | 349 uword pc, |
365 const Code& code) { | 350 const Code& code) { |
366 if (code.IsNull()) { | 351 if (code.IsNull()) { |
367 DumpStackFrame(frame_index, pc); | 352 DumpStackFrame(frame_index, pc); |
368 return; | 353 } else { |
| 354 OS::PrintErr("Frame[%" Pd "] = Dart:`%s` [0x%" Px "]\n", |
| 355 frame_index, code.ToCString(), pc); |
369 } | 356 } |
370 | |
371 const Object& owner = Object::Handle(code.owner()); | |
372 if (owner.IsFunction()) { | |
373 OS::PrintErr(" %" Pp " [dart] %s\n", pc, | |
374 Function::Cast(owner).ToFullyQualifiedCString()); | |
375 return; | |
376 } | |
377 | |
378 OS::PrintErr(" %" Pp " [stub] %s\n", pc, code.ToCString()); | |
379 } | 357 } |
380 | 358 |
381 | 359 |
382 class ProfilerStackWalker : public ValueObject { | 360 class ProfilerStackWalker : public ValueObject { |
383 public: | 361 public: |
384 ProfilerStackWalker(Isolate* isolate, | 362 ProfilerStackWalker(Isolate* isolate, |
385 Sample* head_sample, | 363 Sample* head_sample, |
386 SampleBuffer* sample_buffer) | 364 SampleBuffer* sample_buffer) |
387 : isolate_(isolate), | 365 : isolate_(isolate), |
388 sample_(head_sample), | 366 sample_(head_sample), |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 | 1579 |
1602 | 1580 |
1603 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1581 ProcessedSampleBuffer::ProcessedSampleBuffer() |
1604 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1582 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
1605 ASSERT(code_lookup_table_ != NULL); | 1583 ASSERT(code_lookup_table_ != NULL); |
1606 } | 1584 } |
1607 | 1585 |
1608 #endif // !PRODUCT | 1586 #endif // !PRODUCT |
1609 | 1587 |
1610 } // namespace dart | 1588 } // namespace dart |
OLD | NEW |