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" | |
25 | 24 |
26 namespace crashpad { | 25 namespace crashpad { |
27 | 26 |
28 CrashReportExceptionHandler::CrashReportExceptionHandler( | 27 CrashReportExceptionHandler::CrashReportExceptionHandler( |
29 CrashReportDatabase* database, | 28 CrashReportDatabase* database, |
30 CrashReportUploadThread* upload_thread, | 29 CrashReportUploadThread* upload_thread, |
31 const std::map<std::string, std::string>* process_annotations) | 30 const std::map<std::string, std::string>* process_annotations) |
32 : database_(database), | 31 : database_(database), |
33 upload_thread_(upload_thread), | 32 upload_thread_(upload_thread), |
34 process_annotations_(process_annotations) { | 33 process_annotations_(process_annotations) { |
35 } | 34 } |
36 | 35 |
37 CrashReportExceptionHandler::~CrashReportExceptionHandler() { | 36 CrashReportExceptionHandler::~CrashReportExceptionHandler() { |
38 } | 37 } |
39 | 38 |
40 void CrashReportExceptionHandler::ExceptionHandlerServerStarted() { | 39 void CrashReportExceptionHandler::ExceptionHandlerServerStarted() { |
41 } | 40 } |
42 | 41 |
43 unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException( | 42 unsigned int CrashReportExceptionHandler::ExceptionHandlerServerException( |
44 HANDLE process, | 43 HANDLE process, |
45 WinVMAddress exception_information_address) { | 44 WinVMAddress exception_information_address) { |
46 const unsigned int kFailedTerminationCode = 0xffff7002; | 45 const unsigned int kFailedTerminationCode = 0xffff7002; |
47 | 46 |
48 ScopedProcessSuspend suspend(process); | |
49 | |
50 ProcessSnapshotWin process_snapshot; | 47 ProcessSnapshotWin process_snapshot; |
51 if (!process_snapshot.Initialize(process)) { | 48 if (!process_snapshot.Initialize(process, |
| 49 ProcessSuspensionState::kSuspended)) { |
52 LOG(WARNING) << "ProcessSnapshotWin::Initialize failed"; | 50 LOG(WARNING) << "ProcessSnapshotWin::Initialize failed"; |
53 return kFailedTerminationCode; | 51 return kFailedTerminationCode; |
54 } | 52 } |
55 | 53 |
56 if (!process_snapshot.InitializeException(exception_information_address)) { | 54 if (!process_snapshot.InitializeException(exception_information_address)) { |
57 LOG(WARNING) << "ProcessSnapshotWin::InitializeException failed"; | 55 LOG(WARNING) << "ProcessSnapshotWin::InitializeException failed"; |
58 return kFailedTerminationCode; | 56 return kFailedTerminationCode; |
59 } | 57 } |
60 | 58 |
61 // Now that we have the exception information, even if something else fails we | 59 // Now that we have the exception information, even if something else fails we |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return termination_code; | 107 return termination_code; |
110 } | 108 } |
111 | 109 |
112 upload_thread_->ReportPending(); | 110 upload_thread_->ReportPending(); |
113 } | 111 } |
114 | 112 |
115 return termination_code; | 113 return termination_code; |
116 } | 114 } |
117 | 115 |
118 } // namespace crashpad | 116 } // namespace crashpad |
OLD | NEW |