Skip to content

Commit

Permalink
Update Crashpad to c27a1aaea0861852c6d92945b68856586e0cd51d
Browse files Browse the repository at this point in the history
14dbd3531d98 gn win: Get main test binaries building
6cf4f928eb08 gn win: Add auxiliary test binaries used by
             end_to_end_test.py
36679d572ba0 win: Don't assume offsets the same when
             kDoesNotObserveDaylightSavingTime
9ab4fbf1e1a7 win: Improve child crash location test
798f6540435f gn win: Use new toolchain names to support both x86 and x64
83a83c5b0050 Roll mini_chromium to e7e8237
a483e2c599b8 Fix names of Windows trybots after server-side rename
38b20ca57efc Relocate CaptureContext to misc and implement on Linux
a8ad3bdbdfb1 linux: fix incorrect fallthrough
73e862e15a6c fuchsia: Exclude capture_context_test.cc from test build
b83f4c731d8f Let UUID::InitializeFromString accept StringPiece16 too
f878f155172b fuchsia: Add flock() stub to get test binaries linking
             again
e5bbdaff87a9 Pass FilePath to Settings in Initialize()
c45ba7920e01 Make NewReport objects own their associated database
             resources
7d5487fc44b3 minidump: add switch cases to handle linux/android and ARM
c406797ce620 Add  UploadReport to manage database resources during
             upload
7faa2ef89872 Get CrashpadInfo address via a .note, rather than dynamic
             symtab
8d0d999d9245 Add a cross-platform database implementation
b43858c9903f fuchsia: Start of ModuleSnapshot and ProcessReader
             implementations
6667fa25595a fuchsia: Fixes to TestPaths
90cde8e30f7d Disable upload on Android
4094c2628d33 Address review comments for 8d0d999
a4d7fb4cc390 Use .long for pointers on 32-bit platforms
5e5b927b38ca Build crashpad_client_linux.cc on Android
eec1e17ab558 Fix two bugs in memset()ing CrashpadInfo on size mismatch
4717300fa4ce Reset CrashpadInfo after CrashpadInfoReader tests
f9d160ffc6bb Revert "Reset CrashpadInfo after CrashpadInfoReader tests"
6798ba912e96 Reset CrashpadInfo after CrashpadInfoReader tests
0429216f59b1 linux: Add CrashReportExceptionHandler
f38af628c9dc fuchsia: Don't fail rename if source == dest
040360239343 Fix
             CrashpadInfoSizes_ClientOptions/CrashpadInfoSizes_ClientOpt
             ions
10222b12362c fuchsia: Disable TimeZone.Basic test as timezones are non-
             functional
5cb869392eed fuchsia: Compile out LoggingLock/UnlockFile, add DCHECKs to
             Settings
4b7895615808 Add .hidden to CRASHPAD_NOTE_REFERENCE
8ee14eef08f3 fuchsia: Fix some packaging when run isn't from Crashpad
             source root
4a9d422652a1 Turn fuchsia trybots on by default
ec33c25797f9 fuchsia: Don't include sys/resource.h, recently removed
             from SDK
8b738cd24d59 Don't include crash_report_database_generic.cc on Win/Mac
d2a866978b89 Makes 'all' build on Linux
d8d03172c278 arm: Capture context around pc and registers
ebad8bd925c3 Don't spawn an upload thread if url is empty
0520fdff1edc linux: Move ScopedPrSetPtracer to util/
38540eaf71cb Add handler options for Linux/Android
01105719d767 linux: add CRASHPAD_SIMULATE_CRASH()
3dd85dc12638 fuchsia: Make ImageAnnotationReader[Test] work
cab259330f2e fuchsia: Pass more data out of module snapshot
1aae5cedaf1e Refactor ModuleSnapshot(Linux|Fuchsia) into
             ModuleSnapshotElf
4d96e4e504ef fuchsia: Return ModuleSnapshot* out of
             ProcessSnapshotFuchsia
