| 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, |
| 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 <getopt.h> | 15 #include <getopt.h> |
| 16 #include <stdlib.h> | 16 #include <stdlib.h> |
| 17 | 17 |
| 18 #include <map> | 18 #include <map> |
| 19 #include <string> | 19 #include <string> |
| 20 | 20 |
| 21 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
| 22 #include "base/files/scoped_file.h" |
| 22 #include "base/logging.h" | 23 #include "base/logging.h" |
| 23 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
| 24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "client/crash_report_database.h" | 26 #include "client/crash_report_database.h" |
| 26 #include "client/crashpad_client.h" | 27 #include "client/crashpad_client.h" |
| 27 #include "tools/tool_support.h" | 28 #include "tools/tool_support.h" |
| 28 #include "handler/crash_report_upload_thread.h" | 29 #include "handler/crash_report_upload_thread.h" |
| 29 #include "util/stdlib/map_insert.h" | 30 #include "util/stdlib/map_insert.h" |
| 30 #include "util/stdlib/string_number_conversion.h" | 31 #include "util/stdlib/string_number_conversion.h" |
| 31 #include "util/string/split_string.h" | 32 #include "util/string/split_string.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 #if defined(OS_MACOSX) | 213 #if defined(OS_MACOSX) |
| 213 if (options.reset_own_crash_exception_port_to_system_default) { | 214 if (options.reset_own_crash_exception_port_to_system_default) { |
| 214 CrashpadClient::UseSystemDefaultHandler(); | 215 CrashpadClient::UseSystemDefaultHandler(); |
| 215 } | 216 } |
| 216 #endif | 217 #endif |
| 217 | 218 |
| 218 ExceptionHandlerServer exception_handler_server; | 219 ExceptionHandlerServer exception_handler_server; |
| 219 | 220 |
| 220 #if defined(OS_MACOSX) | 221 #if defined(OS_MACOSX) |
| 221 CloseStdinAndStdout(); | 222 CloseStdinAndStdout(); |
| 222 ChildPortHandshake::RunClient(options.handshake_fd, | 223 if (!ChildPortHandshake::RunClientForFD( |
| 223 exception_handler_server.receive_port(), | 224 base::ScopedFD(options.handshake_fd), |
| 224 MACH_MSG_TYPE_MAKE_SEND); | 225 exception_handler_server.receive_port(), |
| 226 MACH_MSG_TYPE_MAKE_SEND)) { |
| 227 return EXIT_FAILURE; |
| 228 } |
| 225 #endif // OS_MACOSX | 229 #endif // OS_MACOSX |
| 226 | 230 |
| 227 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( | 231 scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize( |
| 228 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( | 232 base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType( |
| 229 options.database)))); | 233 options.database)))); |
| 230 if (!database) { | 234 if (!database) { |
| 231 return EXIT_FAILURE; | 235 return EXIT_FAILURE; |
| 232 } | 236 } |
| 233 | 237 |
| 234 CrashReportUploadThread upload_thread(database.get(), options.url); | 238 CrashReportUploadThread upload_thread(database.get(), options.url); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 253 | 257 |
| 254 #if defined(OS_MACOSX) | 258 #if defined(OS_MACOSX) |
| 255 int main(int argc, char* argv[]) { | 259 int main(int argc, char* argv[]) { |
| 256 return crashpad::HandlerMain(argc, argv); | 260 return crashpad::HandlerMain(argc, argv); |
| 257 } | 261 } |
| 258 #elif defined(OS_WIN) | 262 #elif defined(OS_WIN) |
| 259 int wmain(int argc, wchar_t* argv[]) { | 263 int wmain(int argc, wchar_t* argv[]) { |
| 260 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); | 264 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::HandlerMain); |
| 261 } | 265 } |
| 262 #endif // OS_MACOSX | 266 #endif // OS_MACOSX |
| OLD | NEW |