Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: runtime/vm/disassembler_ia32.cc

Issue 12903006: Drops into Simulator Debugger only in a session that is already interactive. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/disassembler_arm.cc ('k') | runtime/vm/disassembler_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 } 1737 }
1738 } 1738 }
1739 1739
1740 int instr_len = data - reinterpret_cast<uint8_t*>(pc); 1740 int instr_len = data - reinterpret_cast<uint8_t*>(pc);
1741 ASSERT(instr_len > 0); // Ensure progress. 1741 ASSERT(instr_len > 0); // Ensure progress.
1742 1742
1743 return instr_len; 1743 return instr_len;
1744 } 1744 }
1745 1745
1746 1746
1747 bool Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size, 1747 void Disassembler::DecodeInstruction(char* hex_buffer, intptr_t hex_size,
1748 char* human_buffer, intptr_t human_size, 1748 char* human_buffer, intptr_t human_size,
1749 int* out_instr_len, uword pc) { 1749 int* out_instr_len, uword pc) {
1750 ASSERT(hex_size > 0); 1750 ASSERT(hex_size > 0);
1751 ASSERT(human_size > 0); 1751 ASSERT(human_size > 0);
1752 X86Decoder decoder(human_buffer, human_size); 1752 X86Decoder decoder(human_buffer, human_size);
1753 int instruction_length = decoder.InstructionDecode(pc); 1753 int instruction_length = decoder.InstructionDecode(pc);
1754 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); 1754 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
1755 int hex_index = 0; 1755 int hex_index = 0;
1756 int remaining_size = hex_size - hex_index; 1756 int remaining_size = hex_size - hex_index;
1757 for (int i = 0; (i < instruction_length) && (remaining_size > 2); ++i) { 1757 for (int i = 0; (i < instruction_length) && (remaining_size > 2); ++i) {
1758 OS::SNPrint(&hex_buffer[hex_index], remaining_size, "%02x", pc_ptr[i]); 1758 OS::SNPrint(&hex_buffer[hex_index], remaining_size, "%02x", pc_ptr[i]);
1759 hex_index += 2; 1759 hex_index += 2;
1760 remaining_size -= 2; 1760 remaining_size -= 2;
1761 } 1761 }
1762 hex_buffer[hex_index] = '\0'; 1762 hex_buffer[hex_index] = '\0';
1763 if (out_instr_len) { 1763 if (out_instr_len) {
1764 *out_instr_len = instruction_length; 1764 *out_instr_len = instruction_length;
1765 } 1765 }
1766 return true;
1767 } 1766 }
1768 1767
1769 1768
1770 bool Disassembler::Disassemble(uword start, 1769 void Disassembler::Disassemble(uword start,
1771 uword end, 1770 uword end,
1772 DisassemblyFormatter* formatter, 1771 DisassemblyFormatter* formatter,
1773 const Code::Comments& comments) { 1772 const Code::Comments& comments) {
1774 ASSERT(formatter != NULL); 1773 ASSERT(formatter != NULL);
1775 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form. 1774 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form.
1776 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction. 1775 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction.
1777 uword pc = start; 1776 uword pc = start;
1778 intptr_t comment_finger = 0; 1777 intptr_t comment_finger = 0;
1779 while (pc < end) { 1778 while (pc < end) {
1780 const intptr_t offset = pc - start; 1779 const intptr_t offset = pc - start;
(...skipping 11 matching lines...) Expand all
1792 sizeof(human_buffer), 1791 sizeof(human_buffer),
1793 &instruction_length, pc); 1792 &instruction_length, pc);
1794 formatter->ConsumeInstruction(hex_buffer, 1793 formatter->ConsumeInstruction(hex_buffer,
1795 sizeof(hex_buffer), 1794 sizeof(hex_buffer),
1796 human_buffer, 1795 human_buffer,
1797 sizeof(human_buffer), 1796 sizeof(human_buffer),
1798 pc); 1797 pc);
1799 pc += instruction_length; 1798 pc += instruction_length;
1800 } 1799 }
1801 1800
1802 return true; 1801 return;
1803 } 1802 }
1804 1803
1805 } // namespace dart 1804 } // namespace dart
1806 1805
1807 #endif // defined TARGET_ARCH_IA32 1806 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_arm.cc ('k') | runtime/vm/disassembler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698