| 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 20 matching lines...) Expand all Loading... |
| 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 |
| 37 va_start(args, format); | 37 va_start(args, format); |
| 38 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 38 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 39 va_end(args); | 39 va_end(args); |
| 40 | 40 |
| 41 char* p = reinterpret_cast<char*>(malloc(len+1)); | 41 char* p = reinterpret_cast<char*>(malloc(len + 1)); |
| 42 va_start(args, format); | 42 va_start(args, format); |
| 43 OS::VSNPrint(p, len, format, args); | 43 OS::VSNPrint(p, (len + 1), format, args); |
| 44 va_end(args); | 44 va_end(args); |
| 45 | 45 |
| 46 ISL_Print("%s", p); | 46 ISL_Print("%s", p); |
| 47 free(p); | 47 free(p); |
| 48 } | 48 } |
| 49 | 49 |
| 50 | 50 |
| 51 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, | 51 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, |
| 52 intptr_t hex_size, | 52 intptr_t hex_size, |
| 53 char* human_buffer, | 53 char* human_buffer, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 formatter->ConsumeInstruction(hex_buffer, | 161 formatter->ConsumeInstruction(hex_buffer, |
| 162 sizeof(hex_buffer), | 162 sizeof(hex_buffer), |
| 163 human_buffer, | 163 human_buffer, |
| 164 sizeof(human_buffer), | 164 sizeof(human_buffer), |
| 165 pc); | 165 pc); |
| 166 pc += instruction_length; | 166 pc += instruction_length; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace dart | 170 } // namespace dart |
| OLD | NEW |