2290a826af1e Pull (most) platform-specific MemorySnapshots out
3030ae54171a fuchsia: Fix ninja auto-regen after run
61f1013ee4ef fuchsia: Add some thread reading to ProcessReader and a
             test
c69ba3d52783 non-win: Add
             Multiprocess::SetExpectedChildTerminationBuiltinTrap()
f130822b9f4b linux: Add CrashpadClient tests
2b05eb522fa4 Rename ProcessReader to platform-suffixed versions
fa2a03fbdd0f linux: Add CrashpadClient::SetFirstChanceExceptionHandler()
cd3afe616e63 Linux: Pull and use clang toolchain in third_party
8e80a575d15f Linux: Pull a sysroot if pulling a local clang
fae18c2fc492 fuchsia: Add implementation of ThreadSnapshot
a869ae18d256 Workaround for death test failure when in threadsafe mode
             on Mac
8a12f5893050 fuchsia: Take bots off CQ pending flake investigation
9affa2a0e72d Optionally stub out the libcurl-based implementation of
             HTTPTransport
dec23bef5769 win gn: reintroduce flags to disable warnings
746ce1a63703 Roll mini_chromium to 987bde8
493e29bc3df0 win: Use correct format specifier
a45e88602b90 Skip ELF notes with a p_vaddr of zero
71d90608828d Add Linux trybots to CQ
449506d59c6a Roll mini_chromium to ef0df11
82777cff5848 win: fix warnings when building with clang
23b2156fb694 Don’t read beyond a StringPiece’s bounds in
             StringToNumber()
4375233ad2da win: fix 64-bit build
8175825f45fd win: use version.lib instead of mincore.lib
07da37aec70e win: fix crashy test program
c27a1aaea086 win: Fix -Wmicrosoft-cast warning

Also,
Add new metrics enums values.
Use the new CrashReportDatabase interface.

Bug: crashpad:30

Change-Id: I36a6469046983c6ffdb1512436a915ee1a7bb49d
Reviewed-on: https://chromium-review.googlesource.com/959764
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Sigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542807}
  • Loading branch information
Joshua Peraza authored and Commit Bot committed Mar 13, 2018
1 parent f8fb405 commit 33d5aa2
Show file tree
Hide file tree
Showing 178 changed files with 5,491 additions and 1,976 deletions.
17 changes: 6 additions & 11 deletions components/browser_watcher/postmortem_report_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,30 +224,27 @@ void PostmortemReportCollector::GenerateCrashReport(
DCHECK(report_proto);

// Prepare a crashpad report.
CrashReportDatabase::NewReport* new_report = nullptr;
std::unique_ptr<CrashReportDatabase::NewReport> new_report;
CrashReportDatabase::OperationStatus database_status =
report_database_->PrepareNewCrashReport(&new_report);
if (database_status != CrashReportDatabase::kNoError) {
LogCollectionStatus(PREPARE_NEW_CRASH_REPORT_FAILED);
return;
}
CrashReportDatabase::CallErrorWritingCrashReport
call_error_writing_crash_report(report_database_, new_report);

// Write the report to a minidump.
if (!WriteReportToMinidump(report_proto, client_id, new_report->uuid,
reinterpret_cast<FILE*>(new_report->handle))) {
if (!WriteReportToMinidump(report_proto, client_id, new_report->ReportID(),
new_report->Writer())) {
LogCollectionStatus(WRITE_TO_MINIDUMP_FAILED);
return;
}

// Finalize the report wrt the report database. Note that this doesn't trigger
// an immediate upload, but Crashpad will eventually upload the report (as of
// writing, the delay is on the order of up to 15 minutes).
call_error_writing_crash_report.Disarm();
crashpad::UUID unused_report_id;
database_status = report_database_->FinishedWritingCrashReport(
new_report, &unused_report_id);
std::move(new_report), &unused_report_id);
if (database_status != CrashReportDatabase::kNoError) {
LogCollectionStatus(FINISHED_WRITING_CRASH_REPORT_FAILED);
return;
Expand All @@ -260,11 +257,9 @@ bool PostmortemReportCollector::WriteReportToMinidump(
StabilityReport* report,
const crashpad::UUID& client_id,
const crashpad::UUID& report_id,
base::PlatformFile minidump_file) {
crashpad::FileWriterInterface* minidump_file) {
DCHECK(report);

crashpad::WeakFileHandleFileWriter writer(minidump_file);
return WritePostmortemDump(&writer, client_id, report_id, report);
return WritePostmortemDump(minidump_file, client_id, report_id, report);
}

} // namespace browser_watcher
11 changes: 6 additions & 5 deletions components/browser_watcher/postmortem_report_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <vector>

#include "base/debug/activity_analyzer.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
Expand All @@ -25,6 +24,7 @@
#include "components/browser_watcher/stability_report_extractor.h"
#include "components/metrics/system_session_analyzer_win.h"
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#include "third_party/crashpad/crashpad/util/file/file_writer.h"

namespace browser_watcher {

Expand Down Expand Up @@ -94,10 +94,11 @@ class PostmortemReportCollector {
void GenerateCrashReport(const crashpad::UUID& client_id,
StabilityReport* report_proto);

virtual bool WriteReportToMinidump(StabilityReport* report,
const crashpad::UUID& client_id,
const crashpad::UUID& report_id,
base::PlatformFile minidump_file);
virtual bool WriteReportToMinidump(
StabilityReport* report,
const crashpad::UUID& client_id,
const crashpad::UUID& report_id,
crashpad::FileWriterInterface* minidump_file);

std::string product_name_;
std::string version_number_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class MockPostmortemReportCollector final : public PostmortemReportCollector {
bool(StabilityReport* report,
const crashpad::UUID& client_id,
const crashpad::UUID& report_id,
base::PlatformFile minidump_file));
crashpad::FileWriterInterface* minidump_file));
};

