fuchsia: Get 'all' to build

Adds a zlib build file for when building standalone (rather than reusing
Chromium's, though the code still Chromium's patched copy). The separate
build file avoids including the code for minizip and other support
targets (instead, only the main libzlib.a static_library is defined).
The other libraries and executables won't build in the Crashpad repo, so
having a local build file means that all targets defined in the GN build
are buildable.

generate_dump is passing an invalid handle to ProcessSnapshotFuchsia as
there's not yet any utility to convert a pid to a handle. But that's no
great loss, because ProcessSnapshotFuchsia doesn't do anything itself
yet.

Bug: crashpad:79, crashpad:196
Change-Id: I11c918a30b60cc071465c919315b45caab1de870
Reviewed-on: https://chromium-review.googlesource.com/809354
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Scott Graham 2017-12-08 11:40:29 -08:00 committed by Commit Bot
parent 659420bc7d
commit 00e6bd0887
3 changed files with 89 additions and 10 deletions

View File

@ -56,7 +56,7 @@ int ExtendedHandlerMain(int argc, char* argv[]) {
} // namespace
#if defined(OS_MACOSX)
#if defined(OS_POSIX)
int main(int argc, char* argv[]) {
return ExtendedHandlerMain(argc, argv);
@ -68,4 +68,4 @@ int wmain(int argc, wchar_t* argv[]) {
return crashpad::ToolSupport::Wmain(argc, argv, &ExtendedHandlerMain);
}
#endif // OS_MACOSX
#endif // OS_POSIX

View File

@ -19,19 +19,87 @@ config("zlib_config") {
defines = [ "CRASHPAD_ZLIB_SOURCE_CHROMIUM" ]
} else {
defines = [ "CRASHPAD_ZLIB_SOURCE_EMBEDDED" ]
include_dirs = [ "zlib" ]
}
}
group("zlib") {
public_configs = [ ":zlib_config" ]
if (crashpad_in_chromium) {
if (crashpad_in_chromium) {
group("zlib") {
public_configs = [ ":zlib_config" ]
public_deps = [
"//third_party/zlib",
]
} else {
public_deps = [
"//third_party/zlib/zlib",
}
} else {
static_library("zlib") {
sources = [
"zlib/adler32.c",
"zlib/compress.c",
"zlib/crc32.c",
"zlib/crc32.h",
"zlib/deflate.c",
"zlib/deflate.h",
"zlib/gzclose.c",
"zlib/gzguts.h",
"zlib/gzlib.c",
"zlib/gzread.c",
"zlib/gzwrite.c",
"zlib/infback.c",
"zlib/inffast.c",
"zlib/inffast.h",
"zlib/inffixed.h",
"zlib/inflate.c",
"zlib/inflate.h",
"zlib/inftrees.c",
"zlib/inftrees.h",
"zlib/names.h",
"zlib/trees.c",
"zlib/trees.h",
"zlib/uncompr.c",
"zlib/zconf.h",
"zlib/zlib.h",
"zlib/zlib_crashpad.h",
"zlib/zutil.c",
"zlib/zutil.h",
]
cflags = []
defines = [ "HAVE_STDARG_H" ]
public_configs = [ ":zlib_config" ]
if (is_win) {
cflags += [
"/wd4131", # uses old-style declarator
"/wd4244", # conversion from 't1' to 't2', possible loss of data
"/wd4245", # conversion from 't1' to 't2', signed/unsigned mismatch
"/wd4267", # conversion from 'size_t' to 't', possible loss of data
"/wd4324", # structure was padded due to alignment specifier
]
} else {
defines += [
"HAVE_HIDDEN",
"HAVE_UNISTD_H",
]
}
if (current_cpu == "x86" || current_cpu == "x64") {
sources += [
"zlib/crc_folding.c",
"zlib/fill_window_sse.c",
"zlib/x86.c",
"zlib/x86.h",
]
if (!is_win || is_clang) {
cflags += [
"-msse4.2",
"-mpclmul",
]
}
if (is_clang) {
cflags += [ "-Wno-incompatible-pointer-types" ]
}
} else {
sources += [ "zlib/simd_stub.c" ]
}
}
}

View File

@ -29,9 +29,12 @@
#include "util/posix/drop_privileges.h"
#include "util/stdlib/string_number_conversion.h"
#if defined(OS_POSIX)
#include <unistd.h>
#endif
#if defined(OS_MACOSX)
#include <mach/mach.h>
#include <unistd.h>
#include "base/mac/scoped_mach_port.h"
#include "snapshot/mac/process_snapshot_mac.h"
@ -42,6 +45,8 @@
#include "snapshot/win/process_snapshot_win.h"
#include "util/win/scoped_process_suspend.h"
#include "util/win/xp_compat.h"
#elif defined(OS_FUCHSIA)
#include "snapshot/fuchsia/process_snapshot_fuchsia.h"
#endif // OS_MACOSX
namespace crashpad {
@ -188,6 +193,12 @@ int GenerateDumpMain(int argc, char* argv[]) {
0)) {
return EXIT_FAILURE;
}
#elif defined(OS_FUCHSIA)
ProcessSnapshotFuchsia process_snapshot;
// TODO(scottmg): https://crashpad.chromium.org/bug/196.
if (!process_snapshot.Initialize(ZX_HANDLE_INVALID)) {
return EXIT_FAILURE;
}
#endif // OS_MACOSX
FileWriter file_writer;