Crashpad
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
crashpad::internal Namespace Reference

The internal namespace, not for public use. More...

Classes

class  CaptureMemory
 
class  CaptureMemoryDelegateLinux
 
class  CaptureMemoryDelegateWin
 
class  CheckedAddressRangeGeneric
 Ensures that a range, composed of a base and a size, does not overflow the pointer type of the process it describes a range in. More...
 
class  ClientData
 The context data for registered threadpool waits. More...
 
union  CPUContextUnion
 
class  ExceptionSnapshotFuchsia
 An ExceptionSnapshot of an exception sustained by a process on a Fuchsia system. More...
 
class  ExceptionSnapshotIOSIntermediateDump
 An ExceptionSnapshot of an exception sustained by a running (or crashed) process on an iOS system. More...
 
class  ExceptionSnapshotLinux
 An ExceptionSnapshot of an signal received by a running (or crashed) process on a Linux system. More...
 
class  ExceptionSnapshotMac
 An ExceptionSnapshot of an exception sustained by a running (or crashed) process on a macOS system. More...
 
class  ExceptionSnapshotMinidump
 An ExceptionSnapshot based on a minidump file. More...
 
class  ExceptionSnapshotWin
 
class  InProcessHandler
 Manage intermediate minidump generation, and own the crash report upload thread and database. More...
 
class  InProcessIntermediateDumpHandler
 Dump all in-process data to iOS intermediate dump. Note: All methods are RUNS-DURING-CRASH. More...
 
class  IOSIntermediateDumpByteArray
 An intermediate dump backed by a byte array. More...
 
class  IOSIntermediateDumpData
 A data object, consisting of a std::vector<uint8_t>. More...
 
class  IOSIntermediateDumpFilePath
 An intermediate dump backed by a FilePath. FilePath is unlinked immediately upon initialization to ensure files are only processed once in the event a crash is introduced by this intermediate dump. More...
 
class  IOSIntermediateDumpInterface
 The base class for reading data into an IOSIntermediateDumpReader. More...
 
class  IOSIntermediateDumpList
 A list object, consisting of a vector of IOSIntermediateDumpMap. More...
 
class  IOSIntermediateDumpMap
 A map object containing a IntermediateDump Key-Object pair. More...
 
class  IOSIntermediateDumpObject
 Base class for intermediate dump object types. More...
 
class  IOSIntermediateDumpReader
 Open and parse iOS intermediate dumps. More...
 
class  IOSIntermediateDumpWriter
 Wrapper class for writing intermediate dump file. More...
 
class  IOSSystemDataCollector
 Used to collect system level data before a crash occurs. More...
 
struct  LocalAllocTraits
 
class  MachOImageSymbolTableReaderInitializer
 The internal implementation for MachOImageSymbolTableReader. More...
 
struct  MakeScopedLockedFileHandleOptions
 
class  MemoryMapRegionSnapshotFuchsia
 
class  MemoryMapRegionSnapshotMinidump
 
class  MemoryMapRegionSnapshotWin
 
class  MemorySnapshotGeneric
 A MemorySnapshot of a memory region in a process on the running system. Works on multiple platforms by using a platform-specific ProcessMemory object. More...
 
class  MemorySnapshotIOSIntermediateDump
 A MemorySnapshot of a memory region. More...
 
class  MemorySnapshotMinidump
 
class  MemorySnapshotSanitized
 A MemorySnapshot which wraps and filters sensitive information from another MemorySnapshot. More...
 
class  MinidumpContextConverter
 
class  MinidumpModuleCodeViewRecordPDBLinkWriter
 The base class for writers of CodeView records that serve as links to .pdb (program database) files. More...
 
class  MinidumpRVAListWriter
 The writer for a MinidumpRVAList object in a minidump file, containing a list of RVA pointers. More...
 
class  MinidumpStreamWriter
 The base class for all second-level objects (“streams”) in a minidump file. More...
 
class  MinidumpStringListWriter
 The writer for a MinidumpRVAList object in a minidump file, containing a list of MinidumpStringWriterType objects. More...
 
class  MinidumpStringWriter
 Writes a variable-length string to a minidump file in accordance with the string type’s characteristics. More...
 
class  MinidumpUTF16StringWriter
 Writes a variable-length UTF-16-encoded MINIDUMP_STRING to a minidump file. More...
 
class  MinidumpUTF8StringWriter
 Writes a variable-length UTF-8-encoded MinidumpUTF8String to a minidump file. More...
 
class  MinidumpWritable
 The base class for all content that might be written to a minidump file. More...
 
class  MinidumpWriterUtil
 A collection of utility functions used by the MinidumpWritable family of classes. More...
 
class  ModuleSnapshotElf
 A ModuleSnapshot of a code module (binary image) loaded into a running (or crashed) process on a system that uses ELF modules. More...
 
class  ModuleSnapshotIOSIntermediateDump
 A ModuleSnapshot of a code module (binary image) loaded into a running (or crashed) process on an iOS system. More...
 
class  ModuleSnapshotMac
 A ModuleSnapshot of a code module (binary image) loaded into a running (or crashed) process on a macOS system. More...
 
class  ModuleSnapshotMinidump
 A ModuleSnapshot based on a module in a minidump file. More...
 
class  ModuleSnapshotSanitized
 A ModuleSnapshot which wraps and filters sensitive information from another ModuleSnapshot. More...
 
class  ModuleSnapshotWin
 A ModuleSnapshot of a code module (binary image) loaded into a running (or crashed) process on a Windows system. More...
 
class  PipeServiceContext
 Context information for the named pipe handler threads. More...
 
class  ProcessSnapshotIOSIntermediateDump
 A ProcessSnapshot of a running (or crashed) process running on a iphoneOS system. More...
 
struct  Range
 A tuple holding the current range of bytes which can be read from or have been written to. More...
 
class  ScopedBackgroundTask
 Marks the start of a task that should continue if the application enters the background. More...
 
struct  ScopedDIRCloseTraits
 
struct  ScopedFileHANDLECloseTraits
 
struct  ScopedKernelHANDLECloseTraits
 
struct  ScopedLockedFileHandleTraits
 
struct  ScopedSearchHANDLECloseTraits
 
struct  ScopedVectoredExceptionRegistrationCloseTraits
 
class  ScopedVMMap
 A scoped wrapper for calls to vm_remap and vm_deallocate. Allows in-process handler to safely read and write memory (modulo its protection level) for the intermediate dump. More...
 
class  ScopedVMMapInternal
 Non-templated internal class to be used by ScopedVMMap. More...
 
class  ScopedVMRead
 A scoped wrapper for calls to vm_read and vm_deallocate. Allows in-process handler to safely read memory for the intermediate dump. More...
 
class  ScopedVMReadInternal
 Non-templated internal class to be used by ScopedVMRead. More...
 
struct  Siginfo
 
struct  SignalStack
 
struct  Sigset
 
struct  Sigset< Traits, typename std::enable_if< std::is_base_of< Traits32, Traits >::value >::type >
 
struct  Sigset< Traits, typename std::enable_if< std::is_base_of< Traits64, Traits >::value >::type >
 
union  Sigval
 
class  SystemSnapshotFuchsia
 A SystemSnapshot of the running system, when the system runs Fuchsia. More...
 
class  SystemSnapshotIOSIntermediateDump
 A SystemSnapshot of the running system, when the system runs iOS. More...
 
class  SystemSnapshotLinux
 A SystemSnapshot of the running system, when the system runs Linux. More...
 
class  SystemSnapshotMac
 A SystemSnapshot of the running system, when the system runs macOS. More...
 
class  SystemSnapshotMinidump
 A SystemSnapshot based on a minidump file. More...
 
class  SystemSnapshotWin
 A SystemSnapshot of the running system, when the system runs Windows. More...
 
class  ThreadSnapshotFuchsia
 A ThreadSnapshot of a thread on a Fuchsia system. More...
 
class  ThreadSnapshotIOSIntermediateDump
 A ThreadSnapshot of a thread on an iOS system. More...
 
class  ThreadSnapshotLinux
 A ThreadSnapshot of a thread on a Linux system. More...
 
class  ThreadSnapshotMac
 A ThreadSnapshot of a thread in a running (or crashed) process on a macOS system. More...
 
class  ThreadSnapshotMinidump
 A ThreadSnapshot based on a thread in a minidump file. More...
 
class  ThreadSnapshotSanitized
 A ThreadSnapshot which wraps and filters sensitive information from another ThreadSnapshot. More...
 
class  ThreadSnapshotWin
 A ThreadSnapshot of a thread in a running (or crashed) process on a Windows system. More...
 
class  UniversalMachExcServerImpl
 
struct  UserDataMinidumpStreamListEntry
 A linked list of blocks representing custom streams in the minidump, with addresses (and size) stored as uint64_t to simplify reading from the handler process. More...
 
class  WorkerThreadImpl
 
class  WriteAllInternal
 The internal implementation of WriteFile() and its wrappers. More...
 

Typedefs

template<size_t ArrayCapacity>
using RingBufferArray = std::array<uint8_t, ArrayCapacity>
 
using Key = IntermediateDumpKey
 

Enumerations

enum class  FileOpenFunction
 
enum class  LogMissingDataValueFromMap : bool
 Determine if GetDataFromMap will log and report missing keys. More...
 
enum class  IntermediateDumpKey : uint16_t
 They key for items in the intermediate dump file. More...
 
enum class  IOSIntermediateDumpReaderInitializeResult : int
 The return value for IOSIntermediateDumpReader::Initialize. More...
 

Functions

template<typename IntegerType>
constexpr Range::Length Base128VarintEncodedLength (IntegerType value)
 
template<size_t ArrayCapacity>
constexpr Range::Length RingBufferArraySize (const RingBufferArray< ArrayCapacity > &ring_buffer_data)
 
template<typename RingBufferArrayType>
bool ReadBytesFromRingBuffer (const RingBufferArrayType &ring_buffer_data, internal::Range &ring_buffer_read_range, uint8_t *target_buffer, Range::Length target_buffer_length)
 Reads data from the ring buffer into a target buffer.
 
template<typename RingBufferArrayType, typename IntegerType>
std::optional< Range::LengthReadBase128VarintFromRingBuffer (const RingBufferArrayType &ring_buffer_data, internal::Range &ring_buffer_read_range, IntegerType &result)
 Reads a single little-endian Base 128 varint-encoded integer from the ring buffer.
 
template<typename RingBufferArrayType>
bool WriteBytesToRingBuffer (const uint8_t *const source_buffer, Range::Length source_buffer_length, RingBufferArrayType &ring_buffer_data, internal::Range &ring_buffer_write_range)
 Writes data from the source buffer into the ring buffer.
 
template<typename RingBufferArrayType, typename IntegerType>
std::optional< int > WriteBase128VarintToRingBuffer (IntegerType value, RingBufferArrayType &ring_buffer_data, internal::Range &ring_buffer_write_range)
 Writes a single Base 128 varint-encoded little-endian unsigned integer into the ring buffer.
 
std::string MinidumpMiscInfoDebugBuildString ()
 Returns the string to set in MINIDUMP_MISC_INFO_4::DbgBldStr.
 
void InitializeCPUContextX86_64 (const zx_thread_state_general_regs_t &thread_context, const zx_thread_state_fp_regs_t &float_context, CPUContextX86_64 *context)
 Initializes a CPUContextX86_64 structure from native context structures on Fuchsia.
 
void InitializeCPUContextARM64 (const zx_thread_state_general_regs_t &thread_context, const zx_thread_state_vector_regs_t &vector_context, CPUContextARM64 *context)
 Initializes a CPUContextARM64 structure from native context structures on Fuchsia.
 
void InitializeCPUContextRISCV64 (const zx_thread_state_general_regs_t &thread_context, const zx_thread_state_fp_regs_t &float_context, CPUContextRISCV64 *context)
 Initializes a CPUContextRISCV64 structure from native context structures on Fuchsia.
 
size_t ThreadStateLengthForFlavor (thread_state_flavor_t flavor)
 
std::ostream & operator<< (std::ostream &os, const IntermediateDumpKey &t)
 Overload the ostream output operator to make logged keys readable.
 
