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("Frame[%" Pd "] = `unknown symbol` [0x%" Px "]\n", | 338 OS::PrintErr(" %" Pp " [native] %s\n", pc, native_symbol_name); |
339 frame_index, pc); | |
340 } else { | |
341 OS::PrintErr("Frame[%" Pd "] = `%s` [0x%" Px "]\n", | |
342 frame_index, native_symbol_name, pc); | |
343 NativeSymbolResolver::FreeSymbolName(native_symbol_name); | 339 NativeSymbolResolver::FreeSymbolName(native_symbol_name); |
| 340 return; |
344 } | 341 } |
| 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()); |
345 } | 360 } |
346 | 361 |
347 | 362 |
348 static void DumpStackFrame(intptr_t frame_index, | 363 static void DumpStackFrame(intptr_t frame_index, |
349 uword pc, | 364 uword pc, |
350 const Code& code) { | 365 const Code& code) { |
351 if (code.IsNull()) { | 366 if (code.IsNull()) { |
352 DumpStackFrame(frame_index, pc); | 367 DumpStackFrame(frame_index, pc); |
353 } else { | 368 return; |
354 OS::PrintErr("Frame[%" Pd "] = Dart:`%s` [0x%" Px "]\n", | |
355 frame_index, code.ToCString(), pc); | |
356 } | 369 } |
| 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()); |
357 } | 379 } |
358 | 380 |
359 | 381 |
360 class ProfilerStackWalker : public ValueObject { | 382 class ProfilerStackWalker : public ValueObject { |
361 public: | 383 public: |
362 ProfilerStackWalker(Isolate* isolate, | 384 ProfilerStackWalker(Isolate* isolate, |
363 Sample* head_sample, | 385 Sample* head_sample, |
364 SampleBuffer* sample_buffer) | 386 SampleBuffer* sample_buffer) |
365 : isolate_(isolate), | 387 : isolate_(isolate), |
366 sample_(head_sample), | 388 sample_(head_sample), |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 | 1601 |
1580 | 1602 |
1581 ProcessedSampleBuffer::ProcessedSampleBuffer() | 1603 ProcessedSampleBuffer::ProcessedSampleBuffer() |
1582 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { | 1604 : code_lookup_table_(new CodeLookupTable(Thread::Current())) { |
1583 ASSERT(code_lookup_table_ != NULL); | 1605 ASSERT(code_lookup_table_ != NULL); |
1584 } | 1606 } |
1585 | 1607 |
1586 #endif // !PRODUCT | 1608 #endif // !PRODUCT |
1587 | 1609 |
1588 } // namespace dart | 1610 } // namespace dart |
OLD | NEW |