Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 reinterpret_cast<process_types::TEB<Traits>*>( | 129 reinterpret_cast<process_types::TEB<Traits>*>( |
| 130 NtCurrentTeb())->ClientId.UniqueThread; | 130 NtCurrentTeb())->ClientId.UniqueThread; |
| 131 | 131 |
| 132 if (is_current_thread) { | 132 if (is_current_thread) { |
| 133 DCHECK(suspension_state == ProcessSuspensionState::kRunning); | 133 DCHECK(suspension_state == ProcessSuspensionState::kRunning); |
| 134 thread->suspend_count = 0; | 134 thread->suspend_count = 0; |
| 135 DCHECK(!is_64_reading_32); | 135 DCHECK(!is_64_reading_32); |
| 136 CaptureContext(&thread->context.native); | 136 CaptureContext(&thread->context.native); |
| 137 } else { | 137 } else { |
| 138 DWORD previous_suspend_count = SuspendThread(thread_handle); | 138 DWORD previous_suspend_count = SuspendThread(thread_handle); |
| 139 if (previous_suspend_count == -1) { | 139 if (previous_suspend_count == static_cast<DWORD>(-1)) { |
|
Mark Mentovai
2015/12/08 22:05:59
-1u?
Nico
2015/12/08 22:07:12
MSDN says that SuspendThread returns "(DWORD)-1" o
| |
| 140 PLOG(ERROR) << "SuspendThread"; | 140 PLOG(ERROR) << "SuspendThread"; |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 DCHECK(previous_suspend_count > 0 || | 143 DCHECK(previous_suspend_count > 0 || |
| 144 suspension_state == ProcessSuspensionState::kRunning); | 144 suspension_state == ProcessSuspensionState::kRunning); |
| 145 thread->suspend_count = | 145 thread->suspend_count = |
| 146 previous_suspend_count - | 146 previous_suspend_count - |
| 147 (suspension_state == ProcessSuspensionState::kSuspended ? 1 : 0); | 147 (suspension_state == ProcessSuspensionState::kSuspended ? 1 : 0); |
| 148 | 148 |
| 149 memset(&thread->context, 0, sizeof(thread->context)); | 149 memset(&thread->context, 0, sizeof(thread->context)); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 thread.stack_region_size = 0; | 404 thread.stack_region_size = 0; |
| 405 } else { | 405 } else { |
| 406 thread.stack_region_size = base - limit; | 406 thread.stack_region_size = base - limit; |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 threads_.push_back(thread); | 409 threads_.push_back(thread); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace crashpad | 413 } // namespace crashpad |
| OLD | NEW |