OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 | 279 |
280 int OS::StackWalk(Vector<StackFrame> frames) { | 280 int OS::StackWalk(Vector<StackFrame> frames) { |
281 // If weak link to execinfo lib has failed, ie because we are on 10.4, abort. | 281 // If weak link to execinfo lib has failed, ie because we are on 10.4, abort. |
282 if (backtrace == NULL) | 282 if (backtrace == NULL) |
283 return 0; | 283 return 0; |
284 | 284 |
285 int frames_size = frames.length(); | 285 int frames_size = frames.length(); |
286 ScopedVector<void*> addresses(frames_size); | 286 ScopedVector<void*> addresses(frames_size); |
287 | 287 |
288 int frames_count = backtrace(addresses.start(), frames_size.start()); | 288 int frames_count = backtrace(addresses.start(), frames_size); |
289 | 289 |
290 char** symbols = backtrace_symbols(addresses.start(), frames_count); | 290 char** symbols = backtrace_symbols(addresses.start(), frames_count); |
291 if (symbols == NULL) { | 291 if (symbols == NULL) { |
292 return kStackWalkError; | 292 return kStackWalkError; |
293 } | 293 } |
294 | 294 |
295 for (int i = 0; i < frames_count; i++) { | 295 for (int i = 0; i < frames_count; i++) { |
296 frames[i].address = addresses[i]; | 296 frames[i].address = addresses[i]; |
297 // Format a text representation of the frame based on the information | 297 // Format a text representation of the frame based on the information |
298 // available. | 298 // available. |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 649 |
650 // Deallocate Mach port for thread. | 650 // Deallocate Mach port for thread. |
651 if (IsProfiling()) { | 651 if (IsProfiling()) { |
652 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 652 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
653 } | 653 } |
654 } | 654 } |
655 | 655 |
656 #endif // ENABLE_LOGGING_AND_PROFILING | 656 #endif // ENABLE_LOGGING_AND_PROFILING |
657 | 657 |
658 } } // namespace v8::internal | 658 } } // namespace v8::internal |
OLD | NEW |