OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 | 207 |
208 PosixMemoryMappedFile::~PosixMemoryMappedFile() { | 208 PosixMemoryMappedFile::~PosixMemoryMappedFile() { |
209 int result = munmap(memory_, size_); | 209 int result = munmap(memory_, size_); |
210 ASSERT_EQ(0, result); | 210 ASSERT_EQ(0, result); |
211 USE(result); | 211 USE(result); |
212 fclose(file_); | 212 fclose(file_); |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 void OS::LogSharedLibraryAddresses() { | 216 void OS::LogSharedLibraryAddresses(Isolate* isolate) { |
217 // This function assumes that the layout of the file is as follows: | 217 // This function assumes that the layout of the file is as follows: |
218 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] | 218 // hex_start_addr-hex_end_addr rwxp <unused data> [binary_file_name] |
219 // If we encounter an unexpected situation we abort scanning further entries. | 219 // If we encounter an unexpected situation we abort scanning further entries. |
220 FILE* fp = fopen("/proc/self/maps", "r"); | 220 FILE* fp = fopen("/proc/self/maps", "r"); |
221 if (fp == NULL) return; | 221 if (fp == NULL) return; |
222 | 222 |
223 // Allocate enough room to be able to store a full file name. | 223 // Allocate enough room to be able to store a full file name. |
224 const int kLibNameLen = FILENAME_MAX + 1; | 224 const int kLibNameLen = FILENAME_MAX + 1; |
225 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); | 225 char* lib_name = reinterpret_cast<char*>(malloc(kLibNameLen)); |
226 | 226 |
227 i::Isolate* isolate = Isolate::Current(); | |
228 // This loop will terminate once the scanning hits an EOF. | 227 // This loop will terminate once the scanning hits an EOF. |
229 while (true) { | 228 while (true) { |
230 uintptr_t start, end; | 229 uintptr_t start, end; |
231 char attr_r, attr_w, attr_x, attr_p; | 230 char attr_r, attr_w, attr_x, attr_p; |
232 // Parse the addresses and permission bits at the beginning of the line. | 231 // Parse the addresses and permission bits at the beginning of the line. |
233 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; | 232 if (fscanf(fp, "%" V8PRIxPTR "-%" V8PRIxPTR, &start, &end) != 2) break; |
234 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; | 233 if (fscanf(fp, " %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4) break; |
235 | 234 |
236 int c; | 235 int c; |
237 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { | 236 if (attr_r == 'r' && attr_w != 'w' && attr_x == 'x') { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 int OS::StackWalk(Vector<OS::StackFrame> frames) { | 311 int OS::StackWalk(Vector<OS::StackFrame> frames) { |
313 // backtrace is a glibc extension. | 312 // backtrace is a glibc extension. |
314 #if defined(__GLIBC__) && !defined(__UCLIBC__) | 313 #if defined(__GLIBC__) && !defined(__UCLIBC__) |
315 return POSIXBacktraceHelper<backtrace, backtrace_symbols>::StackWalk(frames); | 314 return POSIXBacktraceHelper<backtrace, backtrace_symbols>::StackWalk(frames); |
316 #else | 315 #else |
317 return 0; | 316 return 0; |
318 #endif | 317 #endif |
319 } | 318 } |
320 | 319 |
321 } } // namespace v8::internal | 320 } } // namespace v8::internal |
OLD | NEW |