chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc

// Copyright 2014 The Crashpad Authors
//
// 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.

#include "minidump/minidump_context_writer.h"

#include <windows.h>
#include <dbghelp.h>
#include <stdint.h>
#include <string.h>

#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "snapshot/cpu_context.h"
#include "util/file/file_writer.h"
#include "util/stdlib/aligned_allocator.h"

namespace crashpad {

namespace {

// Sanity-check complex structures to ensure interoperability.
static_assert;
static_assert;

// These structures can also be checked against definitions in the Windows SDK.
#if BUILDFLAG(IS_WIN)
#if defined(ARCH_CPU_X86_FAMILY)
static_assert(sizeof(MinidumpContextX86) == sizeof(WOW64_CONTEXT),
              "WOW64_CONTEXT size");
#if defined(ARCH_CPU_X86)
static_assert(sizeof(MinidumpContextX86) == sizeof(CONTEXT), "CONTEXT size");
#elif defined(ARCH_CPU_X86_64)
static_assert(sizeof(MinidumpContextAMD64) == sizeof(CONTEXT), "CONTEXT size");
#endif
#endif  // ARCH_CPU_X86_FAMILY
#endif  // BUILDFLAG(IS_WIN)

}  // namespace

MinidumpContextWriter::~MinidumpContextWriter() {}

// static
std::unique_ptr<MinidumpContextWriter>
MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {}

size_t MinidumpContextWriter::SizeOfObject() {}

size_t MinidumpContextWriter::FreezeAndGetSizeOfObject() {}

MinidumpContextX86Writer::MinidumpContextX86Writer()
    :{}

MinidumpContextX86Writer::~MinidumpContextX86Writer() {}

void MinidumpContextX86Writer::InitializeFromSnapshot(
    const CPUContextX86* context_snapshot) {}

bool MinidumpContextX86Writer::WriteObject(FileWriterInterface* file_writer) {}

size_t MinidumpContextX86Writer::ContextSize() const {}

static_assert;
static_assert;

MinidumpContextAMD64Writer::MinidumpContextAMD64Writer()
    :{}

MinidumpContextAMD64Writer::~MinidumpContextAMD64Writer() {}

// static
void* MinidumpContextAMD64Writer::operator new(size_t size) {}

// static
void MinidumpContextAMD64Writer::operator delete(void* pointer) {}

void MinidumpContextAMD64Writer::InitializeFromSnapshot(
    const CPUContextX86_64* context_snapshot) {}

size_t MinidumpContextAMD64Writer::Alignment() {}

bool MinidumpContextAMD64Writer::WriteObject(FileWriterInterface* file_writer) {}

size_t MinidumpContextAMD64Writer::ContextSize() const {}

bool MinidumpXSaveAMD64CetU::InitializeFromSnapshot(
    const CPUContextX86_64* context_snapshot) {}

bool MinidumpXSaveAMD64CetU::Copy(void* dst) const {}

MinidumpContextARMWriter::MinidumpContextARMWriter()
    :{}

MinidumpContextARMWriter::~MinidumpContextARMWriter() = default;

void MinidumpContextARMWriter::InitializeFromSnapshot(
    const CPUContextARM* context_snapshot) {}

bool MinidumpContextARMWriter::WriteObject(FileWriterInterface* file_writer) {}

size_t MinidumpContextARMWriter::ContextSize() const {}

MinidumpContextARM64Writer::MinidumpContextARM64Writer()
    :{}

MinidumpContextARM64Writer::~MinidumpContextARM64Writer() = default;

void MinidumpContextARM64Writer::InitializeFromSnapshot(
    const CPUContextARM64* context_snapshot) {}

bool MinidumpContextARM64Writer::WriteObject(FileWriterInterface* file_writer) {}

size_t MinidumpContextARM64Writer::ContextSize() const {}

MinidumpContextMIPSWriter::MinidumpContextMIPSWriter()
    :{}

MinidumpContextMIPSWriter::~MinidumpContextMIPSWriter() = default;

void MinidumpContextMIPSWriter::InitializeFromSnapshot(
    const CPUContextMIPS* context_snapshot) {}

bool MinidumpContextMIPSWriter::WriteObject(FileWriterInterface* file_writer) {}

size_t MinidumpContextMIPSWriter::ContextSize() const {}

MinidumpContextMIPS64Writer::MinidumpContextMIPS64Writer()
    :{}

MinidumpContextMIPS64Writer::~MinidumpContextMIPS64Writer() = default;

void MinidumpContextMIPS64Writer::InitializeFromSnapshot(
    const CPUContextMIPS64* context_snapshot) {}

bool MinidumpContextMIPS64Writer::WriteObject(
    FileWriterInterface* file_writer) {}

size_t MinidumpContextMIPS64Writer::ContextSize() const {}

MinidumpContextRISCV64Writer::MinidumpContextRISCV64Writer()
    :{}

MinidumpContextRISCV64Writer::~MinidumpContextRISCV64Writer() = default;

void MinidumpContextRISCV64Writer::InitializeFromSnapshot(
    const CPUContextRISCV64* context_snapshot) {}

bool MinidumpContextRISCV64Writer::WriteObject(
    FileWriterInterface* file_writer) {}

size_t MinidumpContextRISCV64Writer::ContextSize() const {}

}  // namespace crashpad