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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 CrashReportDatabase* database_; // weak | 52 CrashReportDatabase* database_; // weak |
53 CrashReportDatabase::NewReport* new_report_; // weak | 53 CrashReportDatabase::NewReport* new_report_; // weak |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(CallErrorWritingCrashReport); | 55 DISALLOW_COPY_AND_ASSIGN(CallErrorWritingCrashReport); |
56 }; | 56 }; |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 CrashReportExceptionHandler::CrashReportExceptionHandler( | 60 CrashReportExceptionHandler::CrashReportExceptionHandler( |
61 CrashReportDatabase* database, | 61 CrashReportDatabase* database, |
62 CrashReportUploadThread* upload_thread) | 62 CrashReportUploadThread* upload_thread, |
| 63 const std::map<std::string, std::string>* process_annotations) |
63 : database_(database), | 64 : database_(database), |
64 upload_thread_(upload_thread) { | 65 upload_thread_(upload_thread), |
| 66 process_annotations_(process_annotations) { |
65 } | 67 } |
66 | 68 |
67 CrashReportExceptionHandler::~CrashReportExceptionHandler() { | 69 CrashReportExceptionHandler::~CrashReportExceptionHandler() { |
68 } | 70 } |
69 | 71 |
70 kern_return_t CrashReportExceptionHandler::CatchMachException( | 72 kern_return_t CrashReportExceptionHandler::CatchMachException( |
71 exception_behavior_t behavior, | 73 exception_behavior_t behavior, |
72 exception_handler_t exception_port, | 74 exception_handler_t exception_port, |
73 thread_t thread, | 75 thread_t thread, |
74 task_t task, | 76 task_t task, |
(...skipping 26 matching lines...) Expand all Loading... |
101 return KERN_FAILURE; | 103 return KERN_FAILURE; |
102 } | 104 } |
103 | 105 |
104 ScopedTaskSuspend suspend(task); | 106 ScopedTaskSuspend suspend(task); |
105 | 107 |
106 ProcessSnapshotMac process_snapshot; | 108 ProcessSnapshotMac process_snapshot; |
107 if (!process_snapshot.Initialize(task)) { | 109 if (!process_snapshot.Initialize(task)) { |
108 return KERN_FAILURE; | 110 return KERN_FAILURE; |
109 } | 111 } |
110 | 112 |
| 113 if (!process_snapshot.InitializeException(thread, |
| 114 exception, |
| 115 code, |
| 116 code_count, |
| 117 *flavor, |
| 118 old_state, |
| 119 old_state_count)) { |
| 120 return KERN_FAILURE; |
| 121 } |
| 122 |
| 123 process_snapshot.SetAnnotationsSimpleMap(*process_annotations_); |
| 124 |
111 CrashReportDatabase::NewReport* new_report; | 125 CrashReportDatabase::NewReport* new_report; |
112 CrashReportDatabase::OperationStatus database_status = | 126 CrashReportDatabase::OperationStatus database_status = |
113 database_->PrepareNewCrashReport(&new_report); | 127 database_->PrepareNewCrashReport(&new_report); |
114 if (database_status != CrashReportDatabase::kNoError) { | 128 if (database_status != CrashReportDatabase::kNoError) { |
115 return KERN_FAILURE; | 129 return KERN_FAILURE; |
116 } | 130 } |
117 | 131 |
118 CallErrorWritingCrashReport call_error_writing_crash_report(database_, | 132 CallErrorWritingCrashReport call_error_writing_crash_report(database_, |
119 new_report); | 133 new_report); |
120 | 134 |
(...skipping 12 matching lines...) Expand all Loading... |
133 if (database_status != CrashReportDatabase::kNoError) { | 147 if (database_status != CrashReportDatabase::kNoError) { |
134 return KERN_FAILURE; | 148 return KERN_FAILURE; |
135 } | 149 } |
136 | 150 |
137 upload_thread_->ReportPending(); | 151 upload_thread_->ReportPending(); |
138 | 152 |
139 return ExcServerSuccessfulReturnValue(behavior, false); | 153 return ExcServerSuccessfulReturnValue(behavior, false); |
140 } | 154 } |
141 | 155 |
142 } // namespace crashpad | 156 } // namespace crashpad |
OLD | NEW |