Namespaces

Enumerations

enum TriState
Name Value
kUnset 0
kEnabled 1
kDisabled 2

A tri-state value that can be unset, on, or off.

Defined at line 23 of file ../../third_party/crashpad/src/util/misc/tri_state.h

enum CPUArchitecture
Name Value
kCPUArchitectureUnknown 0
kCPUArchitectureX86 1
kCPUArchitectureX86_64 2
kCPUArchitectureARM 3
kCPUArchitectureARM64 4
kCPUArchitectureMIPSEL 5
kCPUArchitectureMIPS64EL 6
kCPUArchitectureRISCV64 7

A system’s CPU architecture.

This can be used to represent the CPU architecture of an entire system

as in SystemSnapshot::CPUArchitecture(). It can also be used to represent

the architecture of a CPUContext structure in its CPUContext::architecture

field without reference to external data.

Defined at line 26 of file ../../third_party/crashpad/src/snapshot/cpu_architecture.h

enum MinidumpStreamType
Name Value
kMinidumpStreamTypeThreadList ThreadListStream
kMinidumpStreamTypeModuleList ModuleListStream
kMinidumpStreamTypeMemoryList MemoryListStream
kMinidumpStreamTypeException ExceptionStream
kMinidumpStreamTypeSystemInfo SystemInfoStream
kMinidumpStreamTypeHandleData HandleDataStream
kMinidumpStreamTypeUnloadedModuleList UnloadedModuleListStream
kMinidumpStreamTypeMiscInfo MiscInfoStream
kMinidumpStreamTypeMemoryInfoList MemoryInfoListStream
kMinidumpStreamTypeThreadNameList ThreadNamesStream
kMinidumpStreamTypeLastReservedStream LastReservedStream
kMinidumpStreamTypeCrashpadInfo 0x43500001
kMinidumpStreamTypeCrashpadLastReservedStream 0x4350ffff

Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each

stream structure has a corresponding stream type value to identify it.

Defined at line 49 of file ../../third_party/crashpad/src/minidump/minidump_extensions.h

enum FileWriteMode
Name Value
kReuseOrFail 0
kReuseOrCreate 1
kTruncateOrCreate 2
kCreateOrFail 3

Determines the mode that LoggingOpenFileForWrite() uses.

Defined at line 67 of file ../../third_party/crashpad/src/util/file/file_io.h

enum FilePermissions
Name Value
kOwnerOnly 0
kWorldReadable 1

Determines the permissions bits for files created on POSIX systems.

Defined at line 83 of file ../../third_party/crashpad/src/util/file/file_io.h

enum FileLocking
Name Value
kShared 0
kExclusive 1

Determines the locking mode that LoggingLockFile() uses.

Defined at line 92 of file ../../third_party/crashpad/src/util/file/file_io.h

enum FileLockingBlocking
Name Value
kBlocking false
kNonBlocking true

Determines if LoggingLockFile will block.

Defined at line 101 of file ../../third_party/crashpad/src/util/file/file_io.h

enum FileLockingResult
Name Value
kSuccess 0
kWouldBlock 1
kFailure 2

The return value for LoggingLockFile.

Defined at line 110 of file ../../third_party/crashpad/src/util/file/file_io.h

enum StdioStream
Name Value
kStandardInput 0
kStandardOutput 1
kStandardError 2

Determines the FileHandle that StdioFileHandle() returns.

Defined at line 123 of file ../../third_party/crashpad/src/util/file/file_io.h