const IOSIntermediateDumpDataGetDataFromMap (const IOSIntermediateDumpMap *map, const IntermediateDumpKey &key, LogMissingDataValueFromMap logging=LogMissingDataValueFromMap::kLogIfMissing)
 Call GetAsData with error and UMA logging.
 
const IOSIntermediateDumpMapGetMapFromMap (const IOSIntermediateDumpMap *map, const IntermediateDumpKey &key)
 Call GetAsMap with error and UMA logging.
 
const IOSIntermediateDumpListGetListFromMap (const IOSIntermediateDumpMap *map, const IntermediateDumpKey &key)
 Call GetAsList with error and UMA logging.
 
bool GetDataStringFromMap (const IOSIntermediateDumpMap *map, const IntermediateDumpKey &key, std::string *value)
 Call GetAsList with error and UMA logging.
 
void GetDataValueFromMapErrorInternal (const IntermediateDumpKey &key)
 Log key size error and record error with UMA.␐␐␐␐␐.
 
template<typename T>
bool GetDataValueFromMap (const IOSIntermediateDumpMap *map, const IntermediateDumpKey &key, T *value, LogMissingDataValueFromMap logging=LogMissingDataValueFromMap::kLogIfMissing)
 Call GetAsData and GetValue with error and UMA logging.
 
void InitializeCPUContextX86_NoFloatingPoint (const SignalThreadContext32 &thread_context, CPUContextX86 *context)
 Initializes GPR and debug state in a CPUContextX86 from a native signal context structure on Linux.
 
void InitializeCPUContextX86_64_NoFloatingPoint (const SignalThreadContext64 &thread_context, CPUContextX86_64 *context)
 Initializes GPR and debug state in a CPUContextX86_64 from a native signal context structure on Linux.
 
void InitializeCPUContextARM (const ThreadContext::t32_t &thread_context, const FloatContext::f32_t &float_context, CPUContextARM *context)
 Initializes a CPUContextARM structure from native context structures on Linux.
 
void InitializeCPUContextARM_NoFloatingPoint (const SignalThreadContext32 &thread_context, CPUContextARM *context)
 Initializes GPR state in a CPUContextARM from a native signal context structure on Linux.
 
void InitializeCPUContextARM64 (const ThreadContext::t64_t &thread_context, const FloatContext::f64_t &float_context, CPUContextARM64 *context)
 Initializes a CPUContextARM64 structure from native context structures on Linux.
 
void InitializeCPUContextARM64_NoFloatingPoint (const ThreadContext::t64_t &thread_context, CPUContextARM64 *context)
 Initializes GPR state in a CPUContextARM64 from a native context structure on Linux.
 
void InitializeCPUContextARM64_OnlyFPSIMD (const SignalFPSIMDContext &float_context, CPUContextARM64 *context)
 Initializes FPSIMD state in a CPUContextARM64 from a native fpsimd signal context structure on Linux.
 
template<typename Traits>
void InitializeCPUContextMIPS (const typename Traits::SignalThreadContext &thread_context, const typename Traits::SignalFloatContext &float_context, typename Traits::CPUContext *context)
 Initializes a CPUContextMIPS structure from native context structures on Linux.
 
void InitializeCPUContextRISCV64 (const ThreadContext::t64_t &thread_context, const FloatContext::f64_t &float_context, CPUContextRISCV64 *context)
 Initializes a CPUContextRISCV64 structure from native context structures on Linux.
 
void InitializeCPUContextX86 (CPUContextX86 *context, thread_state_flavor_t flavor, ConstThreadState state, mach_msg_type_number_t state_count, const x86_thread_state32_t *x86_thread_state32, const x86_float_state32_t *x86_float_state32, const x86_debug_state32_t *x86_debug_state32)
 Initializes a CPUContextX86 structure from native context structures on macOS.
 
void InitializeCPUContextX86_64 (CPUContextX86_64 *context, thread_state_flavor_t flavor, ConstThreadState state, mach_msg_type_number_t state_count, const x86_thread_state64_t *x86_thread_state64, const x86_float_state64_t *x86_float_state64, const x86_debug_state64_t *x86_debug_state64)
 Initializes a CPUContextX86_64 structure from native context structures on macOS.
 
bool ReadMinidumpAnnotationList (FileReaderInterface *file_reader, const MINIDUMP_LOCATION_DESCRIPTOR &location, std::vector< AnnotationSnapshot > *list)
 Reads a MinidumpAnnotationList from a minidump file at location in file_reader, and returns it in list.
 
bool ReadMinidumpSimpleStringDictionary (FileReaderInterface *file_reader, const MINIDUMP_LOCATION_DESCRIPTOR &location, std::map< std::string, std::string > *dictionary)
 Reads a MinidumpSimpleStringDictionary from a minidump file location in file_reader, and returns it in dictionary.
 
bool ReadMinidumpStringList (FileReaderInterface *file_reader, const MINIDUMP_LOCATION_DESCRIPTOR &location, std::vector< std::string > *list)
 Reads a list of MinidumpUTF8String objects in a MinidumpRVAList from a minidump file location in file_reader, and returns it in list.
 
bool ReadMinidumpUTF8String (FileReaderInterface *file_reader, RVA rva, std::string *string)
 Reads a MinidumpUTF8String from a minidump file at offset rva in file_reader, and returns it in string.
 
bool ReadMinidumpUTF8String (FileReaderInterface *file_reader, RVA64 rva, std::string *string)
 64-bit specialization of ReadMinidumpUTF8String.
 
bool ReadMinidumpUTF16String (FileReaderInterface *file_reader, RVA rva, std::u16string *string)
 Reads a MinidumpUTF16String from a minidump file at offset rva in file_reader, and returns it in string.
 
bool ReadMinidumpUTF16String (FileReaderInterface *file_reader, RVA64 rva, std::u16string *string)
 64-bit specialization of ReadMinidumpUTF16String.
 
bool ReadMinidumpUTF16String (FileReaderInterface *file_reader, RVA rva, std::string *string)
 Reads a MinidumpUTF16String from a minidump file at offset rva in file_reader, and returns it in string.
 
bool ReadMinidumpUTF16String (FileReaderInterface *file_reader, RVA64 rva, std::string *string)
 64-bit specialization of ReadMinidumpUTF16String.
 
void TimeZone (const timeval &snapshot_time, SystemSnapshot::DaylightSavingTimeStatus *dst_status, int *standard_offset_seconds, int *daylight_offset_seconds, std::string *standard_name, std::string *daylight_name)
 Returns time zone information from the snapshot system, based on its locale configuration and snapshot_time.
 
bool ReadExactly (std::function< FileOperationResult(bool, void *, size_t)> read_function, bool can_log, void *buffer, size_t size)
 The internal implementation of ReadFileExactly() and its wrappers.
 
FileOperationResult NativeWriteFile (FileHandle file, const void *buffer, size_t size)
 Writes to a file, retrying when interrupted on POSIX.
 
bool RawLoggingWriteFile (int fd, const void *data, size_t size)
 
bool RawLoggingCloseFile (int fd)
 
void SetFileHandleForTesting (FileHandle file_handle)
 Direct RawLog to log to file_handle instead of stderr, so tests can confirm certain error conditions during in-process crashes. Call before before any Crashpad is run.
 
void RawLogString (const char *message)
 
void RawLogInt (unsigned int number)
 
void RawLog (const char *file, int line, const char *message, int error)
 Log message to stderr in a way that is safe to run during an in-process crash. Also prints the given file, line number and an optional error code.
 
template<typename ArrayType>
constexpr size_t ArraySizeHelper () noexcept
 A helper to implement ArraySize.
 
bool ReinterpretBytesImpl (const char *data, size_t data_size, char *dest, size_t dest_size)
 
FARPROC GetFunctionInternal (const wchar_t *library, const char *function, bool required)
 Returns a function pointer to a named function in a library.
 
template<typename FunctionType>
FunctionType * GetFunction (const wchar_t *library, const char *function, bool required)
 Returns a function pointer to a named function in a library.
 
void InitializeCPUContextX86 (const ThreadContext::t32_t &thread_context, const FloatContext::f32_t &float_context, CPUContextX86 *context)
 Initializes a CPUContextX86 structure from native context structures on Linux.
 
void InitializeCPUContextX86 (const SignalThreadContext32 &thread_context, const SignalFloatContext32 &float_context, CPUContextX86 *context)
 Initializes a CPUContextX86 structure from native context structures on Linux.
 
void InitializeCPUContextX86_64 (const ThreadContext::t64_t &thread_context, const FloatContext::f64_t &float_context, CPUContextX86_64 *context)
 Initializes a CPUContextX86_64 structure from native context structures on Linux.
 
void InitializeCPUContextX86_64 (const SignalThreadContext64 &thread_context, const SignalFloatContext64 &float_context, CPUContextX86_64 *context)
 Initializes a CPUContextX86_64 structure from native context structures on Linux.
 

Variables

constexpr RingBufferCapacity kDefaultRingBufferDataCapacity = 8192
 Default capacity of RingBufferData, in bytes.
 
constexpr int kBase128ByteValueBits = 7
 The number of bits encoded in each byte of a Base 128-encoded varint.
 
constexpr RingBufferAnnotationCapacity kDefaultRingBufferAnnotationCapacity = 8192
 Default capacity of RingBufferAnnotation, in bytes.
 
constexpr double kUploadReportTimeoutSeconds = 60
 
constexpr char kNativeReadFunctionName [] = "read"
 The name of the native read function used by ReadFile().
 
constexpr char kNativeWriteFunctionName [] = "write"
 The name of the native write function used by WriteFile().
 

Detailed Description

The internal namespace, not for public use.

Enumeration Type Documentation

◆ IntermediateDumpKey

enum class crashpad::internal::IntermediateDumpKey : uint16_t
strong

They key for items in the intermediate dump file.

These values are persisted to the intermediate crash dump file. Entries should not be renumbered and numeric values should never be reused.

◆ IOSIntermediateDumpReaderInitializeResult

The return value for IOSIntermediateDumpReader::Initialize.

Enumerator
kSuccess 

The intermediate dump was read successfully, initialization succeeded.

kIncomplete 

The intermediate dump could be loaded, but parsing was incomplete. An attempt to parse the RootMap should still be made, as there may still be valuable information to put into a minidump.

kFailure 

The intermediate dump could not be loaded, initialization failed.

◆ LogMissingDataValueFromMap

Determine if GetDataFromMap will log and report missing keys.

Enumerator
kDontLogIfMissing 

Do not log an error and report to UMA if a key is missing.

kLogIfMissing 

Log an error and report to UMA if a key is missing.

Function Documentation

◆ Base128VarintEncodedLength()

template<typename IntegerType>
Range::Length crashpad::internal::Base128VarintEncodedLength ( IntegerType value)
constexpr

!brief Calculates the length in bytes of value encoded using little-endian Base 128 varint encoding.

See also
https://developers.google.com/protocol-buffers/docs/encoding#varints

LengthDelimitedRingBufferWriter uses varint-encoded delimiters to enable zero-copy deserialization of the ringbuffer's contents when storing protobufs inside the ringbuffer, e.g. via google::protobuf::util::ParseDelimitedFromZeroCopyStream() or similar.

See also
https://github.com/protocolbuffers/protobuf/blob/3202b9da88ceb75b65bbabaf4033c95e872f828d/src/google/protobuf/util/delimited_message_util.h#L85
https://github.com/protocolbuffers/protobuf/blob/8bd49dea5e167a389d94b71d24c981d8f9fa0c99/src/google/protobuf/io/zero_copy_stream_impl_lite.h#L68
https://github.com/protocolbuffers/protobuf/blob/8bd49dea5e167a389d94b71d24c981d8f9fa0c99/src/google/protobuf/io/coded_stream.h#L171

!param[in] value Value to be encoded in Base 128 varint encoding. !return The length in bytes of value in Base 128 varint encoding.

◆ GetDataFromMap()

const IOSIntermediateDumpData * crashpad::internal::GetDataFromMap ( const IOSIntermediateDumpMap * map,
const IntermediateDumpKey & key,
LogMissingDataValueFromMap logging = LogMissingDataValueFromMap::kLogIfMissing )

Call GetAsData with error and UMA logging.

Parameters
[in]mapThe map to load from.
[in]keyThe key to load from map.
[in]loggingThis call will log missing keys unless logging is LogDataValueFromMap::kDontLogIfMissing
Returns
The IOSIntermediateDumpData pointer or a nullptr;

◆ GetDataStringFromMap()

bool crashpad::internal::GetDataStringFromMap ( const IOSIntermediateDumpMap * map,
const IntermediateDumpKey & key,
std::string * value )

Call GetAsList with error and UMA logging.

Parameters
[in]mapThe map to load from.
[in]keyThe key to load from map.
[out]valueThe loaded string.
Returns
Returns true with value set accordingly if the string could be loaded, otherwise returns false and logs an error.

◆ GetDataValueFromMap()

template<typename T>
bool crashpad::internal::GetDataValueFromMap ( const IOSIntermediateDumpMap * map,
const IntermediateDumpKey & key,
T * value,
LogMissingDataValueFromMap logging = LogMissingDataValueFromMap::kLogIfMissing )

Call GetAsData and GetValue with error and UMA logging.

Parameters
[in]mapThe map to load from.
[in]keyThe key to load from map.
[out]valueThe data to populate.
[in]loggingThis call will log missing keys unless logging is LogDataValueFromMap::kDontLogIfMissing. This call will always log keys with an invalid size.
Returns
On success, returns true, otherwise returns false.

◆ GetFunction()

template<typename FunctionType>
FunctionType * crashpad::internal::GetFunction ( const wchar_t * library,
const char * function,
bool required )

Returns a function pointer to a named function in a library.

Do not call this directly, use the GET_FUNCTION() or GET_FUNCTION_REQUIRED() macros instead.

This accesses library by calling LoadLibrary() and is subject to the same restrictions as that function. Notably, it can’t be used from a DllMain() entry point.

Parameters
[in]libraryThe library to search in.
[in]functionThe function to search for. If a leading :: is present, it will be stripped.
[in]requiredIf true, require the function to resolve by DCHECK.
Returns
A pointer to the requested function on success. If required is true, triggers a DCHECK assertion on failure, otherwise, nullptr on failure.

◆ GetFunctionInternal()

FARPROC crashpad::internal::GetFunctionInternal ( const wchar_t * library,
const char * function,
bool required )

Returns a function pointer to a named function in a library.

Do not call this directly, use the GET_FUNCTION() or GET_FUNCTION_REQUIRED() macros instead.

This accesses library by calling LoadLibrary() and is subject to the same restrictions as that function. Notably, it can’t be used from a DllMain() entry point.

Parameters
[in]libraryThe library to search in.
[in]functionThe function to search for. If a leading :: is present, it will be stripped.
[in]requiredIf true, require the function to resolve by DCHECK.
Returns
A pointer to the requested function on success. If required is true, triggers a DCHECK assertion on failure, otherwise, nullptr on failure.

◆ GetListFromMap()

const IOSIntermediateDumpList * crashpad::internal::GetListFromMap ( const IOSIntermediateDumpMap * map,
const IntermediateDumpKey & key )

Call GetAsList with error and UMA logging.

Parameters
[in]mapThe map to load from.
[in]keyThe key to load from map.
Returns
The IOSIntermediateDumpList pointer or a nullptr;

◆ GetMapFromMap()

const IOSIntermediateDumpMap * crashpad::internal::GetMapFromMap ( const IOSIntermediateDumpMap * map,
const IntermediateDumpKey & key )

Call GetAsMap with error and UMA logging.

Parameters
[in]mapThe map to load from.
[in]keyThe key to load from map.
Returns
The IOSIntermediateDumpMap pointer or a nullptr;

◆ InitializeCPUContextARM()

void crashpad::internal::InitializeCPUContextARM ( const ThreadContext::t32_t & thread_context,
const FloatContext::f32_t & float_context,
CPUContextARM * context )

Initializes a CPUContextARM structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextARM structure to initialize.

◆ InitializeCPUContextARM64() [1/2]

void crashpad::internal::InitializeCPUContextARM64 ( const ThreadContext::t64_t & thread_context,
const FloatContext::f64_t & float_context,
CPUContextARM64 * context )

Initializes a CPUContextARM64 structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextARM64 structure to initialize.

◆ InitializeCPUContextARM64() [2/2]

void crashpad::internal::InitializeCPUContextARM64 ( const zx_thread_state_general_regs_t & thread_context,
const zx_thread_state_vector_regs_t & vector_context,
CPUContextARM64 * context )

Initializes a CPUContextARM64 structure from native context structures on Fuchsia.

Parameters
[in]thread_contextThe native thread context.
[in]vector_contextThe native vector context that also contains the floating point registers.
[out]contextThe CPUContextARM64 structure to initialize.

◆ InitializeCPUContextARM64_NoFloatingPoint()

void crashpad::internal::InitializeCPUContextARM64_NoFloatingPoint ( const ThreadContext::t64_t & thread_context,
CPUContextARM64 * context )

Initializes GPR state in a CPUContextARM64 from a native context structure on Linux.

Floating point state is initialized to zero.

Parameters
[in]thread_contextThe native thread context.
[out]contextThe CPUContextARM64 structure to initialize.

◆ InitializeCPUContextARM64_OnlyFPSIMD()

void crashpad::internal::InitializeCPUContextARM64_OnlyFPSIMD ( const SignalFPSIMDContext & float_context,
CPUContextARM64 * context )

Initializes FPSIMD state in a CPUContextARM64 from a native fpsimd signal context structure on Linux.

General purpose registers are not initialized.

Parameters
[in]float_contextThe native fpsimd context.
[out]contextThe CPUContextARM64 structure to initialize.

◆ InitializeCPUContextARM_NoFloatingPoint()

void crashpad::internal::InitializeCPUContextARM_NoFloatingPoint ( const SignalThreadContext32 & thread_context,
CPUContextARM * context )

Initializes GPR state in a CPUContextARM from a native signal context structure on Linux.

Floating point state is initialized to zero.

