| 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/disassembler.h" | 5 #include "vm/disassembler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/log.h" |
| 10 #include "vm/json_stream.h" | 11 #include "vm/json_stream.h" |
| 11 | 12 |
| 12 namespace dart { | 13 namespace dart { |
| 13 | 14 |
| 14 void DisassembleToStdout::ConsumeInstruction(char* hex_buffer, | 15 void DisassembleToStdout::ConsumeInstruction(char* hex_buffer, |
| 15 intptr_t hex_size, | 16 intptr_t hex_size, |
| 16 char* human_buffer, | 17 char* human_buffer, |
| 17 intptr_t human_size, | 18 intptr_t human_size, |
| 18 uword pc) { | 19 uword pc) { |
| 19 static const int kHexColumnWidth = 23; | 20 static const int kHexColumnWidth = 23; |
| 20 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); | 21 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); |
| 21 OS::Print("%p %s", pc_ptr, hex_buffer); | 22 ISL_Print("%p %s", pc_ptr, hex_buffer); |
| 22 int hex_length = strlen(hex_buffer); | 23 int hex_length = strlen(hex_buffer); |
| 23 if (hex_length < kHexColumnWidth) { | 24 if (hex_length < kHexColumnWidth) { |
| 24 for (int i = kHexColumnWidth - hex_length; i > 0; i--) { | 25 for (int i = kHexColumnWidth - hex_length; i > 0; i--) { |
| 25 OS::Print(" "); | 26 ISL_Print(" "); |
| 26 } | 27 } |
| 27 } | 28 } |
| 28 OS::Print("%s", human_buffer); | 29 ISL_Print("%s", human_buffer); |
| 29 OS::Print("\n"); | 30 ISL_Print("\n"); |
| 30 } | 31 } |
| 31 | 32 |
| 32 | 33 |
| 33 void DisassembleToStdout::Print(const char* format, ...) { | 34 void DisassembleToStdout::Print(const char* format, ...) { |
| 34 va_list args; | 35 va_list args; |
| 35 va_start(args, format); | 36 va_start(args, format); |
| 36 OS::VFPrint(stdout, format, args); | 37 OS::VFPrint(stdout, format, args); |
| 37 va_end(args); | 38 va_end(args); |
| 38 } | 39 } |
| 39 | 40 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 formatter->ConsumeInstruction(hex_buffer, | 152 formatter->ConsumeInstruction(hex_buffer, |
| 152 sizeof(hex_buffer), | 153 sizeof(hex_buffer), |
| 153 human_buffer, | 154 human_buffer, |
| 154 sizeof(human_buffer), | 155 sizeof(human_buffer), |
| 155 pc); | 156 pc); |
| 156 pc += instruction_length; | 157 pc += instruction_length; |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace dart | 161 } // namespace dart |
| OLD | NEW |