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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (memory_) munmap(memory_, size_); | 132 if (memory_) munmap(memory_, size_); |
133 fclose(file_); | 133 fclose(file_); |
134 } | 134 } |
135 | 135 |
136 | 136 |
137 static unsigned StringToLong(char* buffer) { | 137 static unsigned StringToLong(char* buffer) { |
138 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT | 138 return static_cast<unsigned>(strtol(buffer, NULL, 16)); // NOLINT |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 void OS::LogSharedLibraryAddresses() { | 142 void OS::LogSharedLibraryAddresses(Isolate* isolate) { |
143 static const int MAP_LENGTH = 1024; | 143 static const int MAP_LENGTH = 1024; |
144 int fd = open("/proc/self/maps", O_RDONLY); | 144 int fd = open("/proc/self/maps", O_RDONLY); |
145 if (fd < 0) return; | 145 if (fd < 0) return; |
146 while (true) { | 146 while (true) { |
147 char addr_buffer[11]; | 147 char addr_buffer[11]; |
148 addr_buffer[0] = '0'; | 148 addr_buffer[0] = '0'; |
149 addr_buffer[1] = 'x'; | 149 addr_buffer[1] = 'x'; |
150 addr_buffer[10] = 0; | 150 addr_buffer[10] = 0; |
151 int result = read(fd, addr_buffer + 2, 8); | 151 int result = read(fd, addr_buffer + 2, 8); |
152 if (result < 8) break; | 152 if (result < 8) break; |
(...skipping 13 matching lines...) Expand all Loading... |
166 result = read(fd, buffer + bytes_read, 1); | 166 result = read(fd, buffer + bytes_read, 1); |
167 if (result < 1) break; | 167 if (result < 1) break; |
168 } while (buffer[bytes_read] != '\n'); | 168 } while (buffer[bytes_read] != '\n'); |
169 buffer[bytes_read] = 0; | 169 buffer[bytes_read] = 0; |
170 // Ignore mappings that are not executable. | 170 // Ignore mappings that are not executable. |
171 if (buffer[3] != 'x') continue; | 171 if (buffer[3] != 'x') continue; |
172 char* start_of_path = index(buffer, '/'); | 172 char* start_of_path = index(buffer, '/'); |
173 // There may be no filename in this line. Skip to next. | 173 // There may be no filename in this line. Skip to next. |
174 if (start_of_path == NULL) continue; | 174 if (start_of_path == NULL) continue; |
175 buffer[bytes_read] = 0; | 175 buffer[bytes_read] = 0; |
176 LOG(i::Isolate::Current(), SharedLibraryEvent(start_of_path, start, end)); | 176 LOG(isolate SharedLibraryEvent(start_of_path, start, end)); |
177 } | 177 } |
178 close(fd); | 178 close(fd); |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 void OS::SignalCodeMovingGC() { | 182 void OS::SignalCodeMovingGC() { |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 int OS::StackWalk(Vector<OS::StackFrame> frames) { | 186 int OS::StackWalk(Vector<OS::StackFrame> frames) { |
187 return POSIXBacktraceHelper<backtrace, backtrace_symbols>::StackWalk(frames); | 187 return POSIXBacktraceHelper<backtrace, backtrace_symbols>::StackWalk(frames); |
188 } | 188 } |
189 | 189 |
190 } } // namespace v8::internal | 190 } } // namespace v8::internal |
OLD | NEW |