Parameters
[in]thread_contextThe native thread context.
[out]contextThe CPUContextARM structure to initialize.

◆ InitializeCPUContextMIPS()

template<typename Traits>
void crashpad::internal::InitializeCPUContextMIPS ( const typename Traits::SignalThreadContext & thread_context,
const typename Traits::SignalFloatContext & float_context,
typename Traits::CPUContext * context )

Initializes a CPUContextMIPS structure from native context structures on Linux.

This function has template specializations for MIPSEL and MIPS64EL architecture contexts, using ContextTraits32 or ContextTraits64 as template parameter, respectively.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextMIPS structure to initialize.

◆ InitializeCPUContextRISCV64() [1/2]

void crashpad::internal::InitializeCPUContextRISCV64 ( const ThreadContext::t64_t & thread_context,
const FloatContext::f64_t & float_context,
CPUContextRISCV64 * context )

Initializes a CPUContextRISCV64 structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextRISCV64 structure to initialize.

◆ InitializeCPUContextRISCV64() [2/2]

void crashpad::internal::InitializeCPUContextRISCV64 ( const zx_thread_state_general_regs_t & thread_context,
const zx_thread_state_fp_regs_t & float_context,
CPUContextRISCV64 * context )

Initializes a CPUContextRISCV64 structure from native context structures on Fuchsia.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native floating point context.
[out]contextThe CPUContextRISCV64 structure to initialize.

◆ InitializeCPUContextX86() [1/3]

void crashpad::internal::InitializeCPUContextX86 ( const SignalThreadContext32 & thread_context,
const SignalFloatContext32 & float_context,
CPUContextX86 * context )

Initializes a CPUContextX86 structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextX86 structure to initialize.

◆ InitializeCPUContextX86() [2/3]

void crashpad::internal::InitializeCPUContextX86 ( const ThreadContext::t32_t & thread_context,
const FloatContext::f32_t & float_context,
CPUContextX86 * context )

Initializes a CPUContextX86 structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextX86 structure to initialize.

◆ InitializeCPUContextX86() [3/3]

void crashpad::internal::InitializeCPUContextX86 ( CPUContextX86 * context,
thread_state_flavor_t flavor,
ConstThreadState state,
mach_msg_type_number_t state_count,
const x86_thread_state32_t * x86_thread_state32,
const x86_float_state32_t * x86_float_state32,
const x86_debug_state32_t * x86_debug_state32 )

Initializes a CPUContextX86 structure from native context structures on macOS.

flavor, state, and state_count may be supplied by exception handlers in order for the context parameter to be initialized by the thread state received by the exception handler to the extent possible. In that case, whatever thread state specified by these three parameters will supersede x86_thread_state32, x86_float_state32, or x86_debug_state32. If thread state in this format is not available, flavor may be set to THREAD_STATE_NONE, and all of x86_thread_state32, x86_float_state32, and x86_debug_state32 will be honored.

If flavor, state, and state_count are provided but do not contain valid values, a message will be logged and their values will be ignored as though flavor were specified as THREAD_STATE_NONE.

Parameters
[out]contextThe CPUContextX86 structure to initialize.
[in]flavorThe native thread state flavor of state. This may be x86_THREAD_STATE32, x86_FLOAT_STATE32, x86_DEBUG_STATE32, x86_THREAD_STATE, x86_FLOAT_STATE, or x86_DEBUG_STATE. It may also be THREAD_STATE_NONE if state is not supplied (and is nullptr).
[in]stateThe native thread state, which may be a casted pointer to x86_thread_state32_t, x86_float_state32_t, x86_debug_state32_t, x86_thread_state, x86_float_state, or x86_debug_state. This parameter may be nullptr to not supply this data, in which case flavor must be THREAD_STATE_NONE. If a “universal” structure is used, it must carry 32-bit state data of the correct type.
[in]state_countThe number of natural_t-sized (int-sized) units in state. This may be 0 if state is nullptr.
[in]x86_thread_state32The state of the thread’s integer registers.
[in]x86_float_state32The state of the thread’s floating-point registers.
[in]x86_debug_state32The state of the thread’s debug registers.

◆ InitializeCPUContextX86_64() [1/4]

void crashpad::internal::InitializeCPUContextX86_64 ( const SignalThreadContext64 & thread_context,
const SignalFloatContext64 & float_context,
CPUContextX86_64 * context )

Initializes a CPUContextX86_64 structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextX86_64 structure to initialize.

◆ InitializeCPUContextX86_64() [2/4]

void crashpad::internal::InitializeCPUContextX86_64 ( const ThreadContext::t64_t & thread_context,
const FloatContext::f64_t & float_context,
CPUContextX86_64 * context )

Initializes a CPUContextX86_64 structure from native context structures on Linux.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native float context.
[out]contextThe CPUContextX86_64 structure to initialize.

◆ InitializeCPUContextX86_64() [3/4]

void crashpad::internal::InitializeCPUContextX86_64 ( const zx_thread_state_general_regs_t & thread_context,
const zx_thread_state_fp_regs_t & float_context,
CPUContextX86_64 * context )

Initializes a CPUContextX86_64 structure from native context structures on Fuchsia.

Segment registers are currently initialized to zero.

Parameters
[in]thread_contextThe native thread context.
[in]float_contextThe native floating point context.
[out]contextThe CPUContextX86_64 structure to initialize.

◆ InitializeCPUContextX86_64() [4/4]

void crashpad::internal::InitializeCPUContextX86_64 ( CPUContextX86_64 * context,
thread_state_flavor_t flavor,
ConstThreadState state,
mach_msg_type_number_t state_count,
const x86_thread_state64_t * x86_thread_state64,
const x86_float_state64_t * x86_float_state64,
const x86_debug_state64_t * x86_debug_state64 )

Initializes a CPUContextX86_64 structure from native context structures on macOS.

flavor, state, and state_count may be supplied by exception handlers in order for the context parameter to be initialized by the thread state received by the exception handler to the extent possible. In that case, whatever thread state specified by these three parameters will supersede x86_thread_state64, x86_float_state64, or x86_debug_state64. If thread state in this format is not available, flavor may be set to THREAD_STATE_NONE, and all of x86_thread_state64, x86_float_state64, and x86_debug_state64 will be honored.

