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

Side by Side Diff: runtime/vm/disassembler.h

Issue 12431016: Copies Simulator Debugger from ARM to MIPS. (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
OLDNEW
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 #ifndef VM_DISASSEMBLER_H_ 5 #ifndef VM_DISASSEMBLER_H_
6 #define VM_DISASSEMBLER_H_ 6 #define VM_DISASSEMBLER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 DISALLOW_ALLOCATION() 52 DISALLOW_ALLOCATION()
53 DISALLOW_COPY_AND_ASSIGN(DisassembleToStdout); 53 DISALLOW_COPY_AND_ASSIGN(DisassembleToStdout);
54 }; 54 };
55 55
56 56
57 // Disassemble instructions. 57 // Disassemble instructions.
58 class Disassembler : public AllStatic { 58 class Disassembler : public AllStatic {
59 public: 59 public:
60 // Disassemble instructions between start and end. 60 // Disassemble instructions between start and end.
61 // (The assumption is that start is at a valid instruction). 61 // (The assumption is that start is at a valid instruction).
62 static void Disassemble(uword start, 62 // Return true if all instructions were successfully decoded, false otherwise.
63 static bool Disassemble(uword start,
63 uword end, 64 uword end,
64 DisassemblyFormatter* formatter, 65 DisassemblyFormatter* formatter,
65 const Code::Comments& comments); 66 const Code::Comments& comments);
66 67
67 static void Disassemble(uword start, 68 static bool Disassemble(uword start,
68 uword end, 69 uword end,
69 DisassemblyFormatter* formatter) { 70 DisassemblyFormatter* formatter) {
70 Disassemble(start, end, formatter, Code::Comments::New(0)); 71 return Disassemble(start, end, formatter, Code::Comments::New(0));
71 } 72 }
72 73
73 static void Disassemble(uword start, 74 static bool Disassemble(uword start,
74 uword end, 75 uword end,
75 const Code::Comments& comments) { 76 const Code::Comments& comments) {
76 DisassembleToStdout stdout_formatter; 77 DisassembleToStdout stdout_formatter;
77 Disassemble(start, end, &stdout_formatter, comments); 78 return Disassemble(start, end, &stdout_formatter, comments);
78 } 79 }
79 80
80 static void Disassemble(uword start, uword end) { 81 static bool Disassemble(uword start, uword end) {
81 DisassembleToStdout stdout_formatter; 82 DisassembleToStdout stdout_formatter;
82 Disassemble(start, end, &stdout_formatter); 83 return Disassemble(start, end, &stdout_formatter);
83 } 84 }
84 85
85 // Disassemble instructions in a memory region. 86 // Disassemble instructions in a memory region.
86 static void DisassembleMemoryRegion(const MemoryRegion& instructions, 87 static bool DisassembleMemoryRegion(const MemoryRegion& instructions,
87 DisassemblyFormatter* formatter) { 88 DisassemblyFormatter* formatter) {
88 uword start = instructions.start(); 89 uword start = instructions.start();
89 uword end = instructions.end(); 90 uword end = instructions.end();
90 Disassemble(start, end, formatter); 91 return Disassemble(start, end, formatter);
91 } 92 }
92 93
93 static void DisassembleMemoryRegion(const MemoryRegion& instructions) { 94 static bool DisassembleMemoryRegion(const MemoryRegion& instructions) {
94 uword start = instructions.start(); 95 uword start = instructions.start();
95 uword end = instructions.end(); 96 uword end = instructions.end();
96 Disassemble(start, end); 97 return Disassemble(start, end);
97 } 98 }
98 99
99 // Decodes one instruction. 100 // Decodes one instruction.
100 // Writes a hexadecimal representation into the hex_buffer and a 101 // Writes a hexadecimal representation into the hex_buffer and a
101 // human-readable representation into the human_buffer. 102 // human-readable representation into the human_buffer.
102 // Returns the length of the decoded instruction in bytes. 103 // Writes the length of the decoded instruction in bytes in out_instr_len.
103 static int DecodeInstruction(char* hex_buffer, intptr_t hex_size, 104 // Returns false if the instruction could not be decoded.
104 char* human_buffer, intptr_t human_size, 105 static bool DecodeInstruction(char* hex_buffer, intptr_t hex_size,
105 uword pc); 106 char* human_buffer, intptr_t human_size,
107 int *out_instr_len, uword pc);
106 108
107 private: 109 private:
108 static const int kHexadecimalBufferSize = 32; 110 static const int kHexadecimalBufferSize = 32;
109 static const int kUserReadableBufferSize = 256; 111 static const int kUserReadableBufferSize = 256;
110 }; 112 };
111 113
112 } // namespace dart 114 } // namespace dart
113 115
114 #endif // VM_DISASSEMBLER_H_ 116 #endif // VM_DISASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698