| 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/il_printer.h" | 9 #include "vm/il_printer.h" |
| 10 #include "vm/json_stream.h" | 10 #include "vm/json_stream.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ISL_VPrint(format, args); | 39 ISL_VPrint(format, args); |
| 40 va_end(args); | 40 va_end(args); |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, | 44 void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer, |
| 45 intptr_t hex_size, | 45 intptr_t hex_size, |
| 46 char* human_buffer, | 46 char* human_buffer, |
| 47 intptr_t human_size, | 47 intptr_t human_size, |
| 48 uword pc) { | 48 uword pc) { |
| 49 uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc); | |
| 50 // Instructions are represented as three consecutive values in a JSON array. | 49 // Instructions are represented as three consecutive values in a JSON array. |
| 51 // All three are strings. The first is the address of the instruction, | 50 // All three are strings. The first is the address of the instruction, |
| 52 // the second is the hex string of the code, and the final is a human | 51 // the second is the hex string of the code, and the final is a human |
| 53 // readable string. | 52 // readable string. |
| 54 jsarr_.AddValueF("%p", pc_ptr); | 53 jsarr_.AddValueF("%" Pp "", pc); |
| 55 jsarr_.AddValue(hex_buffer); | 54 jsarr_.AddValue(hex_buffer); |
| 56 jsarr_.AddValue(human_buffer); | 55 jsarr_.AddValue(human_buffer); |
| 57 } | 56 } |
| 58 | 57 |
| 59 | 58 |
| 60 void DisassembleToJSONStream::Print(const char* format, ...) { | 59 void DisassembleToJSONStream::Print(const char* format, ...) { |
| 61 va_list args; | 60 va_list args; |
| 62 va_start(args, format); | 61 va_start(args, format); |
| 63 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 62 intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
| 64 va_end(args); | 63 va_end(args); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 formatter->ConsumeInstruction(hex_buffer, | 160 formatter->ConsumeInstruction(hex_buffer, |
| 162 sizeof(hex_buffer), | 161 sizeof(hex_buffer), |
| 163 human_buffer, | 162 human_buffer, |
| 164 sizeof(human_buffer), | 163 sizeof(human_buffer), |
| 165 pc); | 164 pc); |
| 166 pc += instruction_length; | 165 pc += instruction_length; |
| 167 } | 166 } |
| 168 } | 167 } |
| 169 | 168 |
| 170 } // namespace dart | 169 } // namespace dart |
| OLD | NEW |