OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/disassembler.h" | 5 #include "vm/disassembler.h" |
6 | 6 |
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
8 #if defined(TARGET_ARCH_IA32) | 8 #if defined(TARGET_ARCH_IA32) |
9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 void X86Decoder::PrintAddress(uword addr) { | 488 void X86Decoder::PrintAddress(uword addr) { |
489 char addr_buffer[32]; | 489 char addr_buffer[32]; |
490 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr); | 490 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr); |
491 Print(addr_buffer); | 491 Print(addr_buffer); |
492 // Try to print as heap object or stub name | 492 // Try to print as heap object or stub name |
493 if (((addr & kSmiTagMask) == kHeapObjectTag) && | 493 if (((addr & kSmiTagMask) == kHeapObjectTag) && |
494 reinterpret_cast<RawObject*>(addr)->IsWellFormed() && | 494 reinterpret_cast<RawObject*>(addr)->IsWellFormed() && |
495 reinterpret_cast<RawObject*>(addr)->IsOldObject() && | 495 reinterpret_cast<RawObject*>(addr)->IsOldObject() && |
496 !Isolate::Current()->heap()->CodeContains(addr) && | 496 !Isolate::Current()->heap()->CodeContains(addr) && |
| 497 !Dart::vm_isolate()->heap()->CodeContains(addr) && |
497 Disassembler::CanFindOldObject(addr)) { | 498 Disassembler::CanFindOldObject(addr)) { |
498 NoSafepointScope no_safepoint; | 499 NoSafepointScope no_safepoint; |
499 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); | 500 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); |
500 if (obj.IsArray()) { | 501 if (obj.IsArray()) { |
501 const Array& arr = Array::Cast(obj); | 502 const Array& arr = Array::Cast(obj); |
502 intptr_t len = arr.Length(); | 503 intptr_t len = arr.Length(); |
503 if (len > 5) len = 5; // Print a max of 5 elements. | 504 if (len > 5) len = 5; // Print a max of 5 elements. |
504 Print(" Array["); | 505 Print(" Array["); |
505 int i = 0; | 506 int i = 0; |
506 Object& element = Object::Handle(); | 507 Object& element = Object::Handle(); |
(...skipping 10 matching lines...) Expand all Loading... |
517 Print(" '"); | 518 Print(" '"); |
518 Print(ObjectToCStringNoGC(obj)); | 519 Print(ObjectToCStringNoGC(obj)); |
519 Print("'"); | 520 Print("'"); |
520 } else { | 521 } else { |
521 // 'addr' is not an object, but probably a code address. | 522 // 'addr' is not an object, but probably a code address. |
522 const char* name_of_stub = StubCode::NameOfStub(addr); | 523 const char* name_of_stub = StubCode::NameOfStub(addr); |
523 if (name_of_stub != NULL) { | 524 if (name_of_stub != NULL) { |
524 Print(" [stub: "); | 525 Print(" [stub: "); |
525 Print(name_of_stub); | 526 Print(name_of_stub); |
526 Print("]"); | 527 Print("]"); |
527 } else { | |
528 // Print only if jumping to entry point. | |
529 const Code& code = Code::Handle(Code::LookupCode(addr)); | |
530 if (!code.IsNull() && (code.EntryPoint() == addr)) { | |
531 const String& name = String::Handle(code.PrettyName()); | |
532 const char* name_c = name.ToCString(); | |
533 Print(" ["); | |
534 Print(name_c); | |
535 Print("]"); | |
536 } | |
537 } | 528 } |
538 } | 529 } |
539 } | 530 } |
540 | 531 |
541 | 532 |
542 int X86Decoder::PrintRightOperandHelper(uint8_t* modrmp, | 533 int X86Decoder::PrintRightOperandHelper(uint8_t* modrmp, |
543 RegisterNamePrinter register_printer) { | 534 RegisterNamePrinter register_printer) { |
544 int mod, regop, rm; | 535 int mod, regop, rm; |
545 GetModRm(*modrmp, &mod, ®op, &rm); | 536 GetModRm(*modrmp, &mod, ®op, &rm); |
546 switch (mod) { | 537 switch (mod) { |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 } | 1858 } |
1868 hex_buffer[hex_index] = '\0'; | 1859 hex_buffer[hex_index] = '\0'; |
1869 if (out_instr_len) { | 1860 if (out_instr_len) { |
1870 *out_instr_len = instruction_length; | 1861 *out_instr_len = instruction_length; |
1871 } | 1862 } |
1872 } | 1863 } |
1873 | 1864 |
1874 } // namespace dart | 1865 } // namespace dart |
1875 | 1866 |
1876 #endif // defined TARGET_ARCH_IA32 | 1867 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |