| 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 16 matching lines...) Expand all Loading... |
| 27 #include "client/crashpad_client.h" | 27 #include "client/crashpad_client.h" |
| 28 #include "tools/tool_support.h" | 28 #include "tools/tool_support.h" |
| 29 #include "handler/crash_report_upload_thread.h" | 29 #include "handler/crash_report_upload_thread.h" |
| 30 #include "util/stdlib/map_insert.h" | 30 #include "util/stdlib/map_insert.h" |
| 31 #include "util/stdlib/string_number_conversion.h" | 31 #include "util/stdlib/string_number_conversion.h" |
| 32 #include "util/string/split_string.h" | 32 #include "util/string/split_string.h" |
| 33 #include "util/synchronization/semaphore.h" | 33 #include "util/synchronization/semaphore.h" |
| 34 | 34 |
| 35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
| 36 #include <libgen.h> | 36 #include <libgen.h> |
| 37 #include "base/mac/scoped_mach_port.h" |
| 37 #include "handler/mac/crash_report_exception_handler.h" | 38 #include "handler/mac/crash_report_exception_handler.h" |
| 38 #include "handler/mac/exception_handler_server.h" | 39 #include "handler/mac/exception_handler_server.h" |
| 39 #include "util/mach/child_port_handshake.h" | 40 #include "util/mach/child_port_handshake.h" |
| 40 #include "util/posix/close_stdio.h" | 41 #include "util/posix/close_stdio.h" |
| 41 #elif defined(OS_WIN) | 42 #elif defined(OS_WIN) |
| 42 #include <windows.h> | 43 #include <windows.h> |
| 43 #include "handler/win/crash_report_exception_handler.h" | 44 #include "handler/win/crash_report_exception_handler.h" |
| 44 #include "util/win/exception_handler_server.h" | 45 #include "util/win/exception_handler_server.h" |
| 45 #endif // OS_MACOSX | 46 #endif // OS_MACOSX |
| 46 | 47 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ToolSupport::UsageHint(me, "--database is required"); | 205 ToolSupport::UsageHint(me, "--database is required"); |
| 205 return EXIT_FAILURE; | 206 return EXIT_FAILURE; |
| 206 } | 207 } |
| 207 | 208 |
| 208 if (argc) { | 209 if (argc) { |
| 209 ToolSupport::UsageHint(me, nullptr); | 210 ToolSupport::UsageHint(me, nullptr); |
| 210 return EXIT_FAILURE; | 211 return EXIT_FAILURE; |
| 211 } | 212 } |
| 212 | 213 |
| 213 #if defined(OS_MACOSX) | 214 #if defined(OS_MACOSX) |
| 215 CloseStdinAndStdout(); |
| 216 |
| 214 if (options.reset_own_crash_exception_port_to_system_default) { | 217 if (options.reset_own_crash_exception_port_to_system_default) { |
| 215 CrashpadClient::UseSystemDefaultHandler(); | 218 CrashpadClient::UseSystemDefaultHandler(); |
| 216 } | 219 } |
| 217 #endif | |
| 218 | 220 |
| 219 #if defined(OS_MACOSX) | 221 base::mac::ScopedMachReceiveRight receive_right( |
| 220 ExceptionHandlerServer exception_handler_server; | 222 ChildPortHandshake::RunServerForFD( |
| 221 | |
| 222 CloseStdinAndStdout(); | |
| 223 if (!ChildPortHandshake::RunClientForFD( | |
| 224 base::ScopedFD(options.handshake_fd), | 223 base::ScopedFD(options.handshake_fd), |
| 225 exception_handler_server.receive_port(), | 224 ChildPortHandshake::PortRightType::kReceiveRight)); |
| 226 MACH_MSG_TYPE_MAKE_SEND)) { | 225 if (!receive_right.is_valid()) { |
| 227 return EXIT_FAILURE; | 226 return EXIT_FAILURE; |
| 228 } | 227 } |
| 228 |
| 229 ExceptionHandlerServer exception_handler_server(receive_right.Pass()); |
| 229 #elif defined(OS_WIN) | 230 #elif defined(OS_WIN) |
| 230 ExceptionHandlerServer exception_handler_server(options.pipe_name); | 231 ExceptionHandlerServer exception_handler_server(options.pipe_name); |
| 231 #endif // OS_MACOSX | 232 #endif // OS_MACOSX |
| 232 | 233 |
| 233 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( | 234 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( |
| 234 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( | 235 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( |
| 235 options.database)))); | 236 options.database)))); |
| 236 if (!database) { | 237 if (!database) { |
| 237 return EXIT_FAILURE; | 238 return EXIT_FAILURE; |
| 238 } | 239 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 255 | 256 |
| 256 #if defined(OS_MACOSX) | 257 #if defined(OS_MACOSX) |
| 257 int main(int argc, char* argv[]) { | 258 int main(int argc, char* argv[]) { |
| 258 return crashpad::HandlerMain(argc, argv); | 259 return crashpad::HandlerMain(argc, argv); |
| 259 } | 260 } |
| 260 #elif defined(OS_WIN) | 261 #elif defined(OS_WIN) |
| 261 int wmain(int argc, wchar_t* argv[]) { | 262 int wmain(int argc, wchar_t* argv[]) { |
| 262 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); | 263 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); |
| 263 } | 264 } |
| 264 #endif // OS_MACOSX | 265 #endif // OS_MACOSX |
| OLD | NEW |