If flavor, state, and state_count are provided but do not contain valid values, a message will be logged and their values will be ignored as though flavor were specified as THREAD_STATE_NONE.

Parameters
[out]contextThe CPUContextX86_64 structure to initialize.
[in]flavorThe native thread state flavor of state. This may be x86_THREAD_STATE64, x86_FLOAT_STATE64, x86_DEBUG_STATE64, x86_THREAD_STATE, x86_FLOAT_STATE, or x86_DEBUG_STATE. It may also be THREAD_STATE_NONE if state is not supplied (and is nullptr).
[in]stateThe native thread state, which may be a casted pointer to x86_thread_state64_t, x86_float_state64_t, x86_debug_state64_t, x86_thread_state, x86_float_state, or x86_debug_state. This parameter may be nullptr to not supply this data, in which case flavor must be THREAD_STATE_NONE. If a “universal” structure is used, it must carry 64-bit state data of the correct type.
[in]state_countThe number of int-sized units in state. This may be 0 if state is nullptr.
[in]x86_thread_state64The state of the thread’s integer registers.
[in]x86_float_state64The state of the thread’s floating-point registers.
[in]x86_debug_state64The state of the thread’s debug registers.

◆ InitializeCPUContextX86_64_NoFloatingPoint()

void crashpad::internal::InitializeCPUContextX86_64_NoFloatingPoint ( const SignalThreadContext64 & thread_context,
CPUContextX86_64 * context )

Initializes GPR and debug state in a CPUContextX86_64 from a native signal context structure on Linux.

Floating point state and debug registers are initialized to zero.

Parameters
[in]thread_contextThe native thread context.
[out]contextThe CPUContextX86_64 structure to initialize.

◆ InitializeCPUContextX86_NoFloatingPoint()

void crashpad::internal::InitializeCPUContextX86_NoFloatingPoint ( const SignalThreadContext32 & thread_context,
CPUContextX86 * context )

Initializes GPR and debug state in a CPUContextX86 from a native signal context structure on Linux.

Floating point state and debug registers are initialized to zero.

Parameters
[in]thread_contextThe native thread context.
[out]contextThe CPUContextX86 structure to initialize.

◆ MinidumpMiscInfoDebugBuildString()

std::string crashpad::internal::MinidumpMiscInfoDebugBuildString ( )

Returns the string to set in MINIDUMP_MISC_INFO_4::DbgBldStr.

dbghelp produces strings like "dbghelp.i386,6.3.9600.16520" and "dbghelp.amd64,6.3.9600.16520". This function mimics that format, and adds the OS that wrote the minidump along with any relevant platform-specific data describing the compilation environment.

This function is an implementation detail of MinidumpMiscInfoWriter::InitializeFromSnapshot() and is only exposed for testing purposes.

◆ NativeWriteFile()

FileOperationResult crashpad::internal::NativeWriteFile ( FileHandle file,
const void * buffer,
size_t size )

Writes to a file, retrying when interrupted on POSIX.

Fewer than size bytes may be written to file. This can happen if the underlying write operation returns before writing the entire buffer, or if the buffer is too large to write in a single operation, possibly due to a limitation of a data type used to express the number of bytes written.

This function adapts native write operations for uniform use by WriteFile(). This function should only be called by WriteFile(). Other code should call WriteFile() or another function that wraps WriteFile().

Parameters
[in]fileThe file to write to.
[in]bufferA buffer containing data to be written.
[in]sizeThe number of bytes from buffer to write.
Returns
The number of bytes actually written from buffer to file on success. -1 on error, with errno or GetLastError() set appropriately.

◆ RawLog()

void crashpad::internal::RawLog ( const char * file,
int line,
const char * message,
int error )

Log message to stderr in a way that is safe to run during an in-process crash. Also prints the given file, line number and an optional error code.

Note: RUNS-DURING-CRASH.

◆ ReadBase128VarintFromRingBuffer()

template<typename RingBufferArrayType, typename IntegerType>
std::optional< Range::Length > crashpad::internal::ReadBase128VarintFromRingBuffer ( const RingBufferArrayType & ring_buffer_data,
internal::Range & ring_buffer_read_range,
IntegerType & result )

Reads a single little-endian Base 128 varint-encoded integer from the ring buffer.

Parameters
[in]ring_buffer_dataThe ring buffer to read.
[in,out]ring_buffer_read_rangeThe range of the data available to read. Upon return, set to the remaining range of data available to read, if any.
[out]resultUpon success, set to the decoded value read from the buffer.
Returns
The length in bytes of the varint if the read succeeded, std::nullopt otherwise. On success, updates ring_buffer_read_range to reflect the bytes available to read.

The varint can wrap around the end of the ring buffer, in which case the read continues at the beginning of the ring buffer (if the ring buffer is long enough).

◆ ReadBytesFromRingBuffer()

template<typename RingBufferArrayType>
bool crashpad::internal::ReadBytesFromRingBuffer ( const RingBufferArrayType & ring_buffer_data,
internal::Range & ring_buffer_read_range,
uint8_t * target_buffer,
Range::Length target_buffer_length )

Reads data from the ring buffer into a target buffer.

Parameters
[in]ring_buffer_dataThe ring buffer to read.
[in,out]ring_buffer_read_rangeThe range of the data available to read. Upon return, set to the remaining range of data available to read, if any.
[in]target_bufferBuffer into which data will be written.
[in]target_buffer_lengthNumber of bytes to write into target_buffer.
Returns
true if the read succeeded, false otherwise. On success, updates ring_buffer_read_range to reflect the bytes consumed.

The bytes can wrap around the end of the ring buffer, in which case the read continues at the beginning of the ring buffer (if the ring buffer is long enough).

◆ ReadExactly()

bool crashpad::internal::ReadExactly ( std::function< FileOperationResult(bool, void *, size_t)> read_function,
bool can_log,
void * buffer,
size_t size )

The internal implementation of ReadFileExactly() and its wrappers.

