| 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/log.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ISL_Print(" "); | 26 ISL_Print(" "); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 ISL_Print("%s", human_buffer); | 29 ISL_Print("%s", human_buffer); |
| 30 ISL_Print("\n"); | 30 ISL_Print("\n"); |
| 31 } | 31 } |
| 32 | 32 |
| 33 | 33 |
| 34 void DisassembleToStdout::Print(const char* format, ...) { | 34 void DisassembleToStdout::Print(const char* format, ...) { |
| 35 va_list args; | 35 va_list args; |
| 36 |
| 36 va_start(args, format); | 37 va_start(args, format); |
| 37 OS::VFPrint(stdout, format, args); | 38 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 38 va_end(args); | 39 va_end(args); |
| 40 |
| 41 char* p = reinterpret_cast<char*>(malloc(len+1)); |
| 42 va_start(args, format); |
| 43 OS::VSNPrint(p, len, format, args); |
| 44 va_end(args); |
| 45 |
| 46 ISL_Print("%s", p); |
| 47 free(p); |
| 39 } | 48 } |
| 40 | 49 |
| 41 | 50 |
| 42 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, | 51 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, |
| 43 intptr_t hex_size, | 52 intptr_t hex_size, |
| 44 char* human_buffer, | 53 char* human_buffer, |
| 45 intptr_t human_size, | 54 intptr_t human_size, |
| 46 uword pc) { | 55 uword pc) { |
| 47 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); | 56 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); |
| 48 // Instructions are represented as three consecutive values in a JSON array. | 57 // Instructions are represented as three consecutive values in a JSON array. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 formatter->ConsumeInstruction(hex_buffer, | 161 formatter->ConsumeInstruction(hex_buffer, |
| 153 sizeof(hex_buffer), | 162 sizeof(hex_buffer), |
| 154 human_buffer, | 163 human_buffer, |
| 155 sizeof(human_buffer), | 164 sizeof(human_buffer), |
| 156 pc); | 165 pc); |
| 157 pc += instruction_length; | 166 pc += instruction_length; |
| 158 } | 167 } |
| 159 } | 168 } |
| 160 | 169 |
| 161 } // namespace dart | 170 } // namespace dart |
| OLD | NEW |