enum MinidumpCPUArchitecture
Name Value
kMinidumpCPUArchitectureX86 PROCESSOR_ARCHITECTURE_INTEL
kMinidumpCPUArchitectureMIPS PROCESSOR_ARCHITECTURE_MIPS
kMinidumpCPUArchitectureAlpha PROCESSOR_ARCHITECTURE_ALPHA
kMinidumpCPUArchitecturePPC PROCESSOR_ARCHITECTURE_PPC
kMinidumpCPUArchitectureSHx PROCESSOR_ARCHITECTURE_SHX
kMinidumpCPUArchitectureARM PROCESSOR_ARCHITECTURE_ARM
kMinidumpCPUArchitectureIA64 PROCESSOR_ARCHITECTURE_IA64
kMinidumpCPUArchitectureAlpha64 PROCESSOR_ARCHITECTURE_ALPHA64
kMinidumpCPUArchitectureMSIL PROCESSOR_ARCHITECTURE_MSIL
kMinidumpCPUArchitectureAMD64 PROCESSOR_ARCHITECTURE_AMD64
kMinidumpCPUArchitectureX86Win64 PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
kMinidumpCPUArchitectureNeutral PROCESSOR_ARCHITECTURE_NEUTRAL
kMinidumpCPUArchitectureARM64 PROCESSOR_ARCHITECTURE_ARM64
kMinidumpCPUArchitectureARM32Win64 PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64
kMinidumpCPUArchitectureSPARC 0x8001
kMinidumpCPUArchitecturePPC64 0x8002
kMinidumpCPUArchitectureARM64Breakpad 0x8003
kMinidumpCPUArchitectureRISCV64Breakpad 0x8006
kMinidumpCPUArchitectureUnknown PROCESSOR_ARCHITECTURE_UNKNOWN

CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.

Defined at line 149 of file ../../third_party/crashpad/src/minidump/minidump_extensions.h

enum MinidumpOSType
Name Value
kMinidumpOSTypeWorkstation VER_NT_WORKSTATION
kMinidumpOSTypeDomainController VER_NT_DOMAIN_CONTROLLER
kMinidumpOSTypeServer VER_NT_SERVER

Operating system type values for MINIDUMP_SYSTEM_INFO::ProductType.

Defined at line 223 of file ../../third_party/crashpad/src/minidump/minidump_extensions.h

enum MinidumpOS
Name Value
kMinidumpOSWin32s VER_PLATFORM_WIN32s
kMinidumpOSWin32Windows VER_PLATFORM_WIN32_WINDOWS
kMinidumpOSWin32NT VER_PLATFORM_WIN32_NT
kMinidumpOSUnix 0x8000
kMinidumpOSMacOSX 0x8101
kMinidumpOSIOS 0x8102
kMinidumpOSLinux 0x8201
kMinidumpOSSolaris 0x8202
kMinidumpOSAndroid 0x8203
kMinidumpOSPS3 0x8204
kMinidumpOSNaCl 0x8205
kMinidumpOSFuchsia 0x8206
kMinidumpOSUnknown 0xffffffff

Operating system family values for MINIDUMP_SYSTEM_INFO::PlatformId.

Defined at line 237 of file ../../third_party/crashpad/src/minidump/minidump_extensions.h

Records

