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 #if !defined(_WIN32) // Disassembler is not yet supported under WIN32. |
5 #include <errno.h> | 6 #include <errno.h> |
6 #include <stdio.h> | 7 #include <stdio.h> |
7 #include <stdlib.h> | 8 #include <stdlib.h> |
8 #include <unistd.h> | 9 #include <unistd.h> |
| 10 #endif |
9 | 11 |
10 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 12 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
11 #if defined(TARGET_ARCH_X64) | 13 #if defined(TARGET_ARCH_X64) |
12 | 14 |
13 #include "vm/disassembler.h" | 15 #include "vm/disassembler.h" |
14 | 16 |
15 #include "vm/assert.h" | 17 #include "vm/assert.h" |
16 | 18 |
17 namespace dart { | 19 namespace dart { |
18 | 20 |
19 void Disassembler::Disassemble(uword start, | 21 void Disassembler::Disassemble(uword start, |
20 uword end, | 22 uword end, |
21 DisassemblyFormatter* formatter) { | 23 DisassemblyFormatter* formatter) { |
22 // First print the actual addresses so that we know where in memory this is | 24 // First print the actual addresses so that we know where in memory this is |
23 // being disassembled from. | 25 // being disassembled from. |
24 formatter->Print("start: %p end: %p\n", start, end); | 26 formatter->Print("start: %p end: %p\n", start, end); |
25 | 27 |
| 28 #if !defined(_WIN32) // Disassembler is not yet supported under WIN32. |
26 // Write code block to tmp file. | 29 // Write code block to tmp file. |
27 char tmp[] = "/tmp/codeblock.XXXXXX"; | 30 char tmp[] = "/tmp/codeblock.XXXXXX"; |
28 int fd = mkstemp(tmp); | 31 int fd = mkstemp(tmp); |
29 if (fd < 0) { | 32 if (fd < 0) { |
30 int errsv = errno; | 33 int errsv = errno; |
31 formatter->Print("Could not open tmp file %s, errno=%s\n", | 34 formatter->Print("Could not open tmp file %s, errno=%s\n", |
32 tmp, | 35 tmp, |
33 strerror(errsv)); | 36 strerror(errsv)); |
34 return; // failed | 37 return; // failed |
35 } | 38 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 88 } |
86 pclose(output); | 89 pclose(output); |
87 | 90 |
88 // Delete tmp files. | 91 // Delete tmp files. |
89 remove(tmp); | 92 remove(tmp); |
90 #if defined(__APPLE__) | 93 #if defined(__APPLE__) |
91 char tmp_o[32]; | 94 char tmp_o[32]; |
92 snprintf(tmp_o, sizeof(tmp_o), "%s.o", tmp); | 95 snprintf(tmp_o, sizeof(tmp_o), "%s.o", tmp); |
93 remove(tmp_o); | 96 remove(tmp_o); |
94 #endif | 97 #endif |
| 98 #endif // !defined(_WIN32) |
95 } | 99 } |
96 | 100 |
97 | 101 |
98 int Disassembler::DecodeInstruction(char* hexa_buffer, intptr_t hexa_size, | 102 int Disassembler::DecodeInstruction(char* hexa_buffer, intptr_t hexa_size, |
99 char* human_buffer, intptr_t human_size, | 103 char* human_buffer, intptr_t human_size, |
100 uword pc) { | 104 uword pc) { |
101 UNIMPLEMENTED(); | 105 UNIMPLEMENTED(); |
102 return 0; | 106 return 0; |
103 } | 107 } |
104 | 108 |
105 } // namespace dart | 109 } // namespace dart |
106 | 110 |
107 #endif // defined TARGET_ARCH_X64 | 111 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |