OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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 28 matching lines...) Expand all Loading... |
39 #include "base/mac/scoped_mach_port.h" | 39 #include "base/mac/scoped_mach_port.h" |
40 #include "handler/mac/crash_report_exception_handler.h" | 40 #include "handler/mac/crash_report_exception_handler.h" |
41 #include "handler/mac/exception_handler_server.h" | 41 #include "handler/mac/exception_handler_server.h" |
42 #include "util/mach/child_port_handshake.h" | 42 #include "util/mach/child_port_handshake.h" |
43 #include "util/mach/mach_extensions.h" | 43 #include "util/mach/mach_extensions.h" |
44 #include "util/posix/close_stdio.h" | 44 #include "util/posix/close_stdio.h" |
45 #elif defined(OS_WIN) | 45 #elif defined(OS_WIN) |
46 #include <windows.h> | 46 #include <windows.h> |
47 #include "handler/win/crash_report_exception_handler.h" | 47 #include "handler/win/crash_report_exception_handler.h" |
48 #include "util/win/exception_handler_server.h" | 48 #include "util/win/exception_handler_server.h" |
| 49 #include "util/win/handle.h" |
49 #endif // OS_MACOSX | 50 #endif // OS_MACOSX |
50 | 51 |
51 namespace crashpad { | 52 namespace crashpad { |
52 namespace { | 53 namespace { |
53 | 54 |
54 void Usage(const base::FilePath& me) { | 55 void Usage(const base::FilePath& me) { |
55 fprintf(stderr, | 56 fprintf(stderr, |
56 "Usage: %" PRFilePath " [OPTION]...\n" | 57 "Usage: %" PRFilePath " [OPTION]...\n" |
57 "Crashpad's exception handler server.\n" | 58 "Crashpad's exception handler server.\n" |
58 "\n" | 59 "\n" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 case kOptionMachService: { | 175 case kOptionMachService: { |
175 options.mach_service = optarg; | 176 options.mach_service = optarg; |
176 break; | 177 break; |
177 } | 178 } |
178 case kOptionResetOwnCrashExceptionPortToSystemDefault: { | 179 case kOptionResetOwnCrashExceptionPortToSystemDefault: { |
179 options.reset_own_crash_exception_port_to_system_default = true; | 180 options.reset_own_crash_exception_port_to_system_default = true; |
180 break; | 181 break; |
181 } | 182 } |
182 #elif defined(OS_WIN) | 183 #elif defined(OS_WIN) |
183 case kOptionHandshakeHandle: { | 184 case kOptionHandshakeHandle: { |
184 // According to | 185 // Use unsigned int, because the handle was presented by the client in |
185 // https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203, | 186 // 0x%x format. |
186 // HANDLEs are always 32 bits. This construction is used to read a full | |
187 // 32-bit number presented by the client, which uses 0x%x format, and | |
188 // sign-extend it. | |
189 unsigned int handle_uint; | 187 unsigned int handle_uint; |
190 if (!StringToNumber(optarg, &handle_uint) || | 188 if (!StringToNumber(optarg, &handle_uint) || |
191 (options.handshake_handle = reinterpret_cast<HANDLE>( | 189 (options.handshake_handle = IntToHandle(handle_uint)) == |
192 static_cast<int>(handle_uint))) == INVALID_HANDLE_VALUE) { | 190 INVALID_HANDLE_VALUE) { |
193 ToolSupport::UsageHint(me, "--handshake-handle requires a HANDLE"); | 191 ToolSupport::UsageHint(me, "--handshake-handle requires a HANDLE"); |
194 return EXIT_FAILURE; | 192 return EXIT_FAILURE; |
195 } | |
196 break; | 193 break; |
197 } | 194 } |
198 case kOptionPipeName: { | 195 case kOptionPipeName: { |
199 options.pipe_name = optarg; | 196 options.pipe_name = optarg; |
200 break; | 197 break; |
201 } | 198 } |
202 #endif // OS_MACOSX | 199 #endif // OS_MACOSX |
203 case kOptionURL: { | 200 case kOptionURL: { |
204 options.url = optarg; | 201 options.url = optarg; |
205 break; | 202 break; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 327 |
331 #if defined(OS_MACOSX) | 328 #if defined(OS_MACOSX) |
332 int main(int argc, char* argv[]) { | 329 int main(int argc, char* argv[]) { |
333 return crashpad::HandlerMain(argc, argv); | 330 return crashpad::HandlerMain(argc, argv); |
334 } | 331 } |
335 #elif defined(OS_WIN) | 332 #elif defined(OS_WIN) |
336 int wmain(int argc, wchar_t* argv[]) { | 333 int wmain(int argc, wchar_t* argv[]) { |
337 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); | 334 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); |
338 } | 335 } |
339 #endif // OS_MACOSX | 336 #endif // OS_MACOSX |
OLD | NEW |