#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "google_breakpad/processor/minidump.h"
#include <assert.h>
#include <cstdint>
#include <fcntl.h>
#include <inttypes.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#include <algorithm>
#include <fstream>
#include <limits>
#include <utility>
#include "processor/range_map-inl.h"
#include "common/macros.h"
#include "common/scoped_ptr.h"
#include "common/stdio_wrapper.h"
#include "google_breakpad/processor/dump_context.h"
#include "processor/basic_code_module.h"
#include "processor/basic_code_modules.h"
#include "processor/convert_old_arm64_context.h"
#include "processor/logging.h"
namespace google_breakpad {
istream;
ifstream;
numeric_limits;
vector;
namespace {
const uint32_t kMaxXSaveAreaSize = …;
bool IsContextSizeUnique(uint32_t context_size) { … }
inline void Swap(uint8_t* value) { … }
inline void Swap(uint16_t* value) { … }
inline void Swap(uint32_t* value) { … }
inline void Swap(uint64_t* value) { … }
void Normalize128(uint128_struct* value, bool is_big_endian) { … }
void Swap(uint128_struct* value) { … }
inline void Swap(int32_t* value) { … }
inline void Swap(MDLocationDescriptor* location_descriptor) { … }
inline void Swap(MDMemoryDescriptor* memory_descriptor) { … }
inline void Swap(MDGUID* guid) { … }
inline void Swap(MDSystemTime* system_time) { … }
inline void Swap(MDXStateFeature* xstate_feature) { … }
inline void Swap(MDXStateConfigFeatureMscInfo* xstate_feature_info) { … }
inline void Swap(MDRawSimpleStringDictionaryEntry* entry) { … }
inline void Swap(MDRawCrashpadAnnotation* annotation) { … }
inline void Swap(uint16_t* data, size_t size_in_bytes) { … }
string* UTF16ToUTF8(const vector<uint16_t>& in, bool swap) { … }
size_t UTF16codeunits(const uint16_t* string, size_t maxlen) { … }
inline void Swap(MDTimeZoneInformation* time_zone) { … }
void ConvertUTF16BufferToUTF8String(const uint16_t* utf16_data,
size_t max_length_in_bytes,
string* utf8_result,
bool swap) { … }
enum NumberFormat { … };
void PrintValueOrInvalid(bool valid,
NumberFormat number_format,
uint32_t value) { … }
string TimeTToUTCString(time_t tt) { … }
string MDGUIDToString(const MDGUID& uuid) { … }
bool IsDevAshmem(const string& filename) { … }
}
MinidumpObject::MinidumpObject(Minidump* minidump)
: … { … }
MinidumpStream::MinidumpStream(Minidump* minidump)
: … { … }
MinidumpContext::MinidumpContext(Minidump* minidump)
: … { … }
MinidumpContext::~MinidumpContext() { … }
bool MinidumpContext::Read(uint32_t expected_size) { … }
bool MinidumpContext::CheckAgainstSystemInfo(uint32_t context_cpu_type) { … }
uint32_t MinidumpMemoryRegion::max_bytes_ = …;
MinidumpMemoryRegion::MinidumpMemoryRegion(Minidump* minidump)
: … { … }
MinidumpMemoryRegion::~MinidumpMemoryRegion() { … }
void MinidumpMemoryRegion::SetDescriptor(MDMemoryDescriptor* descriptor) { … }
const uint8_t* MinidumpMemoryRegion::GetMemory() const { … }
uint64_t MinidumpMemoryRegion::GetBase() const { … }
uint32_t MinidumpMemoryRegion::GetSize() const { … }
void MinidumpMemoryRegion::FreeMemory() { … }
template<typename T>
bool MinidumpMemoryRegion::GetMemoryAtAddressInternal(uint64_t address,
T* value) const { … }
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint8_t* value) const { … }
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint16_t* value) const { … }
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint32_t* value) const { … }
bool MinidumpMemoryRegion::GetMemoryAtAddress(uint64_t address,
uint64_t* value) const { … }
void MinidumpMemoryRegion::Print() const { … }
void MinidumpMemoryRegion::SetPrintMode(bool hexdump,
unsigned int hexdump_width) { … }
MinidumpThread::MinidumpThread(Minidump* minidump)
: … { … }
MinidumpThread::~MinidumpThread() { … }
bool MinidumpThread::Read() { … }
uint64_t MinidumpThread::GetStartOfStackMemoryRange() const { … }
MinidumpMemoryRegion* MinidumpThread::GetMemory() { … }
MinidumpContext* MinidumpThread::GetContext() { … }
bool MinidumpThread::GetThreadID(uint32_t* thread_id) const { … }
void MinidumpThread::Print() { … }
uint32_t MinidumpThreadList::max_threads_ = …;
MinidumpThreadList::MinidumpThreadList(Minidump* minidump)
: … { … }
MinidumpThreadList::~MinidumpThreadList() { … }
bool MinidumpThreadList::Read(uint32_t expected_size) { … }
MinidumpThread* MinidumpThreadList::GetThreadAtIndex(unsigned int index)
const { … }
MinidumpThread* MinidumpThreadList::GetThreadByID(uint32_t thread_id) { … }
void MinidumpThreadList::Print() { … }
MinidumpThreadName::MinidumpThreadName(Minidump* minidump)
: … { … }
MinidumpThreadName::~MinidumpThreadName() { … }
bool MinidumpThreadName::Read() { … }
bool MinidumpThreadName::ReadAuxiliaryData() { … }
bool MinidumpThreadName::GetThreadID(uint32_t* thread_id) const { … }
string MinidumpThreadName::GetThreadName() const { … }
void MinidumpThreadName::Print() { … }
MinidumpThreadNameList::MinidumpThreadNameList(Minidump* minidump)
: … { … }
MinidumpThreadNameList::~MinidumpThreadNameList() { … }
bool MinidumpThreadNameList::Read(uint32_t expected_size) { … }
MinidumpThreadName* MinidumpThreadNameList::GetThreadNameAtIndex(
unsigned int index) const { … }
void MinidumpThreadNameList::Print() { … }
uint32_t MinidumpModule::max_cv_bytes_ = …;
uint32_t MinidumpModule::max_misc_bytes_ = …;
MinidumpModule::MinidumpModule(Minidump* minidump)
: … { … }
MinidumpModule::~MinidumpModule() { … }
bool MinidumpModule::Read() { … }
bool MinidumpModule::ReadAuxiliaryData() { … }
string MinidumpModule::code_file() const { … }
string MinidumpModule::code_identifier() const { … }
string MinidumpModule::debug_file() const { … }
static string guid_and_age_to_debug_id(const MDGUID& guid,
uint32_t age) { … }
string MinidumpModule::debug_identifier() const { … }
string MinidumpModule::version() const { … }
CodeModule* MinidumpModule::Copy() const { … }
uint64_t MinidumpModule::shrink_down_delta() const { … }
void MinidumpModule::SetShrinkDownDelta(uint64_t shrink_down_delta) { … }
const uint8_t* MinidumpModule::GetCVRecord(uint32_t* size) { … }
const MDImageDebugMisc* MinidumpModule::GetMiscRecord(uint32_t* size) { … }
void MinidumpModule::Print() { … }
uint32_t MinidumpModuleList::max_modules_ = …;
MinidumpModuleList::MinidumpModuleList(Minidump* minidump)
: … { … }
MinidumpModuleList::~MinidumpModuleList() { … }
bool MinidumpModuleList::Read(uint32_t expected_size) { … }
bool MinidumpModuleList::StoreRange(const MinidumpModule& module,
uint64_t base_address,
uint32_t module_index,
uint32_t module_count,
bool is_android) { … }
const MinidumpModule* MinidumpModuleList::GetModuleForAddress(
uint64_t address) const { … }
const MinidumpModule* MinidumpModuleList::GetMainModule() const { … }
const MinidumpModule* MinidumpModuleList::GetModuleAtSequence(
unsigned int sequence) const { … }
const MinidumpModule* MinidumpModuleList::GetModuleAtIndex(
unsigned int index) const { … }
const CodeModules* MinidumpModuleList::Copy() const { … }
vector<linked_ptr<const CodeModule> >
MinidumpModuleList::GetShrunkRangeModules() const { … }
void MinidumpModuleList::Print() { … }
uint32_t MinidumpMemoryList::max_regions_ = …;
MinidumpMemoryList::MinidumpMemoryList(Minidump* minidump)
: … { … }
MinidumpMemoryList::~MinidumpMemoryList() { … }
bool MinidumpMemoryList::Read(uint32_t expected_size) { … }
MinidumpMemoryRegion* MinidumpMemoryList::GetMemoryRegionAtIndex(
unsigned int index) { … }
MinidumpMemoryRegion* MinidumpMemoryList::GetMemoryRegionForAddress(
uint64_t address) { … }
void MinidumpMemoryList::Print() { … }
MinidumpException::MinidumpException(Minidump* minidump)
: … { … }
MinidumpException::~MinidumpException() { … }
bool MinidumpException::Read(uint32_t expected_size) { … }
bool MinidumpException::GetThreadID(uint32_t* thread_id) const { … }
MinidumpContext* MinidumpException::GetContext() { … }
void MinidumpException::Print() { … }
MinidumpAssertion::MinidumpAssertion(Minidump* minidump)
: … { … }
MinidumpAssertion::~MinidumpAssertion() { … }
bool MinidumpAssertion::Read(uint32_t expected_size) { … }
void MinidumpAssertion::Print() { … }
MinidumpSystemInfo::MinidumpSystemInfo(Minidump* minidump)
: … { … }
MinidumpSystemInfo::~MinidumpSystemInfo() { … }
bool MinidumpSystemInfo::Read(uint32_t expected_size) { … }
string MinidumpSystemInfo::GetOS() { … }
string MinidumpSystemInfo::GetCPU() { … }
const string* MinidumpSystemInfo::GetCSDVersion() { … }
const string* MinidumpSystemInfo::GetCPUVendor() { … }
void MinidumpSystemInfo::Print() { … }
MinidumpUnloadedModule::MinidumpUnloadedModule(Minidump* minidump)
: … { … }
MinidumpUnloadedModule::~MinidumpUnloadedModule() { … }
string MinidumpUnloadedModule::code_file() const { … }
string MinidumpUnloadedModule::code_identifier() const { … }
string MinidumpUnloadedModule::debug_file() const { … }
string MinidumpUnloadedModule::debug_identifier() const { … }
string MinidumpUnloadedModule::version() const { … }
CodeModule* MinidumpUnloadedModule::Copy() const { … }
uint64_t MinidumpUnloadedModule::shrink_down_delta() const { … }
void MinidumpUnloadedModule::SetShrinkDownDelta(uint64_t shrink_down_delta) { … }
bool MinidumpUnloadedModule::Read(uint32_t expected_size) { … }
bool MinidumpUnloadedModule::ReadAuxiliaryData() { … }
uint32_t MinidumpUnloadedModuleList::max_modules_ = …;
MinidumpUnloadedModuleList::MinidumpUnloadedModuleList(Minidump* minidump)
: … { … }
MinidumpUnloadedModuleList::~MinidumpUnloadedModuleList() { … }
bool MinidumpUnloadedModuleList::Read(uint32_t expected_size) { … }
const MinidumpUnloadedModule* MinidumpUnloadedModuleList::GetModuleForAddress(
uint64_t address) const { … }
const MinidumpUnloadedModule*
MinidumpUnloadedModuleList::GetMainModule() const { … }
const MinidumpUnloadedModule*
MinidumpUnloadedModuleList::GetModuleAtSequence(unsigned int sequence) const { … }
const MinidumpUnloadedModule*
MinidumpUnloadedModuleList::GetModuleAtIndex(
unsigned int index) const { … }
const CodeModules* MinidumpUnloadedModuleList::Copy() const { … }
vector<linked_ptr<const CodeModule>>
MinidumpUnloadedModuleList::GetShrunkRangeModules() const { … }
MinidumpMiscInfo::MinidumpMiscInfo(Minidump* minidump)
: … { … }
bool MinidumpMiscInfo::Read(uint32_t expected_size) { … }
void MinidumpMiscInfo::Print() { … }
MinidumpBreakpadInfo::MinidumpBreakpadInfo(Minidump* minidump)
: … { … }
bool MinidumpBreakpadInfo::Read(uint32_t expected_size) { … }
bool MinidumpBreakpadInfo::GetDumpThreadID(uint32_t* thread_id) const { … }
bool MinidumpBreakpadInfo::GetRequestingThreadID(uint32_t* thread_id)
const { … }
void MinidumpBreakpadInfo::Print() { … }
MinidumpMemoryInfo::MinidumpMemoryInfo(Minidump* minidump)
: … { … }
bool MinidumpMemoryInfo::IsExecutable() const { … }
bool MinidumpMemoryInfo::IsWritable() const { … }
bool MinidumpMemoryInfo::Read() { … }
void MinidumpMemoryInfo::Print() { … }
MinidumpMemoryInfoList::MinidumpMemoryInfoList(Minidump* minidump)
: … { … }
MinidumpMemoryInfoList::~MinidumpMemoryInfoList() { … }
bool MinidumpMemoryInfoList::Read(uint32_t expected_size) { … }
const MinidumpMemoryInfo* MinidumpMemoryInfoList::GetMemoryInfoAtIndex(
unsigned int index) const { … }
const MinidumpMemoryInfo* MinidumpMemoryInfoList::GetMemoryInfoForAddress(
uint64_t address) const { … }
void MinidumpMemoryInfoList::Print() { … }
MinidumpLinuxMaps::MinidumpLinuxMaps(Minidump* minidump)
: … { … }
void MinidumpLinuxMaps::Print() const { … }
MinidumpLinuxMapsList::MinidumpLinuxMapsList(Minidump* minidump)
: … { … }
MinidumpLinuxMapsList::~MinidumpLinuxMapsList() { … }
const MinidumpLinuxMaps* MinidumpLinuxMapsList::GetLinuxMapsForAddress(
uint64_t address) const { … }
const MinidumpLinuxMaps* MinidumpLinuxMapsList::GetLinuxMapsAtIndex(
unsigned int index) const { … }
bool MinidumpLinuxMapsList::Read(uint32_t expected_size) { … }
void MinidumpLinuxMapsList::Print() const { … }
MinidumpCrashpadInfo::MinidumpCrashpadInfo(Minidump* minidump)
: … { … }
bool MinidumpCrashpadInfo::Read(uint32_t expected_size) { … }
void MinidumpCrashpadInfo::Print() { … }
uint32_t Minidump::max_streams_ = …;
unsigned int Minidump::max_string_length_ = …;
Minidump::Minidump(const string& path, bool hexdump, unsigned int hexdump_width)
: … { … }
Minidump::Minidump(istream& stream)
: … { … }
Minidump::~Minidump() { … }
bool Minidump::Open() { … }
bool Minidump::GetContextCPUFlagsFromSystemInfo(uint32_t* context_cpu_flags) { … }
bool Minidump::Read() { … }
MinidumpThreadList* Minidump::GetThreadList() { … }
MinidumpThreadNameList* Minidump::GetThreadNameList() { … }
MinidumpModuleList* Minidump::GetModuleList() { … }
MinidumpMemoryList* Minidump::GetMemoryList() { … }
MinidumpException* Minidump::GetException() { … }
MinidumpAssertion* Minidump::GetAssertion() { … }
MinidumpSystemInfo* Minidump::GetSystemInfo() { … }
MinidumpUnloadedModuleList* Minidump::GetUnloadedModuleList() { … }
MinidumpMiscInfo* Minidump::GetMiscInfo() { … }
MinidumpBreakpadInfo* Minidump::GetBreakpadInfo() { … }
MinidumpMemoryInfoList* Minidump::GetMemoryInfoList() { … }
MinidumpLinuxMapsList* Minidump::GetLinuxMapsList() { … }
bool Minidump::IsAndroid() { … }
bool Minidump::GetPlatform(MDOSPlatform* platform) { … }
MinidumpCrashpadInfo* Minidump::GetCrashpadInfo() { … }
static const char* get_stream_name(uint32_t stream_type) { … }
void Minidump::Print() { … }
const MDRawDirectory* Minidump::GetDirectoryEntryAtIndex(unsigned int index)
const { … }
bool Minidump::ReadBytes(void* bytes, size_t count) { … }
bool Minidump::SeekSet(off_t offset) { … }
off_t Minidump::Tell() { … }
string* Minidump::ReadString(off_t offset) { … }
bool Minidump::ReadUTF8String(off_t offset, string* string_utf8) { … }
bool Minidump::ReadStringList(
off_t offset,
std::vector<std::string>* string_list) { … }
bool Minidump::ReadSimpleStringDictionary(
off_t offset,
std::map<std::string, std::string>* simple_string_dictionary) { … }
bool Minidump::ReadCrashpadAnnotationsList(
off_t offset,
std::vector<MinidumpCrashpadInfo::AnnotationObject>* annotations_list) { … }
bool Minidump::SeekToStreamType(uint32_t stream_type,
uint32_t* stream_length) { … }
template<typename T>
T* Minidump::GetStream(T** stream) { … }
}