#include "minidump/test/minidump_writable_test_util.h"
#include <stddef.h>
#include <string>
#include "gtest/gtest.h"
#include "util/file/file_writer.h"
#include "util/misc/implicit_cast.h"
#include "util/numeric/in_range_cast.h"
namespace crashpad {
namespace test {
namespace {
template <typename RVAType>
const void* MinidumpWritableAtRVAInternal(const std::string& file_contents,
RVAType rva) { … }
template <typename RVAType, typename MinidumpLocationDescriptorType>
const void* TMinidumpWritableAtLocationDescriptorInternal(
const std::string& file_contents,
const MinidumpLocationDescriptorType& location,
size_t expected_size,
bool allow_oversized_data) { … }
}
const void* MinidumpWritableAtLocationDescriptorInternal(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location,
size_t expected_size,
bool allow_oversized_data) { … }
const void* MinidumpWritableAtLocationDescriptorInternal(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR64& location,
size_t expected_size,
bool allow_oversized_data) { … }
template <>
const IMAGE_DEBUG_MISC* MinidumpWritableAtLocationDescriptor<IMAGE_DEBUG_MISC>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_HEADER* MinidumpWritableAtLocationDescriptor<MINIDUMP_HEADER>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
namespace {
struct MinidumpMemoryListTraits { … };
struct MinidumpModuleListTraits { … };
struct MinidumpUnloadedModuleListTraits { … };
struct MinidumpThreadListTraits { … };
struct MinidumpThreadNameListTraits { … };
struct MinidumpHandleDataStreamTraits { … };
struct MinidumpMemoryInfoListTraits { … };
struct MinidumpModuleCrashpadInfoListTraits { … };
struct MinidumpSimpleStringDictionaryListTraits { … };
struct MinidumpAnnotationListObjectsTraits { … };
template <typename T>
const typename T::ListType* MinidumpListAtLocationDescriptor(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
}
template <>
const MINIDUMP_MEMORY_LIST*
MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_MODULE_LIST*
MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_UNLOADED_MODULE_LIST*
MinidumpWritableAtLocationDescriptor<MINIDUMP_UNLOADED_MODULE_LIST>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_THREAD_LIST*
MinidumpWritableAtLocationDescriptor<MINIDUMP_THREAD_LIST>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_THREAD_NAME_LIST*
MinidumpWritableAtLocationDescriptor<MINIDUMP_THREAD_NAME_LIST>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_HANDLE_DATA_STREAM*
MinidumpWritableAtLocationDescriptor<MINIDUMP_HANDLE_DATA_STREAM>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MINIDUMP_MEMORY_INFO_LIST*
MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_INFO_LIST>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MinidumpModuleCrashpadInfoList*
MinidumpWritableAtLocationDescriptor<MinidumpModuleCrashpadInfoList>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MinidumpSimpleStringDictionary*
MinidumpWritableAtLocationDescriptor<MinidumpSimpleStringDictionary>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const MinidumpAnnotationList*
MinidumpWritableAtLocationDescriptor<MinidumpAnnotationList>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
namespace {
template <typename T>
const T* MinidumpCVPDBAtLocationDescriptor(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
}
template <>
const CodeViewRecordPDB20*
MinidumpWritableAtLocationDescriptor<CodeViewRecordPDB20>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const CodeViewRecordPDB70*
MinidumpWritableAtLocationDescriptor<CodeViewRecordPDB70>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
template <>
const CodeViewRecordBuildID*
MinidumpWritableAtLocationDescriptor<CodeViewRecordBuildID>(
const std::string& file_contents,
const MINIDUMP_LOCATION_DESCRIPTOR& location) { … }
TestUInt32MinidumpWritable::TestUInt32MinidumpWritable(uint32_t value)
: … { … }
TestUInt32MinidumpWritable::~TestUInt32MinidumpWritable() { … }
size_t TestUInt32MinidumpWritable::SizeOfObject() { … }
bool TestUInt32MinidumpWritable::WriteObject(FileWriterInterface* file_writer) { … }
}
}