| 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, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include "snapshot/win/process_snapshot_win.h" | 15 #include "snapshot/win/process_snapshot_win.h" |
| 16 | 16 |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "snapshot/win/module_snapshot_win.h" | 18 #include "snapshot/win/module_snapshot_win.h" |
| 19 #include "util/win/registration_protocol_win.h" |
| 19 #include "util/win/time.h" | 20 #include "util/win/time.h" |
| 20 | 21 |
| 21 namespace crashpad { | 22 namespace crashpad { |
| 22 | 23 |
| 23 ProcessSnapshotWin::ProcessSnapshotWin() | 24 ProcessSnapshotWin::ProcessSnapshotWin() |
| 24 : ProcessSnapshot(), | 25 : ProcessSnapshot(), |
| 25 system_(), | 26 system_(), |
| 26 threads_(), | 27 threads_(), |
| 27 modules_(), | 28 modules_(), |
| 28 exception_(), | 29 exception_(), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 48 system_.Initialize(&process_reader_); | 49 system_.Initialize(&process_reader_); |
| 49 | 50 |
| 50 InitializeThreads(); | 51 InitializeThreads(); |
| 51 InitializeModules(); | 52 InitializeModules(); |
| 52 | 53 |
| 53 INITIALIZATION_STATE_SET_VALID(initialized_); | 54 INITIALIZATION_STATE_SET_VALID(initialized_); |
| 54 return true; | 55 return true; |
| 55 } | 56 } |
| 56 | 57 |
| 57 bool ProcessSnapshotWin::InitializeException( | 58 bool ProcessSnapshotWin::InitializeException( |
| 58 DWORD thread_id, | 59 WinVMAddress exception_information_address) { |
| 59 WinVMAddress exception_pointers) { | |
| 60 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 60 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 61 DCHECK(!exception_); | 61 DCHECK(!exception_); |
| 62 | 62 |
| 63 ExceptionInformation exception_information; |
| 64 if (!process_reader_.ReadMemory(exception_information_address, |
| 65 sizeof(exception_information), |
| 66 &exception_information)) { |
| 67 LOG(WARNING) << "ReadMemory ExceptionInformation failed"; |
| 68 return false; |
| 69 } |
| 70 |
| 63 exception_.reset(new internal::ExceptionSnapshotWin()); | 71 exception_.reset(new internal::ExceptionSnapshotWin()); |
| 64 if (!exception_->Initialize( | 72 if (!exception_->Initialize(&process_reader_, |
| 65 &process_reader_, thread_id, exception_pointers)) { | 73 exception_information.thread_id, |
| 74 exception_information.exception_pointers)) { |
| 66 exception_.reset(); | 75 exception_.reset(); |
| 67 return false; | 76 return false; |
| 68 } | 77 } |
| 69 | 78 |
| 70 return true; | 79 return true; |
| 71 } | 80 } |
| 72 | 81 |
| 73 void ProcessSnapshotWin::GetCrashpadOptions( | 82 void ProcessSnapshotWin::GetCrashpadOptions( |
| 74 CrashpadInfoClientOptions* options) { | 83 CrashpadInfoClientOptions* options) { |
| 75 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 84 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 for (const ProcessInfo::Module& process_reader_module : | 196 for (const ProcessInfo::Module& process_reader_module : |
| 188 process_reader_modules) { | 197 process_reader_modules) { |
| 189 auto module = make_scoped_ptr(new internal::ModuleSnapshotWin()); | 198 auto module = make_scoped_ptr(new internal::ModuleSnapshotWin()); |
| 190 if (module->Initialize(&process_reader_, process_reader_module)) { | 199 if (module->Initialize(&process_reader_, process_reader_module)) { |
| 191 modules_.push_back(module.release()); | 200 modules_.push_back(module.release()); |
| 192 } | 201 } |
| 193 } | 202 } |
| 194 } | 203 } |
| 195 | 204 |
| 196 } // namespace crashpad | 205 } // namespace crashpad |
| OLD | NEW |