OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 uword prologue_offset, | 75 uword prologue_offset, |
76 uword size, | 76 uword size, |
77 bool optimized) { | 77 bool optimized) { |
78 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); | 78 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); |
79 if ((file_write == NULL) || (out_file_ == NULL)) { | 79 if ((file_write == NULL) || (out_file_ == NULL)) { |
80 return; | 80 return; |
81 } | 81 } |
82 const char* format = "%" Px " %" Px " %s%s\n"; | 82 const char* format = "%" Px " %" Px " %s%s\n"; |
83 const char* marker = optimized ? "*" : ""; | 83 const char* marker = optimized ? "*" : ""; |
84 intptr_t len = OS::SNPrint(NULL, 0, format, base, size, marker, name); | 84 intptr_t len = OS::SNPrint(NULL, 0, format, base, size, marker, name); |
85 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 85 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1); |
86 OS::SNPrint(buffer, len + 1, format, base, size, marker, name); | 86 OS::SNPrint(buffer, len + 1, format, base, size, marker, name); |
87 { | 87 { |
88 MutexLocker ml(CodeObservers::mutex()); | 88 MutexLocker ml(CodeObservers::mutex()); |
89 (*file_write)(buffer, len, out_file_); | 89 (*file_write)(buffer, len, out_file_); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 void* out_file_; | 94 void* out_file_; |
95 | 95 |
(...skipping 15 matching lines...) Expand all Loading... |
111 uword size, | 111 uword size, |
112 bool optimized) { | 112 bool optimized) { |
113 if (prologue_offset > 0) { | 113 if (prologue_offset > 0) { |
114 // In order to ensure that gdb sees the first instruction of a function | 114 // In order to ensure that gdb sees the first instruction of a function |
115 // as the prologue sequence we register two symbols for the cases when | 115 // as the prologue sequence we register two symbols for the cases when |
116 // the prologue sequence is not the first instruction: | 116 // the prologue sequence is not the first instruction: |
117 // <name>_entry is used for code preceding the prologue sequence. | 117 // <name>_entry is used for code preceding the prologue sequence. |
118 // <name> for rest of the code (first instruction is prologue sequence). | 118 // <name> for rest of the code (first instruction is prologue sequence). |
119 const char* kFormat = "%s_%s"; | 119 const char* kFormat = "%s_%s"; |
120 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name, "entry"); | 120 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name, "entry"); |
121 char* pname = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 121 char* pname = Thread::Current()->zone()->Alloc<char>(len + 1); |
122 OS::SNPrint(pname, (len + 1), kFormat, name, "entry"); | 122 OS::SNPrint(pname, (len + 1), kFormat, name, "entry"); |
123 DebugInfo::RegisterSection(pname, base, size); | 123 DebugInfo::RegisterSection(pname, base, size); |
124 DebugInfo::RegisterSection(name, | 124 DebugInfo::RegisterSection(name, |
125 (base + prologue_offset), | 125 (base + prologue_offset), |
126 (size - prologue_offset)); | 126 (size - prologue_offset)); |
127 } else { | 127 } else { |
128 DebugInfo::RegisterSection(name, base, size); | 128 DebugInfo::RegisterSection(name, base, size); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 uint64_t vma; | 241 uint64_t vma; |
242 uint64_t code_addr; | 242 uint64_t code_addr; |
243 uint64_t code_size; | 243 uint64_t code_size; |
244 uint64_t code_index; | 244 uint64_t code_index; |
245 }; | 245 }; |
246 | 246 |
247 const char* GenerateCodeName(const char* name, bool optimized) { | 247 const char* GenerateCodeName(const char* name, bool optimized) { |
248 const char* format = "%s%s"; | 248 const char* format = "%s%s"; |
249 const char* marker = optimized ? "*" : ""; | 249 const char* marker = optimized ? "*" : ""; |
250 intptr_t len = OS::SNPrint(NULL, 0, format, marker, name); | 250 intptr_t len = OS::SNPrint(NULL, 0, format, marker, name); |
251 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 251 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1); |
252 OS::SNPrint(buffer, len + 1, format, marker, name); | 252 OS::SNPrint(buffer, len + 1, format, marker, name); |
253 return buffer; | 253 return buffer; |
254 } | 254 } |
255 | 255 |
256 uint32_t GetElfMach() { | 256 uint32_t GetElfMach() { |
257 #if defined(TARGET_ARCH_IA32) | 257 #if defined(TARGET_ARCH_IA32) |
258 return kElfMachIA32; | 258 return kElfMachIA32; |
259 #elif defined(TARGET_ARCH_X64) | 259 #elif defined(TARGET_ARCH_X64) |
260 return kElfMachX64; | 260 return kElfMachX64; |
261 #elif defined(TARGET_ARCH_ARM) | 261 #elif defined(TARGET_ARCH_ARM) |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 } | 611 } |
612 | 612 |
613 | 613 |
614 void OS::Exit(int code) { | 614 void OS::Exit(int code) { |
615 exit(code); | 615 exit(code); |
616 } | 616 } |
617 | 617 |
618 } // namespace dart | 618 } // namespace dart |
619 | 619 |
620 #endif // defined(TARGET_OS_LINUX) | 620 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |