From d2a866978b89508f9397266bfe0253755383899f Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Mon, 19 Feb 2018 11:11:38 -0800 Subject: [PATCH] Makes 'all' build on Linux I can never remember which targets are buildable; this makes just ninja -C out/lin work, without too much fuss. I think this means we could turn on trybots too, as I think all the tests that are built also run. Bug: crashpad:30 Change-Id: I4759bb799dabf977c5b072691f28d00bf92bbebc Reviewed-on: https://chromium-review.googlesource.com/924564 Reviewed-by: Joshua Peraza Commit-Queue: Scott Graham --- handler/BUILD.gn | 7 ++----- handler/handler.gyp | 2 +- handler/handler_main.cc | 15 +++++++++++---- tools/generate_dump.cc | 8 ++++++++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/handler/BUILD.gn b/handler/BUILD.gn index 7cf4c3d9..c817393b 100644 --- a/handler/BUILD.gn +++ b/handler/BUILD.gn @@ -18,6 +18,8 @@ static_library("handler") { sources = [ "crash_report_upload_thread.cc", "crash_report_upload_thread.h", + "handler_main.cc", + "handler_main.h", "minidump_to_upload_parameters.cc", "minidump_to_upload_parameters.h", "prune_crash_reports_thread.cc", @@ -44,11 +46,6 @@ static_library("handler") { "linux/exception_handler_server.cc", "linux/exception_handler_server.h", ] - } else { - sources += [ - "handler_main.cc", - "handler_main.h", - ] } if (crashpad_is_win) { diff --git a/handler/handler.gyp b/handler/handler.gyp index fb5de2a8..f29706cd 100644 --- a/handler/handler.gyp +++ b/handler/handler.gyp @@ -59,7 +59,7 @@ 'win/crash_report_exception_handler.h', ], 'conditions': [ - ['OS=="linux" or OS=="android"', { + ['OS=="android"', { 'sources!': [ 'handler_main.cc', ], diff --git a/handler/handler_main.cc b/handler/handler_main.cc index f175fddf..c5e35bfc 100644 --- a/handler/handler_main.cc +++ b/handler/handler_main.cc @@ -77,6 +77,9 @@ #elif defined(OS_FUCHSIA) #include "handler/fuchsia/crash_report_exception_handler.h" #include "handler/fuchsia/exception_handler_server.h" +#elif defined(OS_LINUX) +#include "handler/linux/crash_report_exception_handler.h" +#include "handler/linux/exception_handler_server.h" #endif // OS_MACOSX namespace crashpad { @@ -348,14 +351,18 @@ void InstallCrashHandler() { ALLOW_UNUSED_LOCAL(terminate_handler); } -#elif defined(OS_FUCHSIA) +#elif defined(OS_FUCHSIA) || defined(OS_LINUX) void InstallCrashHandler() { - NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196 + // TODO(scottmg): Fuchsia: https://crashpad.chromium.org/bug/196 + // TODO(jperaza): Linux: https://crashpad.chromium.org/bug/30 + NOTREACHED(); } void ReinstallCrashHandler() { - NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196 + // TODO(scottmg): Fuchsia: https://crashpad.chromium.org/bug/196 + // TODO(jperaza): Linux: https://crashpad.chromium.org/bug/30 + NOTREACHED(); } #endif // OS_MACOSX @@ -740,7 +747,7 @@ int HandlerMain(int argc, if (!options.pipe_name.empty()) { exception_handler_server.SetPipeName(base::UTF8ToUTF16(options.pipe_name)); } -#elif defined(OS_FUCHSIA) +#elif defined(OS_FUCHSIA) || defined(OS_LINUX) ExceptionHandlerServer exception_handler_server; #endif // OS_MACOSX diff --git a/tools/generate_dump.cc b/tools/generate_dump.cc index a470bfd0..c1fbde84 100644 --- a/tools/generate_dump.cc +++ b/tools/generate_dump.cc @@ -47,6 +47,8 @@ #include "util/win/xp_compat.h" #elif defined(OS_FUCHSIA) #include "snapshot/fuchsia/process_snapshot_fuchsia.h" +#elif defined(OS_LINUX) +#include "snapshot/linux/process_snapshot_linux.h" #endif // OS_MACOSX namespace crashpad { @@ -199,6 +201,12 @@ int GenerateDumpMain(int argc, char* argv[]) { if (!process_snapshot.Initialize(ZX_HANDLE_INVALID)) { return EXIT_FAILURE; } +#elif defined(OS_LINUX) + // TODO(jperaza): https://crashpad.chromium.org/bug/30. + ProcessSnapshotLinux process_snapshot; + if (!process_snapshot.Initialize(nullptr)) { + return EXIT_FAILURE; + } #endif // OS_MACOSX FileWriter file_writer;