The logic is exposed so that it may be reused by FileReaderInterface, and so that it may be tested without requiring large files to be read. It is not intended to be used more generally. Use ReadFileExactly(), LoggingReadFileExactly(), CheckedReadFileExactly(), or FileReaderInterface::ReadExactly() instead.

◆ ReadMinidumpAnnotationList()

bool crashpad::internal::ReadMinidumpAnnotationList ( FileReaderInterface * file_reader,
const MINIDUMP_LOCATION_DESCRIPTOR & location,
std::vector< AnnotationSnapshot > * list )

Reads a MinidumpAnnotationList from a minidump file at location in file_reader, and returns it in list.

Returns
true on success, with list set by replacing its contents. false on failure, with a message logged.

◆ ReadMinidumpSimpleStringDictionary()

bool crashpad::internal::ReadMinidumpSimpleStringDictionary ( FileReaderInterface * file_reader,
const MINIDUMP_LOCATION_DESCRIPTOR & location,
std::map< std::string, std::string > * dictionary )

Reads a MinidumpSimpleStringDictionary from a minidump file location in file_reader, and returns it in dictionary.

Returns
true on success, with dictionary set by replacing its contents. false on failure, with a message logged.

◆ ReadMinidumpStringList()

bool crashpad::internal::ReadMinidumpStringList ( FileReaderInterface * file_reader,
const MINIDUMP_LOCATION_DESCRIPTOR & location,
std::vector< std::string > * list )

Reads a list of MinidumpUTF8String objects in a MinidumpRVAList from a minidump file location in file_reader, and returns it in list.

Returns
true on success, with list set by replacing its contents. false on failure, with a message logged.

◆ ReadMinidumpUTF16String() [1/2]

bool crashpad::internal::ReadMinidumpUTF16String ( FileReaderInterface * file_reader,
RVA rva,
std::string * string )

Reads a MinidumpUTF16String from a minidump file at offset rva in file_reader, and returns it in string.

Returns
true on success, with string set. false on failure, with a message logged.

◆ ReadMinidumpUTF16String() [2/2]

bool crashpad::internal::ReadMinidumpUTF16String ( FileReaderInterface * file_reader,
RVA rva,
std::u16string * string )

Reads a MinidumpUTF16String from a minidump file at offset rva in file_reader, and returns it in string.

Returns
true on success, with string set. false on failure, with a message logged.

◆ ReadMinidumpUTF8String()

bool crashpad::internal::ReadMinidumpUTF8String ( FileReaderInterface * file_reader,
RVA rva,
std::string * string )

Reads a MinidumpUTF8String from a minidump file at offset rva in file_reader, and returns it in string.

Returns
true on success, with string set. false on failure, with a message logged.

◆ RingBufferArraySize()

template<size_t ArrayCapacity>
Range::Length crashpad::internal::RingBufferArraySize ( const RingBufferArray< ArrayCapacity > & ring_buffer_data)
constexpr
Returns
The size of the RingBufferArray as a Range::Length.

◆ TimeZone()

void crashpad::internal::TimeZone ( const timeval & snapshot_time,
SystemSnapshot::DaylightSavingTimeStatus * dst_status,
int * standard_offset_seconds,
int * daylight_offset_seconds,
std::string * standard_name,
std::string * daylight_name )

Returns time zone information from the snapshot system, based on its locale configuration and snapshot_time.

Parameters
[in]snapshot_timeThe time to use collect daylight saving time status for, given in time since Epoch.
[out]dst_statusWhether the location observes daylight saving time, and if so, whether it or standard time is currently being observed.
[out]standard_offset_secondsThe number of seconds that the location’s time zone is east (ahead) of UTC during standard time.
[out]daylight_offset_secondsThe number of seconds that the location’s time zone is east (ahead) of UTC during daylight saving. time.
[out]standard_nameThe name of the time zone while standard time is being observed.
[out]daylight_nameThe name of the time zone while daylight saving time is being observed.
See also
SystemSnapshot::TimeZone

◆ WriteBase128VarintToRingBuffer()

template<typename RingBufferArrayType, typename IntegerType>
std::optional< int > crashpad::internal::WriteBase128VarintToRingBuffer ( IntegerType value,
RingBufferArrayType & ring_buffer_data,
internal::Range & ring_buffer_write_range )

Writes a single Base 128 varint-encoded little-endian unsigned integer into the ring buffer.

Parameters
[in]valueThe value to encode and write into the ring buffer.
[in]ring_buffer_dataThe ring buffer into which to write.
[in,out]ring_buffer_write_rangeThe range of the data available to write. Upon return, set to the remaining range of data available to write, if any.
Returns
The length in bytes of the varint if the write succeeded, std::nullopt otherwise. On success, updates write_buffer_read_range to reflect the range available to write, if any.

The varint can wrap around the end of the ring buffer, in which case the write continues at the beginning of the ring buffer (if the ring buffer is long enough).

◆ WriteBytesToRingBuffer()

template<typename RingBufferArrayType>
bool crashpad::internal::WriteBytesToRingBuffer ( const uint8_t *const source_buffer,
Range::Length source_buffer_length,
RingBufferArrayType & ring_buffer_data,
internal::Range & ring_buffer_write_range )

Writes data from the source buffer into the ring buffer.

Parameters
[in]source_bufferBuffer from which data will be read.
[in]source_buffer_lengthThe length in bytes of source_buffer.
[in]ring_buffer_dataThe ring buffer into which data will be read.
[in,out]ring_buffer_write_rangeThe range of the data available to write. Upon return, set to the remaining range of data available to write, if any.
Returns
true if write read succeeded, false otherwise. On success, updates ring_buffer_write_range to reflect the bytes written.

The bytes can wrap around the end of the ring buffer, in which case the write continues at the beginning of the ring buffer (if the ring buffer is long enough).

Variable Documentation

◆ kNativeReadFunctionName

char crashpad::internal::kNativeReadFunctionName[] = "read"
constexpr

The name of the native read function used by ReadFile().

This value may be useful for logging.

See also
kNativeWriteFunctionName

◆ kNativeWriteFunctionName

char crashpad::internal::kNativeWriteFunctionName[] = "write"
constexpr

The name of the native write function used by WriteFile().

This value may be useful for logging.

See also
kNativeReadFunctionName