blob: a9e62678d93086fbb04ce8a04274a69a48bf9622 [file] [log] [blame]
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <base/files/file_util.h>
#include <string>
class UserCollector;
class UserCollectorBase;
// Various methods and utilities for working with crashes that occur in a VM (as
// opposed to the host).
class VmSupport {
// If we are running in a VM, returns a handle to the VM-support wrapper,
// otherwise returns nullptr.
static VmSupport* Get();
virtual ~VmSupport();
// Add vm-specific info, such as the container OS and vm board, to
// |collector|'s crash metadata.
virtual void AddMetadata(UserCollector* collector) = 0;
// Perform the extra steps needed when reporting a crash in the VM, such as
// informing cicerone. |crash_meta_path| is a path to the .meta file, which we
// use to identify the necessary crash files.
virtual void FinishCrash(const base::FilePath& crash_meta_path) = 0;
// Query the host for metrics consent state.
virtual bool GetMetricsConsent() = 0;
// Perform extra checks to exclude |collector|'s crash for software CrOS
// doesn't care about (i.e. non first-party apps e.g. gedit). Returns |true|
// if we care about this crash, and if we don't explains why in |out_reason|.
virtual bool ShouldDump(pid_t pid, std::string* out_reason) = 0;