class MockSystemSessionAnalyzer : public metrics::SystemSessionAnalyzer {
Expand Down
28 changes: 9 additions & 19 deletions components/crash/content/app/minidump_with_crashpad_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ bool MiniDumpWriteDumpWithCrashpadInfo(const base::Process& process,

// Appends the full contents of |source| to |dest| from the current position
// of |dest|.
bool AppendFileContents(base::File* source, base::PlatformFile dest) {
bool AppendFileContents(base::File* source, crashpad::FileWriter* dest) {
DCHECK(source && source->IsValid());
DCHECK_NE(base::kInvalidPlatformFile, dest);
DCHECK(dest);

// Rewind the source.
if (source->Seek(base::File::FROM_BEGIN, 0) == -1)
Expand All @@ -292,16 +292,12 @@ bool AppendFileContents(base::File* source, base::PlatformFile dest) {
while (true) {
int bytes_read =
source->ReadAtCurrentPos(&buf[0], static_cast<int>(buf.size()));
if (bytes_read == -1)
if (bytes_read < 0)
return false;
if (bytes_read == 0)
break;

DWORD bytes_written = 0;
// Due to handle instrumentation, the destination can't be wrapped in
// a base::File, so we go basic Win32 API here.
if (!WriteFile(dest, &buf[0], bytes_read, &bytes_written, nullptr) ||
static_cast<int>(bytes_written) != bytes_read) {
if (!dest->Write(&buf[0], static_cast<size_t>(bytes_read))) {
return false;
}
}
Expand All @@ -323,16 +319,12 @@ bool DumpAndReportProcess(const base::Process& process,
if (!database)
return false;

crashpad::CrashReportDatabase::NewReport* report = nullptr;
std::unique_ptr<crashpad::CrashReportDatabase::NewReport> report;
crashpad::CrashReportDatabase::OperationStatus status =
database->PrepareNewCrashReport(&report);
if (status != crashpad::CrashReportDatabase::kNoError)
return false;

// Make sure we release the report on early exit.
crashpad::CrashReportDatabase::CallErrorWritingCrashReport on_error(
database.get(), report);

crashpad::UUID client_id;
crashpad::Settings* settings = database->GetSettings();
if (settings) {
Expand All @@ -357,16 +349,14 @@ bool DumpAndReportProcess(const base::Process& process,
// Write the minidump to the temp file, and then copy the data to the
// Crashpad-provided handle, as the latter is only open for write.
if (!MiniDumpWriteDumpWithCrashpadInfo(process, minidump_type, exc_info,
crash_keys, client_id, report->uuid,
&dump_file) ||
!AppendFileContents(&dump_file, report->handle)) {
crash_keys, client_id,
report->ReportID(), &dump_file) ||
!AppendFileContents(&dump_file, report->Writer())) {
return false;
}

on_error.Disarm();

crashpad::UUID report_id = {};
status = database->FinishedWritingCrashReport(report, &report_id);
status = database->FinishedWritingCrashReport(std::move(report), &report_id);
if (status != crashpad::CrashReportDatabase::kNoError)
return false;

Expand Down
8 changes: 1 addition & 7 deletions third_party/crashpad/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: Crashpad
Short Name: crashpad
URL: https://crashpad.chromium.org/
Version: unknown
Revision: a8ecdbc973d969a87aaa2efffb1668efb52b799d
Revision: c27a1aaea0861852c6d92945b68856586e0cd51d
License: Apache 2.0
License File: crashpad/LICENSE
Security Critical: yes
Expand Down Expand Up @@ -37,9 +37,3 @@ $ git am --3way --message-id -p4 /tmp/patchdir
Local Modifications:
- codereview.settings has been excluded.
- thread_log_messages.cc (using ThreadLocalStorage::Slot instead of StaticSlot)
- util/linux/memory_map.cc
- util/mach/symbolic_constants_mach.cc
- util/posix/symbolic_constants_posix.cc
- util/stdlib/string_number_conversion.h
- util/stdlib/string_number_conversion.cc
- util/stdlib/string_number_conversion_test.cc
3 changes: 3 additions & 0 deletions third_party/crashpad/crashpad/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
/third_party/fuchsia/qemu
/third_party/fuchsia/sdk
/third_party/gtest/gtest
/third_party/linux/.cipd
/third_party/linux/clang
/third_party/linux/sysroot
/third_party/gyp/gyp
/third_party/mini_chromium/mini_chromium
/third_party/zlib/zlib
Expand Down
41 changes: 35 additions & 6 deletions third_party/crashpad/crashpad/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

vars = {
'chromium_git': 'https://chromium.googlesource.com',
'pull_linux_clang': False
}

deps = {
Expand All @@ -28,7 +29,7 @@ deps = {
'5e2b3ddde7cda5eb6bc09a5546a76b00e49d888f',
'crashpad/third_party/mini_chromium/mini_chromium':
Var('chromium_git') + '/chromium/mini_chromium@' +
'3b953302848580cdf23b50402befc0ae09d03ff9',
'ef0df1119b40cfa2773d5960e239d4b960310869',
'crashpad/third_party/zlib/zlib':
Var('chromium_git') + '/chromium/src/third_party/zlib@' +
'13dc246a58e4b72104d35f9b1809af95221ebda7',
Expand Down Expand Up @@ -115,8 +116,37 @@ hooks = [
},
{
# This uses “cipd install” so that mac-amd64 and linux-amd64 can coexist
# peacefully. “cipd ensure” would remove the Linux package when running on a
# macOS build host and vice-versa. https://crbug.com/789364.
# peacefully. “cipd ensure” would remove the macOS package when running on a
# Linux build host and vice-versa. https://crbug.com/789364. This package is
# only updated when the solution in .gclient includes an entry like:
# "custom_vars": { "pull_linux_clang": True }
'name': 'clang_linux',
'pattern': '.',
'condition': 'checkout_linux and pull_linux_clang',
'action': [
'cipd',
'install',
# sic, using Fuchsia team's generic build of clang for linux-amd64 to
# build for linux-amd64 target too.
'fuchsia/clang/linux-amd64',
'latest',
'-root', 'crashpad/third_party/linux/clang/linux-amd64',
'-log-level', 'info',
],
},
{
# If using a local clang ("pull_linux_clang" above), also pull down a
# sysroot.
'name': 'clang_linux',
'pattern': '.',
'condition': 'checkout_linux and pull_linux_clang',
'action': [
'crashpad/build/install_linux_sysroot.py',
],
},
{
# Same rationale for using "install" rather than "ensure" as for first clang
# package. https://crbug.com/789364.
'name': 'fuchsia_clang_mac',
'pattern': '.',
'condition': 'checkout_fuchsia and host_os == "mac"',
Expand All @@ -130,9 +160,8 @@ hooks = [
],
},
{
# This uses “cipd install” so that mac-amd64 and linux-amd64 can coexist
# peacefully. “cipd ensure” would remove the macOS package when running on a
# Linux build host and vice-versa. https://crbug.com/789364.
# Same rationale for using "install" rather than "ensure" as for first clang
# package. https://crbug.com/789364.
'name': 'fuchsia_clang_linux',
'pattern': '.',
'condition': 'checkout_fuchsia and host_os == "linux"',
Expand Down
8 changes: 5 additions & 3 deletions third_party/crashpad/crashpad/build/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (current_cpu == "") {

if (current_os == "win") {
set_default_toolchain(
"//third_party/mini_chromium/mini_chromium/build:msvc_toolchain")
"//third_party/mini_chromium/mini_chromium/build:msvc_toolchain_$current_cpu")
} else {
set_default_toolchain(
"//third_party/mini_chromium/mini_chromium/build:gcc_like_toolchain")
Expand All @@ -54,8 +54,10 @@ _default_configs = [
]

_default_executable_configs =
_default_configs +
[ "//third_party/mini_chromium/mini_chromium/build:executable" ]
_default_configs + [
"//third_party/mini_chromium/mini_chromium/build:executable",
"//third_party/mini_chromium/mini_chromium/build:win_console",
]

set_defaults("source_set") {
configs = _default_configs
Expand Down
74 changes: 74 additions & 0 deletions third_party/crashpad/crashpad/build/install_linux_sysroot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env python

# Copyright 2018 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Various code adapted from:
# https://cs.chromium.org/chromium/src/build/linux/sysroot_scripts/install-sysroot.py

import os
import shutil
import subprocess
import sys
import urllib2


SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))

# Sysroot revision from:
# https://cs.chromium.org/chromium/src/build/linux/sysroot_scripts/sysroots.json
SERVER = 'https://commondatastorage.googleapis.com'
PATH = 'chrome-linux-sysroot/toolchain'
REVISION = '3c248ba4290a5ad07085b7af07e6785bf1ae5b66'
FILENAME = 'debian_stretch_amd64_sysroot.tar.xz'

def main():
url = '%s/%s/%s/%s' % (SERVER, PATH, REVISION, FILENAME)

sysroot = os.path.join(SCRIPT_DIR, os.pardir,
'third_party', 'linux', 'sysroot')

stamp = os.path.join(sysroot, '.stamp')
if os.path.exists(stamp):
with open(stamp) as s:
if s.read() == url:
return

print 'Installing Debian root image from %s' % url

if os.path.isdir(sysroot):
shutil.rmtree(sysroot)
os.mkdir(sysroot)
tarball = os.path.join(sysroot, FILENAME)
print 'Downloading %s' % url

for _ in range(3):
response = urllib2.urlopen(url)
with open(tarball, 'wb') as f:
f.write(response.read())
break
else:
raise Exception('Failed to download %s' % url)

subprocess.check_call(['tar', 'xf', tarball, '-C', sysroot])

os.remove(tarball)

with open(stamp, 'w') as s:
s.write(url)


if __name__ == '__main__':
main()
sys.exit(0)
Loading

0 comments on commit 33d5aa2

Please sign in to comment.