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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const std::map<std::string, std::string>& annotations, | 98 const std::map<std::string, std::string>& annotations, |
99 const std::vector<std::string>& arguments) { | 99 const std::vector<std::string>& arguments) { |
100 LOG(FATAL) << "SetHandler should be used on Windows"; | 100 LOG(FATAL) << "SetHandler should be used on Windows"; |
101 return false; | 101 return false; |
102 } | 102 } |
103 | 103 |
104 bool CrashpadClient::SetHandler(const std::string& ipc_port) { | 104 bool CrashpadClient::SetHandler(const std::string& ipc_port) { |
105 ClientToServerMessage message; | 105 ClientToServerMessage message; |
106 memset(&message, 0, sizeof(message)); | 106 memset(&message, 0, sizeof(message)); |
107 message.type = ClientToServerMessage::kRegister; | 107 message.type = ClientToServerMessage::kRegister; |
| 108 message.registration.version = RegistrationRequest::kMessageVersion; |
108 message.registration.client_process_id = GetCurrentProcessId(); | 109 message.registration.client_process_id = GetCurrentProcessId(); |
109 message.registration.exception_information = | 110 message.registration.exception_information = |
110 reinterpret_cast<WinVMAddress>(&g_exception_information); | 111 reinterpret_cast<WinVMAddress>(&g_exception_information); |
111 | 112 |
112 ServerToClientMessage response = {0}; | 113 ServerToClientMessage response = {0}; |
113 | 114 |
114 if (!SendToCrashHandlerServer( | 115 if (!SendToCrashHandlerServer( |
115 base::UTF8ToUTF16(ipc_port), message, &response)) { | 116 base::UTF8ToUTF16(ipc_port), message, &response)) { |
116 return false; | 117 return false; |
117 } | 118 } |
118 | 119 |
119 // The server returns these already duplicated to be valid in this process. | 120 // The server returns these already duplicated to be valid in this process. |
120 g_signal_exception = | 121 g_signal_exception = |
121 reinterpret_cast<HANDLE>(response.registration.request_report_event); | 122 reinterpret_cast<HANDLE>(response.registration.request_report_event); |
122 return true; | 123 return true; |
123 } | 124 } |
124 | 125 |
125 bool CrashpadClient::UseHandler() { | 126 bool CrashpadClient::UseHandler() { |
126 if (g_signal_exception == INVALID_HANDLE_VALUE) | 127 if (g_signal_exception == INVALID_HANDLE_VALUE) |
127 return false; | 128 return false; |
128 // In theory we could store the previous handler but it is not clear what | 129 // In theory we could store the previous handler but it is not clear what |
129 // use we have for it. | 130 // use we have for it. |
130 SetUnhandledExceptionFilter(&UnhandledExceptionHandler); | 131 SetUnhandledExceptionFilter(&UnhandledExceptionHandler); |
131 return true; | 132 return true; |
132 } | 133 } |
133 | 134 |
134 } // namespace crashpad | 135 } // namespace crashpad |
OLD | NEW |