| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/disassembler.h" | 8 #include "vm/disassembler.h" |
| 9 | 9 |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 for (int i = 0; (i < instruction_length) && (remaining_size > 2); ++i) { | 1512 for (int i = 0; (i < instruction_length) && (remaining_size > 2); ++i) { |
| 1513 OS::SNPrint(&hex_buffer[hex_index], remaining_size, "%02x", pc_ptr[i]); | 1513 OS::SNPrint(&hex_buffer[hex_index], remaining_size, "%02x", pc_ptr[i]); |
| 1514 hex_index += 2; | 1514 hex_index += 2; |
| 1515 remaining_size -= 2; | 1515 remaining_size -= 2; |
| 1516 } | 1516 } |
| 1517 hex_buffer[hex_index] = '\0'; | 1517 hex_buffer[hex_index] = '\0'; |
| 1518 return instruction_length; | 1518 return instruction_length; |
| 1519 } | 1519 } |
| 1520 | 1520 |
| 1521 | 1521 |
| 1522 const char* Disassembler::RegisterName(Register reg) { | 1522 void Disassembler::Disassemble(uword start, |
| 1523 ASSERT(0 <= reg); | 1523 uword end, |
| 1524 ASSERT(reg < kMaxCPURegisters); | 1524 DisassemblyFormatter* formatter) { |
| 1525 return (cpu_regs[reg]); | 1525 ASSERT(formatter != NULL); |
| 1526 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form. |
| 1527 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction. |
| 1528 uword pc = start; |
| 1529 while (pc < end) { |
| 1530 int instruction_length = DecodeInstruction(hex_buffer, |
| 1531 sizeof(hex_buffer), |
| 1532 human_buffer, |
| 1533 sizeof(human_buffer), |
| 1534 pc); |
| 1535 formatter->ConsumeInstruction(hex_buffer, |
| 1536 sizeof(hex_buffer), |
| 1537 human_buffer, |
| 1538 sizeof(human_buffer), |
| 1539 pc); |
| 1540 pc += instruction_length; |
| 1541 } |
| 1526 } | 1542 } |
| 1527 | 1543 |
| 1528 } // namespace dart | 1544 } // namespace dart |
| 1529 | 1545 |
| 1530 #endif // defined TARGET_ARCH_IA32 | 1546 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |