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

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

Issue 19870006: Support stacktrace and objecthistogram service commands (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/bin/vmservice_impl.cc ('k') | runtime/vm/disassembler.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) 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"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // Froward declaration. 14 // Froward declaration.
15 class MemoryRegion; 15 class MemoryRegion;
16 class JSONStream;
16 17
17 // Disassembly formatter interface, which consumes the 18 // Disassembly formatter interface, which consumes the
18 // disassembled instructions in any desired form. 19 // disassembled instructions in any desired form.
19 class DisassemblyFormatter { 20 class DisassemblyFormatter {
20 public: 21 public:
21 DisassemblyFormatter() { } 22 DisassemblyFormatter() { }
22 virtual ~DisassemblyFormatter() { } 23 virtual ~DisassemblyFormatter() { }
23 24
24 // Consume the decoded instruction at the given pc. 25 // Consume the decoded instruction at the given pc.
25 virtual void ConsumeInstruction(char* hex_buffer, 26 virtual void ConsumeInstruction(char* hex_buffer,
(...skipping 21 matching lines...) Expand all
47 uword pc); 48 uword pc);
48 49
49 virtual void Print(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); 50 virtual void Print(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
50 51
51 private: 52 private:
52 DISALLOW_ALLOCATION() 53 DISALLOW_ALLOCATION()
53 DISALLOW_COPY_AND_ASSIGN(DisassembleToStdout); 54 DISALLOW_COPY_AND_ASSIGN(DisassembleToStdout);
54 }; 55 };
55 56
56 57
58 // Disassemble into a JSONStream.
59 class DisassembleToJSONStream : public DisassemblyFormatter {
60 public:
61 explicit DisassembleToJSONStream(JSONStream* stream) : DisassemblyFormatter(),
62 stream_(stream) { }
63 ~DisassembleToJSONStream() { }
64
65 virtual void ConsumeInstruction(char* hex_buffer,
66 intptr_t hex_size,
67 char* human_buffer,
68 intptr_t human_size,
69 uword pc);
70
71 virtual void Print(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
72
73 private:
74 JSONStream* stream_;
75 DISALLOW_ALLOCATION();
76 DISALLOW_COPY_AND_ASSIGN(DisassembleToJSONStream);
77 };
78
79
57 // Disassemble instructions. 80 // Disassemble instructions.
58 class Disassembler : public AllStatic { 81 class Disassembler : public AllStatic {
59 public: 82 public:
60 // Disassemble instructions between start and end. 83 // Disassemble instructions between start and end.
61 // (The assumption is that start is at a valid instruction). 84 // (The assumption is that start is at a valid instruction).
62 // Return true if all instructions were successfully decoded, false otherwise. 85 // Return true if all instructions were successfully decoded, false otherwise.
63 static void Disassemble(uword start, 86 static void Disassemble(uword start,
64 uword end, 87 uword end,
65 DisassemblyFormatter* formatter, 88 DisassemblyFormatter* formatter,
66 const Code::Comments& comments); 89 const Code::Comments& comments);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int* out_instr_len, uword pc); 129 int* out_instr_len, uword pc);
107 130
108 private: 131 private:
109 static const int kHexadecimalBufferSize = 32; 132 static const int kHexadecimalBufferSize = 32;
110 static const int kUserReadableBufferSize = 256; 133 static const int kUserReadableBufferSize = 256;
111 }; 134 };
112 135
113 } // namespace dart 136 } // namespace dart
114 137
115 #endif // VM_DISASSEMBLER_H_ 138 #endif // VM_DISASSEMBLER_H_
OLDNEW
« no previous file with comments | « runtime/bin/vmservice_impl.cc ('k') | runtime/vm/disassembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698