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 "handler/win/crash_report_exception_handler.h" | 15 #include "handler/win/crash_report_exception_handler.h" |
16 | 16 |
17 #include "client/crash_report_database.h" | 17 #include "client/crash_report_database.h" |
18 #include "client/settings.h" | 18 #include "client/settings.h" |
19 #include "handler/crash_report_upload_thread.h" | 19 #include "handler/crash_report_upload_thread.h" |
20 #include "minidump/minidump_file_writer.h" | 20 #include "minidump/minidump_file_writer.h" |
21 #include "snapshot/win/process_snapshot_win.h" | 21 #include "snapshot/win/process_snapshot_win.h" |
22 #include "util/file/file_writer.h" | 22 #include "util/file/file_writer.h" |
23 #include "util/win/registration_protocol_win.h" | 23 #include "util/win/registration_protocol_win.h" |
| 24 #include "util/win/scoped_process_suspend.h" |
24 | 25 |
25 namespace crashpad { | 26 namespace crashpad { |
26 | 27 |
27 CrashReportExceptionHandler::CrashReportExceptionHandler( | 28 CrashReportExceptionHandler::CrashReportExceptionHandler( |
28 CrashReportDatabase* database, | 29 CrashReportDatabase* database, |
29 CrashReportUploadThread* upload_thread, | 30 CrashReportUploadThread* upload_thread, |
30 const std::map<std::string, std::string>* process_annotations) | 31 const std::map<std::string, std::string>* process_annotations) |
31 : database_(database), | 32 : database_(database), |
32 upload_thread_(upload_thread), | 33 upload_thread_(upload_thread), |
33 process_annotations_(process_annotations) { | 34 process_annotations_(process_annotations) { |
34 } | 35 } |
35 | 36 |
36 CrashReportExceptionHandler::~CrashReportExceptionHandler() { | 37 CrashReportExceptionHandler::~CrashReportExceptionHandler() { |
37 } | 38 } |
38 | 39 |
39 void CrashReportExceptionHandler::ExceptionHandlerServerStarted() { | 40 void CrashReportExceptionHandler::ExceptionHandlerServerStarted() { |
40 } | 41 } |
41 | 42 |
42 unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException( | 43 unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException( |
43 HANDLE process, | 44 HANDLE process, |
44 WinVMAddress exception_information_address) { | 45 WinVMAddress exception_information_address) { |
45 const unsigned int kFailedTerminationCode = 0xffff7002; | 46 const unsigned int kFailedTerminationCode = 0xffff7002; |
46 | 47 |
47 // TODO(scottmg): ScopedProcessSuspend | 48 ScopedProcessSuspend suspend(process); |
48 | 49 |
49 ProcessSnapshotWin process_snapshot; | 50 ProcessSnapshotWin process_snapshot; |
50 if (!process_snapshot.Initialize(process)) { | 51 if (!process_snapshot.Initialize(process)) { |
51 LOG(WARNING) << "ProcessSnapshotWin::Initialize failed"; | 52 LOG(WARNING) << "ProcessSnapshotWin::Initialize failed"; |
52 return kFailedTerminationCode; | 53 return kFailedTerminationCode; |
53 } | 54 } |
54 | 55 |
55 if (!process_snapshot.InitializeException(exception_information_address)) { | 56 if (!process_snapshot.InitializeException(exception_information_address)) { |
56 LOG(WARNING) << "ProcessSnapshotWin::InitializeException failed"; | 57 LOG(WARNING) << "ProcessSnapshotWin::InitializeException failed"; |
57 return kFailedTerminationCode; | 58 return kFailedTerminationCode; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return termination_code; | 109 return termination_code; |
109 } | 110 } |
110 | 111 |
111 upload_thread_->ReportPending(); | 112 upload_thread_->ReportPending(); |
112 } | 113 } |
113 | 114 |
114 return termination_code; | 115 return termination_code; |
115 } | 116 } |
116 | 117 |
117 } // namespace crashpad | 118 } // namespace crashpad |
OLD | NEW |