Functions

  • std::string URLEncode (const std::string & url)

    Performs percent-encoding (URL encoding) on the input string,

    following RFC 3986 paragraph 2.

    Parameters

    url [in] The string to be encoded.

    Returns

    The encoded string.

  • uint64_t ClockMonotonicNanoseconds ()

    Returns the value of the system’s monotonic clock.

    The monotonic clock is a tick counter whose epoch is unspecified. It is a

    monotonically-increasing clock that cannot be set, and never jumps backwards

    on a running system. The monotonic clock may stop while the system is

    sleeping, and it may be reset when the system starts up. This clock is

    suitable for computing durations of events. Subject to the underlying

    clock’s resolution, successive calls to this function will result in a

    series of increasing values.

    Returns

    The value of the system’s monotonic clock, in nanoseconds.

  • bool CrackURL (const std::string & url, std::string * scheme, std::string * host, std::string * port, std::string * rest)

    Crack a URL into component parts.

    This is not a general function, and works only on the limited style of URLs

    that are expected to be used by HTTPTransport::SetURL().

    Parameters

    url [in] The URL to crack.
    scheme [out] The request scheme, either http or https.
    host [out] The hostname.
    port [out] The port.
    rest [out] The remainder of the URL (both resource and URL params).

    Returns

    `true` on success in which case all output parameters will be filled

    out, or `false` on failure, in which case the output parameters will be

    unmodified and an error will be logged.

  • void SleepNanoseconds (uint64_t nanoseconds)

    Sleeps for the specified duration.

    On POSIX, this function is resilient against the underlying `nanosleep()`

    system call being interrupted by a signal.

    Parameters

    nanoseconds [in] The number of nanoseconds to sleep. The actual sleep may be slightly longer due to latencies and timer resolution.
  • bool LoggingDetermineMergedRange (const MemorySnapshot * a, const MemorySnapshot * b, CheckedRange<uint64_t, size_t> * merged)

    Given two memory snapshots, checks if they're overlapping or

    abutting, and if so, returns the result of merging the two ranges.

    This function is useful to implement

    MemorySnapshot::MergeWithOtherSnapshot().

    Parameters

    a [in] The first range. Must have Size() > 0.
    b [in] The second range. Must have Size() > 0.
    merged [out] The resulting merged range. May be `nullptr` if only a characterization of the ranges is desired.

    Returns

    `true` if the input ranges overlap or abut, with

    filled

    out, otherwise, `false` with an error logged if

    is `true`.

  • bool DetermineMergedRange (const MemorySnapshot * a, const MemorySnapshot * b, CheckedRange<uint64_t, size_t> * merged)

    The same as LoggingDetermineMergedRange but with no errors logged.

  • FileOperationResult ReadFile (FileHandle file, void * buffer, size_t size)

    Reads from a file, retrying when interrupted before reading any data

    on POSIX.

    This function reads into

    Fewer than

    bytes may be read.

    On Windows, reading from sockets is not currently supported.

    Returns

    The number of bytes read and placed into

    or `-1` on

    error, with `errno` or `GetLastError()` set appropriately. On error, a

    portion of

    may have been read into

  • bool WriteFile (FileHandle file, const void * buffer, size_t size)

    Writes to a file, retrying when interrupted on POSIX or following a

    short write.

    This function writes to

    stopping only when

    bytes have been

    written.

    Returns

    `true` on success. `false` on error, with `errno` or

    `GetLastError()` set appropriately. On error, a portion of

    may

    have been written to

  • bool ReadFileExactly (FileHandle file, void * buffer, size_t size)

    Wraps ReadFile(), retrying following a short read, ensuring that

    exactly

    bytes are read. Does not log on failure.

    Returns

    `true` on success. Returns `false` if the underlying ReadFile()

    fails or if fewer than

    bytes were read.

  • FileOperationResult ReadFileUntil (FileHandle file, void * buffer, size_t size)

    Wraps ReadFile(), retrying following a short read. Does not log on

    failure.

  • bool LoggingReadFileExactly (FileHandle file, void * buffer, size_t size)

    Wraps ReadFile(), retrying following a short read, ensuring that

    exactly

    bytes are read. Logs an error on failure.

    Returns

    `true` on success. Returns `false` if the underlying ReadFile()

    fails or if fewer than

    bytes were read.

  • FileOperationResult LoggingReadFileUntil (FileHandle file, void * buffer, size_t size)

    Wraps ReadFile(), retrying following a short read. Logs an error on

    failure.

  • bool LoggingWriteFile (FileHandle file, const void * buffer, size_t size)

    Wraps WriteFile(), ensuring that exactly

    bytes are written.

    Returns

    `true` on success. If the underlying WriteFile() fails, or if fewer

    than

    bytes were written, this function logs a message and

    returns `false`.

  • void CheckedReadFileExactly (FileHandle file, void * buffer, size_t size)

    Wraps ReadFile(), ensuring that exactly

    bytes are read.

    If the underlying ReadFile() fails, or if fewer than

    bytes were

    read, this function causes execution to terminate without returning.

  • void CheckedWriteFile (FileHandle file, const void * buffer, size_t size)

    Wraps WriteFile(), ensuring that exactly

    bytes are written.

    if the underlying WriteFile() fails, or if fewer than

    bytes were

    written, this function causes execution to terminate without returning.

  • void CheckedReadFileAtEOF (FileHandle file)

    Wraps ReadFile(), ensuring that it indicates end-of-file.

    Attempts to read a single byte from

    expecting no data to be read.

    If the underlying ReadFile() fails, or if a byte actually is read, this

    function causes execution to terminate without returning.

  • bool LoggingReadToEOF (FileHandle file, std::string * contents)

    Wraps ReadFile() to read from the current file position to the end of

    the file into

    Returns

    `true` on success, or `false` with a message logged.

  • bool LoggingReadEntireFile (const base::FilePath & path, std::string * contents)

    Wraps LoggingOpenFileForRead() and ReadFile() reading the entire file

    into

    Returns

    `true` on success, or `false` with a message logged.

  • FileHandle OpenFileForRead (const base::FilePath & path)

    Wraps `open()` or `CreateFile()`, opening an existing file for

    reading.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure.

  • FileHandle OpenFileForWrite (const base::FilePath & path, FileWriteMode mode, FilePermissions permissions)

    Wraps `open()` or `CreateFile()`, creating a file for output.

    determines the style (truncate, reuse, etc.) that is used to open

    the file. On POSIX,

    determines the value that is passed as

    `mode` to `open()`. On Windows, the file is always opened in binary mode

    (that is, no CRLF translation). On Windows, the file is opened for sharing,

    see LoggingLockFile() and LoggingUnlockFile() to control concurrent access.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure.

  • FileHandle OpenFileForReadAndWrite (const base::FilePath & path, FileWriteMode mode, FilePermissions permissions)

    Wraps `open()` or `CreateFile()`, creating a file for both input and

    output.

    determines the style (truncate, reuse, etc.) that is used to open

    the file. On POSIX,

    determines the value that is passed as

    `mode` to `open()`. On Windows, the file is always opened in binary mode

    (that is, no CRLF translation). On Windows, the file is opened for sharing,

    see LoggingLockFile() and LoggingUnlockFile() to control concurrent access.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure.

  • FileHandle LoggingOpenFileForRead (const base::FilePath & path)

    Wraps OpenFileForRead(), logging an error if the operation fails.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure.

  • FileHandle LoggingOpenFileForWrite (const base::FilePath & path, FileWriteMode mode, FilePermissions permissions)

    Wraps OpenFileForWrite(), logging an error if the operation fails.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure.

  • FileHandle LoggingOpenMemoryFileForReadAndWrite (const base::FilePath & name)

    Opens an in-memory file for input and output.

    This function first attempts to open the file with `memfd_create()`. If

    `memfd_create()` isn't supported by the kernel, this function next attempts

    to open a file using `O_TMPFILE`. If `O_TMPFILE` isn't supported, this

    function finally falls back to creating a file with a randomized name in

    `/tmp` and immediately `unlink()`ing it.

    Unlike other file open operations, this function doesn't set `O_CLOEXEC`.

    Parameters

    name A name associated with the file. This name does not indicate any exact path and may not be used at all, depending on the strategy used to create the file. The name should not contain any '/' characters.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure,

    with a message logged.

  • FileHandle LoggingOpenFileForReadAndWrite (const base::FilePath & path, FileWriteMode mode, FilePermissions permissions)

    Wraps OpenFileForReadAndWrite(), logging an error if the operation

    fails.

    Returns

    The newly opened FileHandle, or an invalid FileHandle on failure.

  • FileOffset LoggingSeekFile (FileHandle file, FileOffset offset, int whence)

    Wraps `lseek()` or `SetFilePointerEx()`. Logs an error if the

    operation fails.

    Repositions the offset of the open

    to the specified

    relative to

    must be one of `SEEK_SET`, `SEEK_CUR`, or

    `SEEK_END`, and is interpreted in the usual way.

    Returns

    The resulting offset in bytes from the beginning of the file, or

    `-1` on failure.

  • FileOffset LoggingSeekFile (FileHandle file, FileOffset offset, int whence)

    Wraps `lseek()` or `SetFilePointerEx()`. Logs an error if the

    operation fails.

    Repositions the offset of the open

    to the specified

    relative to

    must be one of `SEEK_SET`, `SEEK_CUR`, or

    `SEEK_END`, and is interpreted in the usual way.

    Returns

    The resulting offset in bytes from the beginning of the file, or

    `-1` on failure.

  • bool LoggingTruncateFile (FileHandle file)

    Truncates the given

    to zero bytes in length.

    Returns

    `true` on success, or `false`, and a message will be logged.

  • bool LoggingCloseFile (FileHandle file)

    Wraps `close()` or `CloseHandle()`, logging an error if the operation

    fails.

    Returns

    On success, `true` is returned. On failure, an error is logged and

    `false` is returned.

  • void CheckedCloseFile (FileHandle file)

    Wraps `close()` or `CloseHandle()`, ensuring that it succeeds.

    If the underlying function fails, this function causes execution to

    terminate without returning.

  • FileOffset LoggingFileSizeByHandle (FileHandle file)

    Determines the size of a file.

    Parameters

    file [in] The handle to the file for which the size should be retrieved.

    Returns

    The size of the file. If an error occurs when attempting to

    determine its size, returns `-1` with an error logged.

  • FileHandle StdioFileHandle (StdioStream stdio_stream)

    Returns a FileHandle corresponding to the requested standard I/O

    stream.

    The returned FileHandle should not be closed on POSIX, where it is

    important to maintain valid file descriptors occupying the slots reserved

    for these streams. If a need to close such a stream arises on POSIX,

    `dup2()` should instead be used to replace the existing file descriptor with

    one opened to `/dev/null`. See CloseStdinAndStdout().

    Parameters

    stdio_stream [in] The requested standard I/O stream.

    Returns

    A corresponding FileHandle on success. kInvalidFileHandle on error,

    with a message logged.

  • template <typename To, typename From>
    To implicit_cast (const From & f)

    Use implicit_cast as a safe version of static_cast or const_cast

    for upcasting in the type hierarchy (i.e. casting a pointer to Foo

    to a pointer to SuperclassOfFoo or casting a pointer to Foo to

    a const pointer to Foo).

    When you use implicit_cast, the compiler checks that the cast is safe.

    Such explicit implicit_casts are necessary in surprisingly many

    situations where C++ demands an exact type match instead of an

    argument type convertible to a target type.

    The From type can be inferred, so the preferred syntax for using

    implicit_cast is the same as for static_cast etc.:

    implicit_cast

    <ToType

    >(expr)

    implicit_cast would have been part of the C++ standard library,

    but the proposal was submitted too late. It will probably make

    its way into the language in the future.

    Defined at line 38 of file ../../third_party/crashpad/src/util/misc/implicit_cast.h

  • template <typename From, typename To>
    bool ReinterpretBytes (const From & from, To * to)

    Copies the bytes of

    to

    This function is similar to `bit_cast`, except that it can operate on

    differently sized types.

    Returns

    `true` if the copy is possible without information loss, otherwise

    `false` with a message logged.

    Defined at line 39 of file ../../third_party/crashpad/src/util/misc/reinterpret_bytes.h

  • template <typename To, typename From>
    typename std::enable_if<std::is_same<typename std::remove_cv<From>::type, std::nullptr_t>::value, To>::type FromPointerCast (From )

    Cast std::nullptr_t to any type.

    In C++14, the nullptr_t check could use std::is_null_pointer

    <From

    >::value

    instead of the is_same

    <remove

    _cv

    <From

    >::type, nullptr_t>::type construct.

    Defined at line 54 of file ../../third_party/crashpad/src/util/misc/from_pointer_cast.h

  • template <typename To, typename From>
    typename std::enable_if<std::is_pointer<From>::value && std::is_pointer<To>::value, To>::type FromPointerCast (From from)

    Cast a pointer to any other pointer type.

    Defined at line 77 of file ../../third_party/crashpad/src/util/misc/from_pointer_cast.h

  • template <typename Totypename From>
    typename std::enable_if<std::is_pointer<From>::value && std::is_integral<To>::value, To>::type FromPointerCast (From from)

    Cast a pointer to an integral type. Sign-extend when casting to a signed

    type, zero-extend when casting to an unsigned type.

    Defined at line 87 of file ../../third_party/crashpad/src/util/misc/from_pointer_cast.h