OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 for (size_t index = 0; index < thread_count; ++index) { | 233 for (size_t index = 0; index < thread_count; ++index) { |
234 Thread thread; | 234 Thread thread; |
235 thread.port = threads[index]; | 235 thread.port = threads[index]; |
236 | 236 |
237 #if defined(ARCH_CPU_X86_FAMILY) | 237 #if defined(ARCH_CPU_X86_FAMILY) |
238 const thread_state_flavor_t kThreadStateFlavor = | 238 const thread_state_flavor_t kThreadStateFlavor = |
239 Is64Bit() ? x86_THREAD_STATE64 : x86_THREAD_STATE32; | 239 Is64Bit() ? x86_THREAD_STATE64 : x86_THREAD_STATE32; |
240 mach_msg_type_number_t thread_state_count = | 240 mach_msg_type_number_t thread_state_count = |
241 Is64Bit() ? x86_THREAD_STATE64_COUNT : x86_THREAD_STATE32_COUNT; | 241 Is64Bit() ? x86_THREAD_STATE64_COUNT : x86_THREAD_STATE32_COUNT; |
242 | 242 |
243 // TODO(mark): Use the AVX variants instead of the FLOAT variants? They’re | 243 // TODO(mark): Use the AVX variants instead of the FLOAT variants? |
244 // supported on 10.6 and later. | |
245 const thread_state_flavor_t kFloatStateFlavor = | 244 const thread_state_flavor_t kFloatStateFlavor = |
246 Is64Bit() ? x86_FLOAT_STATE64 : x86_FLOAT_STATE32; | 245 Is64Bit() ? x86_FLOAT_STATE64 : x86_FLOAT_STATE32; |
247 mach_msg_type_number_t float_state_count = | 246 mach_msg_type_number_t float_state_count = |
248 Is64Bit() ? x86_FLOAT_STATE64_COUNT : x86_FLOAT_STATE32_COUNT; | 247 Is64Bit() ? x86_FLOAT_STATE64_COUNT : x86_FLOAT_STATE32_COUNT; |
249 | 248 |
250 const thread_state_flavor_t kDebugStateFlavor = | 249 const thread_state_flavor_t kDebugStateFlavor = |
251 Is64Bit() ? x86_DEBUG_STATE64 : x86_DEBUG_STATE32; | 250 Is64Bit() ? x86_DEBUG_STATE64 : x86_DEBUG_STATE32; |
252 mach_msg_type_number_t debug_state_count = | 251 mach_msg_type_number_t debug_state_count = |
253 Is64Bit() ? x86_DEBUG_STATE64_COUNT : x86_DEBUG_STATE32_COUNT; | 252 Is64Bit() ? x86_DEBUG_STATE64_COUNT : x86_DEBUG_STATE32_COUNT; |
254 #endif | 253 #endif |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 346 |
348 threads_need_owners.Disarm(); | 347 threads_need_owners.Disarm(); |
349 } | 348 } |
350 | 349 |
351 void ProcessReader::InitializeModules() { | 350 void ProcessReader::InitializeModules() { |
352 DCHECK(!initialized_modules_); | 351 DCHECK(!initialized_modules_); |
353 DCHECK(modules_.empty()); | 352 DCHECK(modules_.empty()); |
354 | 353 |
355 initialized_modules_ = true; | 354 initialized_modules_ = true; |
356 | 355 |
357 // This API only works on Mac OS X 10.6 and higher. On Mac OS X 10.5, find the | |
358 // “_dyld_all_image_infos” symbol in the loaded LC_LOAD_DYLINKER (dyld). | |
359 task_dyld_info_data_t dyld_info; | 356 task_dyld_info_data_t dyld_info; |
360 mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; | 357 mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT; |
361 kern_return_t kr = task_info( | 358 kern_return_t kr = task_info( |
362 task_, TASK_DYLD_INFO, reinterpret_cast<task_info_t>(&dyld_info), &count); | 359 task_, TASK_DYLD_INFO, reinterpret_cast<task_info_t>(&dyld_info), &count); |
363 if (kr != KERN_SUCCESS) { | 360 if (kr != KERN_SUCCESS) { |
364 MACH_LOG(WARNING, kr) << "task_info"; | 361 MACH_LOG(WARNING, kr) << "task_info"; |
365 return; | 362 return; |
366 } | 363 } |
367 | 364 |
368 // TODO(mark): Deal with statically linked executables which don’t use dyld. | 365 // TODO(mark): Deal with statically linked executables which don’t use dyld. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 // The red zone would go lower into another region in memory, but no | 631 // The red zone would go lower into another region in memory, but no |
635 // region was found. Memory can only be captured to an address as low as | 632 // region was found. Memory can only be captured to an address as low as |
636 // the base address of the region already found. | 633 // the base address of the region already found. |
637 *start_address = *region_base; | 634 *start_address = *region_base; |
638 } | 635 } |
639 } | 636 } |
640 #endif | 637 #endif |
641 } | 638 } |
642 | 639 |
643 } // namespace crashpad | 640 } // namespace crashpad |
OLD | NEW |