Crashpad
|
The main namespace. More...
Namespaces | |
internal | |
The internal namespace, not for public use. | |
test | |
The testing namespace, for use in test code only. | |
Classes | |
class | AgePruneCondition |
A PruneCondition that deletes reports older than the specified number days. More... | |
struct | AlignedAllocator |
A standard allocator that aligns its allocations as requested, suitable for use as an allocator in standard containers. More... | |
class | BinaryPruneCondition |
A PruneCondition that conjoins two other PruneConditions. More... | |
class | CheckedRange |
Ensures that a range, composed of a base and size, does not overflow its data type. More... | |
class | ChildPortHandshake |
Implements a handshake protocol that allows processes to exchange port rights. More... | |
class | ChildPortServer |
A server interface for the child_port Mach subsystem. More... | |
struct | ClientToServerMessage |
The message passed from client to server by SendToCrashHandlerServer(). More... | |
struct | CodeViewRecordPDB20 |
A CodeView record linking to a .pdb 2.0 file. More... | |
struct | CodeViewRecordPDB70 |
A CodeView record linking to a .pdb 7.0 file. More... | |
class | CompositeHTTPBodyStream |
An implementation of HTTPBodyStream that combines an array of several other HTTPBodyStream objects into a single, unified stream. More... | |
class | CompositeMachMessageServer |
Adapts multiple MachMessageServer::Interface implementations for simultaneous use in a single MachMessageServer::Run() call. More... | |
struct | CPUContext |
A context structure capable of carrying the context of any supported CPU architecture. More... | |
struct | CPUContextX86 |
A context structure carrying 32-bit x86 CPU state. More... | |
struct | CPUContextX86_64 |
A context structure carrying x86_64 CPU state. More... | |
class | CrashpadClient |
The primary interface for an application to have Crashpad monitor it for crashes. More... | |
struct | CrashpadInfo |
A structure that can be used by a Crashpad-enabled program to provide information to the Crashpad crash handler. More... | |
struct | CrashpadInfoClientOptions |
Options represented in a client’s CrashpadInfo structure. More... | |
class | CrashReportDatabase |
An interface for managing a collection of crash report files and metadata associated with the crash reports. More... | |
class | CrashReportExceptionHandler |
An exception handler that writes crash reports for exception messages to a CrashReportDatabase. More... | |
class | CrashReportUploadThread |
A thread that processes pending crash reports in a CrashReportDatabase by uploading them or marking them as completed without upload, as desired. More... | |
class | DatabaseSizePruneCondition |
A PruneCondition that deletes older reports to keep the total Crashpad database size under the specified limit. More... | |
class | ExceptionHandlerServer |
Runs the main exception-handling server in Crashpad’s handler process. More... | |
struct | ExceptionInformation |
Structure read out of the client process by the crash handler when an exception occurs. More... | |
class | ExceptionPorts |
A better interface to *_get_exception_ports() and *_set_exception_ports() . More... | |
class | ExceptionSnapshot |
An abstract interface to a snapshot representing an exception that a snapshot process sustained and triggered the snapshot being taken. More... | |
class | FileHTTPBodyStream |
An implementation of HTTPBodyStream that reads from the specified file and provides its contents for an HTTP body. More... | |
class | FileReader |
A file reader implementation that wraps traditional system file operations on files accessed through the filesystem. More... | |
class | FileReaderInterface |
An interface to read to files and other file-like objects with semantics matching the underlying platform (POSIX or Windows). More... | |
class | FileSeekerInterface |
An interface to seek in files and other file-like objects with semantics matching the underlying platform (POSIX or Windows). More... | |
class | FileWriter |
A file writer implementation that wraps traditional system file operations on files accessed through the filesystem. More... | |
class | FileWriterInterface |
An interface to write to files and other file-like objects with semantics matching the underlying platform (POSIX or Windows). More... | |
class | GzipHTTPBodyStream |
An implementation of HTTPBodyStream that gzip -compresses another HTTPBodyStream. More... | |
struct | HandleSnapshot |
class | HTTPBodyStream |
An interface to a stream that can be used for an HTTP request body. More... | |
class | HTTPMultipartBuilder |
This class is used to build a MIME multipart message, conforming to RFC 2046, for use as a HTTP request body. More... | |
class | HTTPTransport |
HTTPTransport executes a HTTP request using the specified URL, HTTP method, headers, and body. This class can only issue a synchronous HTTP request. More... | |
class | InitialClientData |
A container for the data associated with the --initial-client-data method for initializing the handler process on Windows. More... | |
class | InitializationState |
Tracks whether data are initialized. More... | |
class | InitializationStateDcheck |
Tracks whether data are initialized, triggering a DCHECK assertion on an invalid data access. More... | |
class | MachMessageServer |
Runs a Mach message server to handle a Mach RPC request for MIG servers. More... | |
class | MachOImageAnnotationsReader |
A reader for annotations stored in a Mach-O image mapped into another process. More... | |
class | MachOImageReader |
A reader for Mach-O images mapped into another process. More... | |
class | MachOImageSegmentReader |
A reader for LC_SEGMENT or LC_SEGMENT_64 load commands in Mach-O images mapped into another process. More... | |
class | MachOImageSymbolTableReader |
A reader for symbol tables in Mach-O images mapped into another process. More... | |
class | MemoryMapRegionSnapshot |
An abstract interface to a snapshot representing a region of the memory map present in the snapshot process. More... | |
class | MemorySnapshot |
An abstract interface to a snapshot representing a region of memory present in a snapshot process. More... | |
class | Metrics |
Container class to hold shared UMA metrics integration points. More... | |
struct | MinidumpContextAMD64 |
An x86_64 (AMD64) CPU context (register state) carried in a minidump file. More... | |
class | MinidumpContextAMD64Writer |
The writer for a MinidumpContextAMD64 structure in a minidump file. More... | |
class | MinidumpContextWriter |
The base class for writers of CPU context structures in minidump files. More... | |
struct | MinidumpContextX86 |
A 32-bit x86 CPU context (register state) carried in a minidump file. More... | |
class | MinidumpContextX86Writer |
The writer for a MinidumpContextX86 structure in a minidump file. More... | |
struct | MinidumpCrashpadInfo |
Additional Crashpad-specific information carried within a minidump file. More... | |
class | MinidumpCrashpadInfoWriter |
The writer for a MinidumpCrashpadInfo stream in a minidump file. More... | |
class | MinidumpExceptionWriter |
The writer for a MINIDUMP_EXCEPTION_STREAM stream in a minidump file. More... | |
class | MinidumpFileWriter |
The root-level object in a minidump file. More... | |
class | MinidumpHandleDataWriter |
The writer for a MINIDUMP_HANDLE_DATA_STREAM stream in a minidump and its contained MINIDUMP_HANDLE_DESCRIPTOR s. More... | |
class | MinidumpMemoryInfoListWriter |
The writer for a MINIDUMP_MEMORY_INFO_LIST stream in a minidump file, containing a list of MINIDUMP_MEMORY_INFO objects. More... | |
class | MinidumpMemoryListWriter |
The writer for a MINIDUMP_MEMORY_LIST stream in a minidump file, containing a list of MINIDUMP_MEMORY_DESCRIPTOR objects. More... | |
class | MinidumpMiscInfoWriter |
The writer for a stream in the MINIDUMP_MISC_INFO family in a minidump file. More... | |
class | MinidumpModuleCodeViewRecordPDB20Writer |
The writer for a CodeViewRecordPDB20 object in a minidump file. More... | |
class | MinidumpModuleCodeViewRecordPDB70Writer |
The writer for a CodeViewRecordPDB70 object in a minidump file. More... | |
class | MinidumpModuleCodeViewRecordWriter |
The base class for writers of CodeView records referenced by MINIDUMP_MODULE::CvRecord in minidump files. More... | |
struct | MinidumpModuleCrashpadInfo |
Additional Crashpad-specific information about a module carried within a minidump file. More... | |
struct | MinidumpModuleCrashpadInfoLink |
A link between a MINIDUMP_MODULE structure and additional Crashpad-specific information about a module carried within a minidump file. More... | |
struct | MinidumpModuleCrashpadInfoList |
Additional Crashpad-specific information about modules carried within a minidump file. More... | |
class | MinidumpModuleCrashpadInfoListWriter |
The writer for a MinidumpModuleCrashpadInfoList object in a minidump file, containing a list of MinidumpModuleCrashpadInfo objects. More... | |
class | MinidumpModuleCrashpadInfoWriter |
The writer for a MinidumpModuleCrashpadInfo object in a minidump file. More... | |
class | MinidumpModuleListWriter |
The writer for a MINIDUMP_MODULE_LIST stream in a minidump file, containing a list of MINIDUMP_MODULE objects. More... | |
class | MinidumpModuleMiscDebugRecordWriter |
The writer for an IMAGE_DEBUG_MISC object in a minidump file. More... | |
class | MinidumpModuleWriter |
The writer for a MINIDUMP_MODULE object in a minidump file. More... | |
struct | MinidumpRVAList |
A list of RVA pointers. More... | |
struct | MinidumpSimpleStringDictionary |
A list of key-value pairs. More... | |
struct | MinidumpSimpleStringDictionaryEntry |
A key-value pair. More... | |
class | MinidumpSimpleStringDictionaryEntryWriter |
The writer for a MinidumpSimpleStringDictionaryEntry object in a minidump file. More... | |
class | MinidumpSimpleStringDictionaryWriter |
The writer for a MinidumpSimpleStringDictionary object in a minidump file, containing a list of MinidumpSimpleStringDictionaryEntry objects. More... | |
class | MinidumpSystemInfoWriter |
The writer for a MINIDUMP_SYSTEM_INFO stream in a minidump file. More... | |
class | MinidumpThreadListWriter |
The writer for a MINIDUMP_THREAD_LIST stream in a minidump file, containing a list of MINIDUMP_THREAD objects. More... | |
class | MinidumpThreadWriter |
The writer for a MINIDUMP_THREAD object in a minidump file. More... | |
class | MinidumpUnloadedModuleListWriter |
The writer for a MINIDUMP_UNLOADED_MODULE_LIST stream in a minidump file, containing a list of MINIDUMP_UNLOADED_MODULE objects. More... | |
class | MinidumpUnloadedModuleWriter |
The writer for a MINIDUMP_UNLOADED_MODULE object in a minidump file. More... | |
class | MinidumpUserStreamWriter |
The writer for a MINIDUMP_USER_STREAM in a minidump file. More... | |
struct | MinidumpUTF8String |
A variable-length UTF-8-encoded string carried within a minidump file. More... | |
class | ModuleSnapshot |
An abstract interface to a snapshot representing a code module (binary image) loaded into a snapshot process. More... | |
class | NotifyServer |
A server interface for the notify Mach subsystem. More... | |
class | PEImageAnnotationsReader |
A reader of annotations stored in a PE image mapped into another process. More... | |
class | PEImageReader |
A reader for PE images mapped into another process. More... | |
class | PEImageResourceReader |
A reader for resources stored in PE images mapped into another process. More... | |
class | PointerVector |
Allows a std::vector to “own” pointer elements stored in it. More... | |
class | ProcessInfo |
Gathers information about a process given its HANDLE . This consists primarily of information stored in the Process Environment Block. More... | |
class | ProcessReader |
Accesses information about another process, identified by a Mach task. More... | |
class | ProcessReaderWin |
Accesses information about another process, identified by a HANDLE . More... | |
class | ProcessSnapshot |
An abstract interface to a snapshot representing the state of a process. More... | |
class | ProcessSnapshotMac |
A ProcessSnapshot of a running (or crashed) process running on a macOS system. More... | |
class | ProcessSnapshotMinidump |
A ProcessSnapshot based on a minidump file. More... | |
class | ProcessSnapshotWin |
A ProcessSnapshot of a running (or crashed) process running on a Windows system. More... | |
class | ProcessSubrangeReader |
A wrapper for ProcessReaderWin that only allows a specific subrange to be read from. More... | |
class | PruneCondition |
An abstract base class for evaluating crash reports for deletion. More... | |
class | PruneCrashReportThread |
A thread that periodically prunes crash reports from the database using the specified condition. More... | |
struct | RegistrationRequest |
A client registration request. More... | |
struct | RegistrationResponse |
A client registration response. More... | |
struct | RTL_UNLOAD_EVENT_TRACE |
class | ScopedForbidReturn |
Asserts that a scope must not be exited while unsafe. More... | |
class | ScopedProcessSuspend |
Manages the suspension of another process. More... | |
class | ScopedTaskSuspend |
Manages the suspension of another task. More... | |
class | Semaphore |
An anonymous in-process counting sempahore. More... | |
union | ServerToClientMessage |
The response sent back to the client via SendToCrashHandlerServer(). More... | |
class | SessionEndWatcher |
Creates a hidden window and waits for a WM_ENDSESSION message, indicating that the session is ending and the application should terminate. More... | |
class | Settings |
An interface for accessing and modifying the settings of a CrashReportDatabase. More... | |
struct | ShutdownRequest |
A message only sent to the server by itself to trigger shutdown. More... | |
class | Signals |
Utilities for handling POSIX signals. More... | |
class | SnapshotMinidumpMemoryWriter |
The base class for writers of memory ranges pointed to by MINIDUMP_MEMORY_DESCRIPTOR objects in a minidump file. More... | |
class | StringFile |
A file reader and writer backed by a virtual file, as opposed to a file on disk or other operating system file descriptor-based file. More... | |
class | StringHTTPBodyStream |
An implementation of HTTPBodyStream that turns a fixed string into a stream. More... | |
class | SystemSnapshot |
An abstract interface to a snapshot representing the state of a system, comprising an operating system, CPU architecture, and various other characteristics. More... | |
class | TaskMemory |
Accesses the memory of another Mach task. More... | |
class | Thread |
Basic thread abstraction. Users should derive from this class and implement ThreadMain(). More... | |
class | ThreadLogMessages |
Captures log messages produced on the current thread during an object’s lifetime. More... | |
class | ThreadSnapshot |
An abstract interface to a snapshot representing a thread (lightweight process) present in a snapshot process. More... | |
class | ToolSupport |
Common functions used by command line tools. More... | |
class | TSimpleAddressRangeBag |
A bag implementation using a fixed amount of storage, so that it does not perform any dynamic allocations for its operations. More... | |
class | TSimpleStringDictionary |
A map/dictionary collection implementation using a fixed amount of storage, so that it does not perform any dynamic allocations for its operations. More... | |
struct | uint128_struct |
Stores a 128-bit quantity. More... | |
class | UniversalMachExcServer |
A server interface for the exc and mach_exc Mach subsystems, unified to handle exceptions delivered to either subsystem, and simplified to have only a single interface method needing implementation. More... | |
class | UnloadedModuleSnapshot |
Information about an unloaded module that was previously loaded into a snapshot process. More... | |
class | UserMinidumpStream |
Information describing a custom user data stream in a minidump. More... | |
struct | UUID |
A universally unique identifier (UUID). More... | |
class | WeakFileHandleFileReader |
A file reader backed by a FileHandle. More... | |
class | WeakFileHandleFileWriter |
A file writer backed by a FileHandle. More... | |
class | WeakStdioFileReader |
A file reader backed by a standard input/output FILE* . More... | |
class | WorkerThread |
A WorkerThread executes its Delegate's DoWork method repeatedly on a dedicated thread at a set time interval. More... | |
struct | WritableIoVec |
A version of iovec with a const iov_base field. More... | |
Typedefs | |
using | SimpleAddressRangeBag = TSimpleAddressRangeBag< 64 > |
A TSimpleAddressRangeBag with default template parameters. | |
using | SimpleStringDictionary = TSimpleStringDictionary< 256, 256, 64 > |
A TSimpleStringDictionary with default template parameters. More... | |
using | MinidumpUTF16StringListWriter = internal::MinidumpStringListWriter< internal::MinidumpUTF16StringWriter > |
using | MinidumpUTF8StringListWriter = internal::MinidumpStringListWriter< internal::MinidumpUTF8StringWriter > |
using | MinidumpThreadIDMap = std::map< uint64_t, uint32_t > |
A map that connects 64-bit snapshot thread IDs to 32-bit minidump thread IDs. More... | |
using | FileHandle = int |
Platform-specific alias for a low-level file handle. | |
using | FileOffset = off_t |
Platform-specific alias for a position in an open file. | |
using | ScopedFileHandle = base::ScopedFD |
Scoped wrapper of a FileHandle. | |
using | FileOperationResult = ssize_t |
using | CheckedMachAddressRange = internal::CheckedAddressRangeGeneric< mach_vm_address_t, mach_vm_size_t > |
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... | |
using | ConstThreadState = const natural_t * |
A const version of thread_state_t . More... | |
using | MachMessageDeadline = uint64_t |
The time before which a MachMessageWithDeadline() call should complete. More... | |
using | SymbolicConstantToStringOptions = unsigned int |
A bitfield containing values of SymbolicConstantToStringOptionBits. | |
using | StringToSymbolicConstantOptions = unsigned int |
A bitfield containing values of StringToSymbolicConstantOptionBits. | |
using | HTTPHeaders = std::map< std::string, std::string > |
A map of HTTP header fields to their values. | |
template<typename T , size_t Alignment = ALIGNOF(T)> | |
using | AlignedVector = std::vector< T, AlignedAllocator< T, Alignment > > |
A std::vector using AlignedAllocator. More... | |
using | WinVMAddress = uint64_t |
Type used to represent an address in a process, potentially across bitness. | |
using | WinVMSize = uint64_t |
Type used to represent the size of a memory range (with a WinVMAddress), potentially across bitness. | |
using | CheckedWinAddressRange = internal::CheckedAddressRangeGeneric< WinVMAddress, WinVMSize > |
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... | |
using | ScopedFileHANDLE = base::ScopedGeneric< HANDLE, internal::ScopedFileHANDLECloseTraits > |
using | ScopedKernelHANDLE = base::ScopedGeneric< HANDLE, internal::ScopedKernelHANDLECloseTraits > |
using | ScopedLocalAlloc = base::ScopedGeneric< HLOCAL, internal::LocalAllocTraits > |
Enumerations | |
enum | MinidumpContextFlags : uint32_t |
Architecture-independent flags for context_flags fields in Minidump context structures. More... | |
enum | MinidumpContextX86Flags : uint32_t |
32-bit x86-specifc flags for MinidumpContextX86::context_flags. More... | |
enum | MinidumpContextAMD64Flags : uint32_t |
x86_64-specific flags for MinidumpContextAMD64::context_flags. More... | |
enum | MinidumpStreamType : uint32_t |
Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each stream structure has a corresponding stream type value to identify it. More... | |
enum | MinidumpCPUArchitecture : uint16_t |
CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture. More... | |
enum | MinidumpOSType : uint8_t |
Operating system type values for MINIDUMP_SYSTEM_INFO::ProductType. More... | |
enum | MinidumpOS : uint32_t |
Operating system family values for MINIDUMP_SYSTEM_INFO::PlatformId. More... | |
enum | CPUArchitecture |
A system’s CPU architecture. More... | |
enum | ProcessSuspensionState : bool |
State of process being read by ProcessReaderWin. More... | |
enum | FileWriteMode |
Determines the mode that LoggingOpenFileForWrite() uses. More... | |
enum | FilePermissions : bool |
Determines the permissions bits for files created on POSIX systems. More... | |
enum | FileLocking : bool |
Determines the locking mode that LoggingLockFile() uses. More... | |
enum | XattrStatus |
The result code for a ReadXattr operation. More... | |
enum | : mach_msg_timeout_t |
Special constants used as mach_msg_timeout_t values. More... | |
enum | : MachMessageDeadline |
Special constants used as MachMessageDeadline values. More... | |
enum | SymbolicConstantToStringOptionBits |
Options for various *ToString functions in symbolic_constants_* files. More... | |
enum | StringToSymbolicConstantOptionBits |
Options for various StringTo* functions in symbolic_constants_* files. More... | |
enum | TriState : uint8_t |
A tri-state value that can be unset, on, or off. More... | |
enum | |
enum | |
enum | TerminationCodes : unsigned int |
Crashpad-specific codes that are used as arguments to TerminateProcess() in unusual circumstances. More... | |
enum | |
Functions | |
void | CaptureContext (NativeCPUContext *cpu_context) |
Saves the CPU context. More... | |
void | PruneCrashReportDatabase (CrashReportDatabase *database, PruneCondition *condition) |
Deletes crash reports from database that match condition. More... | |
std::unique_ptr< PruneCondition > | GetDefaultDatabasePruneCondition () |
void | SimulateCrash (const NativeCPUContext &cpu_context) |
Simulates a exception without crashing. More... | |
int | HandlerMain (int argc, char *argv[]) |
The main() of the crashpad_handler binary. More... | |
void | BuildMinidumpThreadIDMap (const std::vector< const ThreadSnapshot * > &thread_snapshots, MinidumpThreadIDMap *thread_id_map) |
Builds a MinidumpThreadIDMap for a group of ThreadSnapshot objects. More... | |
bool | ReadModuleAnnotations (HANDLE process, HMODULE module, std::map< std::string, std::string > *annotations) |
Reads the module annotations from another process. More... | |
void | InitializeX86Context (const CONTEXT &context, CPUContextX86 *out) |
void | InitializeX86Context (const WOW64_CONTEXT &context, CPUContextX86 *out) |
Initializes a CPUContextX86 structure from a native context structure on Windows. | |
void | InitializeX64Context (const CONTEXT &context, CPUContextX86_64 *out) |
Initializes a CPUContextX86_64 structure from a native context structure on Windows. | |
template bool | PEImageReader::GetCrashpadInfo< process_types::internal::Traits32 > (process_types::CrashpadInfo< process_types::internal::Traits32 > *crashpad_info) const |
template bool | PEImageReader::GetCrashpadInfo< process_types::internal::Traits64 > (process_types::CrashpadInfo< process_types::internal::Traits64 > *crashpad_info) const |
bool | LoggingReadFile (FileHandle file, void *buffer, size_t size) |
Wraps ReadFile(), ensuring that exactly size bytes are read. More... | |
bool | LoggingWriteFile (FileHandle file, const void *buffer, size_t size) |
Wraps WriteFile(), ensuring that exactly size bytes are written. More... | |
void | CheckedReadFile (FileHandle file, void *buffer, size_t size) |
Wraps ReadFile(), ensuring that exactly size bytes are read. More... | |
void | CheckedWriteFile (FileHandle file, const void *buffer, size_t size) |
Wraps WriteFile(), ensuring that exactly size bytes are written. More... | |
void | CheckedReadFileAtEOF (FileHandle file) |
Wraps ReadFile(), ensuring that it indicates end-of-file. More... | |
void | CheckedCloseFile (FileHandle file) |
Wraps close() or CloseHandle() , ensuring that it succeeds. More... | |
FileOperationResult | ReadFile (FileHandle file, void *buffer, size_t size) |
Reads from a file, retrying when interrupted on POSIX or following a short read. More... | |
FileOperationResult | WriteFile (FileHandle file, const void *buffer, size_t size) |
Writes to a file, retrying when interrupted or following a short write on POSIX. More... | |
FileHandle | OpenFileForRead (const base::FilePath &path) |
Wraps open() or CreateFile() , opening an existing file for reading. More... | |
FileHandle | OpenFileForWrite (const base::FilePath &path, FileWriteMode mode, FilePermissions permissions) |
Wraps open() or CreateFile() , creating a file for output. More... | |
FileHandle | OpenFileForReadAndWrite (const base::FilePath &path, FileWriteMode mode, FilePermissions permissions) |
Wraps open() or CreateFile() , creating a file for both input and output. More... | |
FileHandle | LoggingOpenFileForRead (const base::FilePath &path) |
Wraps OpenFileForRead(), logging an error if the operation fails. More... | |
FileHandle | LoggingOpenFileForWrite (const base::FilePath &path, FileWriteMode mode, FilePermissions permissions) |
Wraps OpenFileForWrite(), logging an error if the operation fails. More... | |
FileHandle | LoggingOpenFileForReadAndWrite (const base::FilePath &path, FileWriteMode mode, FilePermissions permissions) |
Wraps OpenFileForReadAndWrite(), logging an error if the operation fails. More... | |
bool | LoggingLockFile (FileHandle file, FileLocking locking) |
Locks the given file using flock() on POSIX or LockFileEx() on Windows. More... | |
bool | LoggingUnlockFile (FileHandle file) |
Unlocks a file previously locked with LoggingLockFile(). More... | |
FileOffset | LoggingSeekFile (FileHandle file, FileOffset offset, int whence) |
Wraps lseek() or SetFilePointerEx() . Logs an error if the operation fails. More... | |
bool | LoggingTruncateFile (FileHandle file) |
Truncates the given file to zero bytes in length. More... | |
bool | LoggingCloseFile (FileHandle file) |
Wraps close() or CloseHandle() , logging an error if the operation fails. More... | |
FileOffset | LoggingFileSizeByHandle (FileHandle file) |
Determines the size of a file. More... | |
launch_data_t | CFPropertyToLaunchData (CFPropertyListRef property_cf) |
Converts a Core Foundation-type property list to a launchd-type launch_data_t . More... | |
int | MacOSXMinorVersion () |
Returns the version of the running operating system. More... | |
bool | MacOSXVersion (int *major, int *minor, int *bugfix, std::string *build, bool *server, std::string *version_string) |
Returns the version of the running operating system. More... | |
void | MacModelAndBoard (std::string *model, std::string *board_id) |
Returns the model name and board ID of the running system. More... | |
bool | ServiceManagementSubmitJob (CFDictionaryRef job_cf) |
Submits a job to the user launchd domain as in SMJobSubmit() . More... | |
bool | ServiceManagementRemoveJob (const std::string &label, bool wait) |
Removes a job from the user launchd domain as in SMJobRemove() . More... | |
bool | ServiceManagementIsJobLoaded (const std::string &label) |
Determines whether a specified job is loaded in the user launchd domain. More... | |
pid_t | ServiceManagementIsJobRunning (const std::string &label) |
Determines whether a specified job is running in the user launchd domain. More... | |
XattrStatus | ReadXattr (const base::FilePath &file, const base::StringPiece &name, std::string *value) |
Reads an extended attribute on a file. More... | |
bool | WriteXattr (const base::FilePath &file, const base::StringPiece &name, const std::string &value) |
Writes an extended attribute on a file. More... | |
XattrStatus | ReadXattrBool (const base::FilePath &file, const base::StringPiece &name, bool *value) |
Reads an extended attribute on a file. More... | |
bool | WriteXattrBool (const base::FilePath &file, const base::StringPiece &name, bool value) |
Writes an extended attribute on a file. More... | |
XattrStatus | ReadXattrInt (const base::FilePath &file, const base::StringPiece &name, int *value) |
Reads an extended attribute on a file. More... | |
bool | WriteXattrInt (const base::FilePath &file, const base::StringPiece &name, int value) |
Writes an extended attribute on a file. More... | |
XattrStatus | ReadXattrTimeT (const base::FilePath &file, const base::StringPiece &name, time_t *value) |
Reads an extended attribute on a file. More... | |
bool | WriteXattrTimeT (const base::FilePath &file, const base::StringPiece &name, time_t value) |
Writes an extended attribute on a file. More... | |
XattrStatus | RemoveXattr (const base::FilePath &file, const base::StringPiece &name) |
Removes an extended attribute from a file. More... | |
kern_return_t | UniversalExceptionRaise (exception_behavior_t behavior, exception_handler_t exception_port, thread_t thread, task_t task, exception_type_t exception, const mach_exception_data_type_t *code, mach_msg_type_number_t code_count, thread_state_flavor_t *flavor, ConstThreadState old_state, mach_msg_type_number_t old_state_count, thread_state_t new_state, mach_msg_type_number_t *new_state_count) |
Calls the appropriate *exception_raise*() function for the specified behavior. More... | |
kern_return_t | ExcServerSuccessfulReturnValue (exception_type_t exception, exception_behavior_t behavior, bool set_thread_state) |
Computes an approriate successful return value for an exception handler function. More... | |
void | ExcServerCopyState (exception_behavior_t behavior, ConstThreadState old_state, mach_msg_type_number_t old_state_count, thread_state_t new_state, mach_msg_type_number_t *new_state_count) |
Copies the old state to the new state for state-carrying exceptions. More... | |
bool | ExceptionBehaviorHasState (exception_behavior_t behavior) |
Determines whether behavior indicates an exception behavior that carries thread state information. More... | |
bool | ExceptionBehaviorHasIdentity (exception_behavior_t behavior) |
Determines whether behavior indicates an exception behavior that carries thread and task identities. More... | |
bool | ExceptionBehaviorHasMachExceptionCodes (exception_behavior_t behavior) |
Determines whether behavior indicates an exception behavior that carries 64-bit exception codes (“Mach exception codes”). More... | |
exception_behavior_t | ExceptionBehaviorBasic (exception_behavior_t behavior) |
Returns the basic behavior value of behavior, its value without MACH_EXCEPTION_CODES set. More... | |
exception_type_t | ExcCrashRecoverOriginalException (mach_exception_code_t code_0, mach_exception_code_t *original_code_0, int *signal) |
Recovers the original exception, first exception code, and signal from the encoded form of the first exception code delivered with EXC_CRASH exceptions. More... | |
bool | ExcCrashCouldContainException (exception_type_t exception) |
Determines whether a given exception type could plausibly be carried within an EXC_CRASH exception. More... | |
int32_t | ExceptionCodeForMetrics (exception_type_t exception, mach_exception_code_t code_0) |
Returns the exception code to report via a configured metrics system. More... | |
bool | IsExceptionNonfatalResource (exception_type_t exception, mach_exception_code_t code_0, pid_t pid) |
Determines whether an exception is a non-fatal EXC_RESOURCE . More... | |
thread_t | MachThreadSelf () |
Like mach_thread_self() , but without the obligation to release the send right. More... | |
mach_port_t | NewMachPort (mach_port_right_t right) |
Creates a new Mach port in the current task. More... | |
exception_mask_t | ExcMaskAll () |
The value for EXC_MASK_ALL appropriate for the operating system at run time. More... | |
exception_mask_t | ExcMaskValid () |
An exception mask containing every possible exception understood by the operating system at run time. More... | |
base::mac::ScopedMachReceiveRight | BootstrapCheckIn (const std::string &service_name) |
Makes a boostrap_check_in() call to the process’ bootstrap server. More... | |
base::mac::ScopedMachSendRight | BootstrapLookUp (const std::string &service_name) |
Makes a boostrap_look_up() call to the process’ bootstrap server. More... | |
base::mac::ScopedMachSendRight | SystemCrashReporterHandler () |
Obtains the system’s default Mach exception handler for crash-type exceptions. More... | |
MachMessageDeadline | MachMessageDeadlineFromTimeout (mach_msg_timeout_t timeout_ms) |
Computes the deadline for a specified timeout value. More... | |
mach_msg_return_t | MachMessageWithDeadline (mach_msg_header_t *message, mach_msg_option_t options, mach_msg_size_t receive_size, mach_port_name_t receive_port, MachMessageDeadline deadline, mach_port_name_t notify_port, bool run_even_if_expired) |
Runs mach_msg() with a deadline, as opposed to a timeout. More... | |
void | PrepareMIGReplyFromRequest (const mach_msg_header_t *in_header, mach_msg_header_t *out_header) |
Initializes a reply message for a MIG server routine based on its corresponding request. More... | |
void | SetMIGReplyError (mach_msg_header_t *out_header, kern_return_t error) |
Sets the error code in a reply message for a MIG server routine. More... | |
const mach_msg_trailer_t * | MachMessageTrailerFromHeader (const mach_msg_header_t *header) |
Returns a Mach message trailer for a message that has been received. More... | |
pid_t | AuditPIDFromMachMessageTrailer (const mach_msg_trailer_t *trailer) |
Returns the process ID of a Mach message’s sender from its audit trailer. More... | |
bool | MachMessageDestroyReceivedPort (mach_port_t port, mach_msg_type_name_t port_right_type) |
Destroys or deallocates a Mach port received in a Mach message. More... | |
std::string | ExceptionToString (exception_type_t exception, SymbolicConstantToStringOptions options) |
Converts a Mach exception value to a textual representation. More... | |
bool | StringToException (const base::StringPiece &string, StringToSymbolicConstantOptions options, exception_type_t *exception) |
Converts a string to its corresponding Mach exception value. More... | |
std::string | ExceptionMaskToString (exception_mask_t exception_mask, SymbolicConstantToStringOptions options) |
Converts a Mach exception mask value to a textual representation. More... | |
bool | StringToExceptionMask (const base::StringPiece &string, StringToSymbolicConstantOptions options, exception_mask_t *exception_mask) |
Converts a string to its corresponding Mach exception mask value. More... | |
std::string | ExceptionBehaviorToString (exception_behavior_t behavior, SymbolicConstantToStringOptions options) |
Converts a Mach exception behavior value to a textual representation. More... | |
bool | StringToExceptionBehavior (const base::StringPiece &string, StringToSymbolicConstantOptions options, exception_behavior_t *behavior) |
Converts a string to its corresponding Mach exception behavior value. More... | |
std::string | ThreadStateFlavorToString (thread_state_flavor_t flavor, SymbolicConstantToStringOptions options) |
Converts a thread state flavor value to a textual representation. More... | |
bool | StringToThreadStateFlavor (const base::StringPiece &string, StringToSymbolicConstantOptions options, thread_state_flavor_t *flavor) |
Converts a string to its corresponding thread state flavor value. More... | |
task_t | TaskForPID (pid_t pid) |
Wraps task_for_pid() . More... | |
uint64_t | ClockMonotonicNanoseconds () |
Returns the value of the system’s monotonic clock. More... | |
void | SleepNanoseconds (uint64_t nanoseconds) |
Sleeps for the specified duration. More... | |
template<typename To , typename From > | |
To | implicit_cast (From const &f) |
std::string | RandomString () |
Returns a random string. More... | |
int | ZlibWindowBitsWithGzipWrapper (int window_bits) |
Obtain a window_bits parameter to pass to deflateInit2() or inflateInit2() that specifies a gzip wrapper instead of the default zlib wrapper. More... | |
std::string | ZlibErrorString (int zr) |
Formats a string for an error received from the zlib library. More... | |
template<typename Destination , typename Source > | |
Destination | InRangeCast (Source source, Destination default_value) |
Casts to a different type if it can be done without data loss, logging a warning message and returing a default value otherwise. More... | |
template<typename Destination , typename Source > | |
bool | AssignIfInRange (Destination *destination, Source source) |
Performs an assignment if it can be done safely, and signals if it cannot be done safely. More... | |
void | CloseMultipleNowOrOnExec (int fd, int preserve_fd) |
Close multiple file descriptors or mark them close-on-exec. More... | |
void | CloseStdinAndStdout () |
Closes stdin and stdout by opening /dev/null over them. More... | |
void | DropPrivileges () |
Permanently drops privileges conferred by being a setuid or setgid executable. More... | |
std::string | SignalToString (int signal, SymbolicConstantToStringOptions options) |
Converts a POSIX signal value to a textual representation. More... | |
bool | StringToSignal (const base::StringPiece &string, StringToSymbolicConstantOptions options, int *signal) |
Converts a string to its corresponding POSIX signal value. More... | |
template<class T1 , class T2 , size_t Alignment> | |
bool | operator== (const AlignedAllocator< T1, Alignment > &lhs, const AlignedAllocator< T2, Alignment > &rhs) CRASHPAD_NOEXCEPT |
template<class T1 , class T2 , size_t Alignment> | |
bool | operator!= (const AlignedAllocator< T1, Alignment > &lhs, const AlignedAllocator< T2, Alignment > &rhs) CRASHPAD_NOEXCEPT |
template<typename T > | |
bool | MapInsertOrReplace (T *map, const typename T::key_type &key, const typename T::mapped_type &value, typename T::mapped_type *old_value) |
Inserts a mapping from key to value into map, or replaces an existing mapping so that key maps to value. More... | |
size_t | c16lcpy (base::char16 *destination, const base::char16 *source, size_t length) |
Copy a NUL -terminated char16-based string to a fixed-size buffer. More... | |
size_t | strnlen (const char *string, size_t max_length) |
Returns the length of a string, not to exceed a maximum. More... | |
bool | SplitStringFirst (const std::string &string, char delimiter, std::string *left, std::string *right) |
Splits a string into two parts at the first delimiter found. More... | |
std::vector< std::string > | SplitString (const std::string &string, char delimiter) |
Splits a string into multiple parts on the given delimiter. More... | |
void | CaptureContext (CONTEXT *context) |
Saves the CPU context. More... | |
void | AppendCommandLineArgument (const std::wstring &argument, std::wstring *command_line) |
Utility function for building escaped command lines. More... | |
bool | InitializeCriticalSectionWithDebugInfoIfPossible (CRITICAL_SECTION *critical_section) |
Equivalent to InitializeCritialSection() , but attempts to allocate with a valid .DebugInfo field on versions of Windows where it's possible to do so. More... | |
BOOL | CrashpadGetModuleInformation (HANDLE process, HMODULE module, MODULEINFO *module_info, DWORD cb) |
Proxy function for GetModuleInformation() . | |
int | HandleToInt (HANDLE handle) |
Converts a HANDLE to an int . More... | |
HANDLE | IntToHandle (int handle_int) |
Converts an int to an HANDLE . More... | |
bool | GetModuleVersionAndType (const base::FilePath &path, VS_FIXEDFILEINFO *vs_fixedfileinfo) |
Retrieve the type and version information from a given module (exe, dll, etc.) More... | |
NTSTATUS | NtClose (HANDLE handle) |
NTSTATUS | NtCreateThreadEx (PHANDLE thread_handle, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, HANDLE process_handle, PVOID start_routine, PVOID argument, ULONG create_flags, SIZE_T zero_bits, SIZE_T stack_size, SIZE_T maximum_stack_size, PVOID attribute_list) |
NTSTATUS | NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS system_information_class, PVOID system_information, ULONG system_information_length, PULONG return_length) |
NTSTATUS | NtQueryInformationThread (HANDLE thread_handle, THREADINFOCLASS thread_information_class, PVOID thread_information, ULONG thread_information_length, PULONG return_length) |
template<class Traits > | |
NTSTATUS | NtOpenThread (PHANDLE thread_handle, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, const process_types::CLIENT_ID< Traits > *client_id) |
NTSTATUS | NtQueryObject (HANDLE handle, OBJECT_INFORMATION_CLASS object_information_class, void *object_information, ULONG object_information_length, ULONG *return_length) |
NTSTATUS | NtSuspendProcess (HANDLE handle) |
NTSTATUS | NtResumeProcess (HANDLE handle) |
void | RtlGetUnloadEventTraceEx (ULONG **element_size, ULONG **element_count, void **event_trace) |
template NTSTATUS | NtOpenThread< process_types::internal::Traits32 > (PHANDLE thread_handle, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, const process_types::CLIENT_ID< process_types::internal::Traits32 > *client_id) |
template NTSTATUS | NtOpenThread< process_types::internal::Traits64 > (PHANDLE thread_handle, ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, const process_types::CLIENT_ID< process_types::internal::Traits64 > *client_id) |
template<class Traits > | |
bool | GetProcessBasicInformation (HANDLE process, bool is_wow64, ProcessInfo *process_info, WinVMAddress *peb_address, WinVMSize *peb_size) |
template<class Traits > | |
bool | ReadProcessData (HANDLE process, WinVMAddress peb_address_vmaddr, ProcessInfo *process_info) |
bool | ReadMemoryInfo (HANDLE process, bool is_64_bit, ProcessInfo *process_info) |
std::vector< CheckedRange< WinVMAddress, WinVMSize > > | GetReadableRangesOfMemoryMap (const CheckedRange< WinVMAddress, WinVMSize > &range, const ProcessInfo::MemoryBasicInformation64Vector &memory_info) |
Given a memory map of a process, and a range to be read from the target process, returns a vector of ranges, representing the readable portions of the original range. More... | |
bool | SendToCrashHandlerServer (const base::string16 &pipe_name, const ClientToServerMessage &message, ServerToClientMessage *response) |
Connect over the given pipe_name, passing message to the server, storing the server's reply into response. More... | |
HANDLE | CreateNamedPipeInstance (const std::wstring &pipe_name, bool first_instance) |
Wraps CreateNamedPipe() to create a single named pipe instance. More... | |
const void * | GetSecurityDescriptorForNamedPipeInstance (size_t *size) |
Returns the SECURITY_DESCRIPTOR blob that will be used for creating the connection pipe in CreateNamedPipeInstance(). More... | |
timeval | FiletimeToTimevalEpoch (const FILETIME &filetime) |
Convert Windows FILETIME to timeval , converting from Windows epoch to POSIX epoch. | |
timeval | FiletimeToTimevalInterval (const FILETIME &filetime) |
Convert Windows FILETIME to timeval , treating the values as an interval of elapsed time. | |
void | GetTimeOfDay (timeval *tv) |
Similar to POSIX gettimeofday(), gets the current system time in UTC. | |
launch_data_t | LaunchDataAlloc (launch_data_type_t type) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_type_t | LaunchDataGetType (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
void | LaunchDataFree (launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
bool | LaunchDataDictInsert (launch_data_t dict, const launch_data_t value, const char *key) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataDictLookup (const launch_data_t dict, const char *key) |
Wraps the <launch.h> function of the same name. More... | |
size_t | LaunchDataDictGetCount (launch_data_t dict) |
Wraps the <launch.h> function of the same name. More... | |
bool | LaunchDataArraySetIndex (launch_data_t array, const launch_data_t value, size_t index) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataArrayGetIndex (launch_data_t array, size_t index) |
Wraps the <launch.h> function of the same name. More... | |
size_t | LaunchDataArrayGetCount (launch_data_t array) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataNewInteger (long long integer) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataNewBool (bool boolean) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataNewReal (double real) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataNewString (const char *string) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchDataNewOpaque (const void *opaque, size_t size) |
Wraps the <launch.h> function of the same name. More... | |
long long | LaunchDataGetInteger (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
bool | LaunchDataGetBool (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
double | LaunchDataGetReal (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
const char * | LaunchDataGetString (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
void * | LaunchDataGetOpaque (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
size_t | LaunchDataGetOpaqueSize (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
int | LaunchDataGetErrno (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
launch_data_t | LaunchMsg (const launch_data_t data) |
Wraps the <launch.h> function of the same name. More... | |
bool | StringToNumber (const base::StringPiece &string, int *number) |
Convert a string to a number. More... | |
bool | StringToNumber (const base::StringPiece &string, unsigned int *number) |
Convert a string to a number. More... | |
bool | StringToNumber (const base::StringPiece &string, int64_t *number) |
Convert a string to a number. More... | |
bool | StringToNumber (const base::StringPiece &string, uint64_t *number) |
Convert a string to a number. More... | |
Variables | |
CrashpadInfo | g_crashpad_info |
return measured_size_in_kb_ | max_size_in_kb_ |
int * | g_extra_memory_pointer |
int * | g_extra_memory_not_saved |
const FileHandle | kInvalidFileHandle = -1 |
A value that can never be a valid FileHandle. | |
const mach_port_t | kMachPortNull = MACH_PORT_NULL |
MACH_PORT_NULL with the correct type for a Mach port, mach_port_t . More... | |
const exception_behavior_t | kMachExceptionCodes = MACH_EXCEPTION_CODES |
MACH_EXCEPTION_CODES with the correct type for a Mach exception behavior, exception_behavior_t . More... | |
const exception_type_t | kMachExceptionSimulated = 'CPsx' |
An exception type to use for simulated exceptions. | |
const mach_msg_option_t | kMachMessageReceiveAuditTrailer |
A Mach message option specifying that an audit trailer should be delivered during a receive operation. More... | |
const char | kContentType [] = "Content-Type" |
The header name "Content-Type" . | |
const char | kContentLength [] = "Content-Length" |
The header name "Content-Length" . | |
const char | kContentEncoding [] = "Content-Encoding" |
The header name "Content-Encoding" . | |
The main namespace.
using crashpad::AlignedVector = typedef std::vector<T, AlignedAllocator<T, Alignment> > |
A std::vector
using AlignedAllocator.
This is similar to std::vector<T>
, with the addition of an alignment guarantee. Alignment must be a power of 2. If Alignment is not specified, the default alignment for type T is used.
using crashpad::CheckedMachAddressRange = typedef internal::CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t> |
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.
This class checks bases of type mach_vm_address_t
and sizes of type mach_vm_address_t
against a process whose pointer type is either 32 or 64 bits wide.
Aside from varying the overall range on the basis of a process’ pointer type width, this class functions very similarly to CheckedRange.
using crashpad::CheckedWinAddressRange = typedef internal::CheckedAddressRangeGeneric<WinVMAddress, WinVMSize> |
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.
This class checks bases of type WinVMAddress and sizes of type WinVMSize against a process whose pointer type is either 32 or 64 bits wide.
Aside from varying the overall range on the basis of a process' pointer type width, this class functions very similarly to CheckedRange.
using crashpad::ConstThreadState = typedef const natural_t* |
A const version of thread_state_t
.
This is useful as the old_state parameter to exception handler functions. Normally, these parameters are of type thread_state_t
, but this allows modification of the state, which is conceptually const
.
using crashpad::MachMessageDeadline = typedef uint64_t |
The time before which a MachMessageWithDeadline() call should complete.
A value of this type may be one of the special constants kMachMessageDeadlineNonblocking or kMachMessageDeadlineWaitIndefinitely. Any other values should be produced by calling MachMessageDeadlineFromTimeout().
Internally, these are currently specified on the same time base as ClockMonotonicNanoseconds(), although this is an implementation detail.
using crashpad::MinidumpThreadIDMap = typedef std::map<uint64_t, uint32_t> |
A map that connects 64-bit snapshot thread IDs to 32-bit minidump thread IDs.
64-bit snapshot thread IDs are obtained from ThreadSnapshot::ThreadID(). 32-bit minidump thread IDs are stored in MINIDUMP_THREAD::ThreadId.
A ThreadIDMap ensures that there are no collisions among the set of 32-bit minidump thread IDs.
using crashpad::SimpleStringDictionary = typedef TSimpleStringDictionary<256, 256, 64> |
A TSimpleStringDictionary with default template parameters.
For historical reasons this specialized version is available with the same size factors as a previous implementation.
anonymous enum |
Enumerator | |
---|---|
kXPProcessAllAccess | This is the XP-suitable value of Requesting |
kXPThreadAllAccess | This is the XP-suitable value of Requesting |
anonymous enum : mach_msg_timeout_t |
Special constants used as mach_msg_timeout_t
values.
Enumerator | |
---|---|
kMachMessageTimeoutNonblocking | When passed to MachMessageDeadlineFromTimeout(), that function will return kMachMessageDeadlineNonblocking. |
kMachMessageTimeoutWaitIndefinitely | When passed to MachMessageDeadlineFromTimeout(), that function will return kMachMessageDeadlineWaitIndefinitely. |
anonymous enum : MachMessageDeadline |
Special constants used as MachMessageDeadline values.
Enumerator | |
---|---|
kMachMessageDeadlineNonblocking | MachMessageWithDeadline() should not block at all in its operation. |
kMachMessageDeadlineWaitIndefinitely | MachMessageWithDeadline() should wait indefinitely for the requested operation to complete. |
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.
Enumerator | |
---|---|
kCPUArchitectureUnknown | The CPU architecture is unknown. |
kCPUArchitectureX86 | 32-bit x86. |
kCPUArchitectureX86_64 | x86_64. |
|
strong |
Determines the locking mode that LoggingLockFile() uses.
Enumerator | |
---|---|
kShared | Equivalent to |
kExclusive | Equivalent to |
|
strong |
|
strong |
Determines the mode that LoggingOpenFileForWrite() uses.
enum crashpad::MinidumpContextAMD64Flags : uint32_t |
x86_64-specific flags for MinidumpContextAMD64::context_flags.
enum crashpad::MinidumpContextFlags : uint32_t |
Architecture-independent flags for context_flags
fields in Minidump context structures.
Enumerator | |
---|---|
kMinidumpContextExceptionActive | The thread was executing a trap handler in kernel mode ( If this bit is set, it indicates that the context is from a thread that was executing a trap handler in the kernel. This bit is only valid when kMinidumpContextExceptionReporting is also set. This bit is only used on Windows. |
kMinidumpContextServiceActive | The thread was executing a system call in kernel mode ( If this bit is set, it indicates that the context is from a thread that was executing a system call in the kernel. This bit is only valid when kMinidumpContextExceptionReporting is also set. This bit is only used on Windows. |
kMinidumpContextExceptionRequest | Kernel-mode state reporting is desired ( This bit is not used in context structures containing snapshots of thread CPU context. It used when calling |
kMinidumpContextExceptionReporting | Kernel-mode state reporting is provided ( If this bit is set, it indicates that the bits indicating how the thread had entered kernel mode (kMinidumpContextExceptionActive and and kMinidumpContextServiceActive) are valid. This bit is only used on Windows. |
enum crashpad::MinidumpContextX86Flags : uint32_t |
32-bit x86-specifc flags for MinidumpContextX86::context_flags.
enum crashpad::MinidumpCPUArchitecture : uint16_t |
CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.
Enumerator | |
---|---|
kMinidumpCPUArchitectureX86 | 32-bit x86. These systems identify their CPUs generically as “x86” or “ia32”, or with more specific names such as “i386”, “i486”, “i586”, and “i686”. |
kMinidumpCPUArchitecturePPC | 32-bit PowerPC. These systems identify their CPUs generically as “ppc”, or with more specific names such as “ppc6xx”, “ppc7xx”, and “ppc74xx”. |
kMinidumpCPUArchitectureARM | 32-bit ARM. These systems identify their CPUs generically as “arm”, or with more specific names such as “armv6” and “armv7”. |
kMinidumpCPUArchitectureAMD64 | 64-bit x86. These systems identify their CPUs as “x86_64”, “amd64”, or “x64”. |
kMinidumpCPUArchitectureX86Win64 | A 32-bit x86 process running on IA-64 (Itanium).
|
kMinidumpCPUArchitectureARM64 | 64-bit ARM. These systems identify their CPUs generically as “arm64” or “aarch64”, or with more specific names such as “armv8”. |
kMinidumpCPUArchitecturePPC64 | 64-bit PowerPC. These systems identify their CPUs generically as “ppc64”, or with more specific names such as “ppc970”. |
kMinidumpCPUArchitectureARM64Breakpad | Used by Breakpad for 64-bit ARM.
|
kMinidumpCPUArchitectureUnknown | Unknown CPU architecture. |
enum crashpad::MinidumpOS : uint32_t |
Operating system family values for MINIDUMP_SYSTEM_INFO::PlatformId.
enum crashpad::MinidumpOSType : uint8_t |
Operating system type values for MINIDUMP_SYSTEM_INFO::ProductType.
Enumerator | |
---|---|
kMinidumpOSTypeWorkstation | A “desktop” or “workstation” system. |
kMinidumpOSTypeDomainController | A “domain controller” system. Windows-specific. |
kMinidumpOSTypeServer | A “server” system. |
enum crashpad::MinidumpStreamType : uint32_t |
Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each stream structure has a corresponding stream type value to identify it.
Enumerator | |
---|---|
kMinidumpStreamTypeThreadList | The stream type for MINIDUMP_THREAD_LIST.
|
kMinidumpStreamTypeModuleList | The stream type for MINIDUMP_MODULE_LIST.
|
kMinidumpStreamTypeMemoryList | The stream type for MINIDUMP_MEMORY_LIST.
|
kMinidumpStreamTypeException | The stream type for MINIDUMP_EXCEPTION_STREAM.
|
kMinidumpStreamTypeSystemInfo | The stream type for MINIDUMP_SYSTEM_INFO.
|
kMinidumpStreamTypeHandleData | The stream type for MINIDUMP_HANDLE_DATA_STREAM.
|
kMinidumpStreamTypeUnloadedModuleList | The stream type for MINIDUMP_UNLOADED_MODULE_LIST.
|
kMinidumpStreamTypeMiscInfo | The stream type for MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO_2, MINIDUMP_MISC_INFO_3, and MINIDUMP_MISC_INFO_4.
|
kMinidumpStreamTypeMemoryInfoList | The stream type for MINIDUMP_MEMORY_INFO_LIST.
|
kMinidumpStreamTypeCrashpadInfo | The stream type for MinidumpCrashpadInfo. |
|
strong |
State of process being read by ProcessReaderWin.
Enumerator | |
---|---|
kRunning | The process has not been suspended. |
kSuspended | The process is suspended. |
Options for various StringTo*
functions in symbolic_constants_*
files.
Not every StringTo*
function will implement each of these options. See function-specific documentation for details.
Options for various *ToString
functions in symbolic_constants_*
files.
Enumerator | |
---|---|
kUseFullName | Return the full name for a given constant.
|
kUseShortName | Return the short name for a given constant. |
kUnknownIsEmpty | If no symbolic name is known for a given constant, return an empty string.
|
kUnknownIsNumeric | If no symbolic name is known for a given constant, return a numeric string. The numeric format used will vary by family, but will be appropriate to the family. Families whose values are typically constructed as bitfields will generally use a hexadecimal format, and other families will generally use a signed or unsigned decimal format. |
kUseOr | Use For families whose values may be constructed as bitfields, allow conversion to strings containing multiple individual components treated as being combined by a bitwise “or” operation. An example family of constants that behaves this way is the suite of Mach exception masks. For constants that are not constructed as bitfields, or constants that are only partially constructed as bitfields, this option has no effect. |
enum crashpad::TerminationCodes : unsigned int |
Crashpad-specific codes that are used as arguments to TerminateProcess()
in unusual circumstances.
|
strong |
A tri-state value that can be unset, on, or off.
|
strong |
void crashpad::AppendCommandLineArgument | ( | const std::wstring & | argument, |
std::wstring * | command_line | ||
) |
Utility function for building escaped command lines.
This builds a command line so that individual arguments can be reliably decoded by CommandLineToArgvW()
.
argument is appended to command_line. If necessary, it will be placed in quotation marks and escaped properly. If command_line is initially non-empty, a space will precede argument.
[in] | argument | The argument to append to command_line. |
[in,out] | command_line | The command line being constructed. |
bool crashpad::AssignIfInRange | ( | Destination * | destination, |
Source | source | ||
) |
Performs an assignment if it can be done safely, and signals if it cannot be done safely.
[out] | destination | A pointer to the variable to be assigned to. |
[in] | source | The value to assign. |
true
if source is in the range supported by the type of *destination, with the assignment to *destination having been performed. false
if the assignment cannot be completed safely because source is outside of this range. pid_t crashpad::AuditPIDFromMachMessageTrailer | ( | const mach_msg_trailer_t * | trailer | ) |
Returns the process ID of a Mach message’s sender from its audit trailer.
For the audit trailer to be present, the message must have been received with kMachMessageReceiveAuditTrailer or its macro equivalent specified in the receive options.
If the kernel is the message’s sender, a process ID of 0
will be returned.
[in] | trailer | The trailer received with a Mach message. |
-1
on failure with a message logged. It is considered a failure for trailer to not contain audit information. base::mac::ScopedMachReceiveRight crashpad::BootstrapCheckIn | ( | const std::string & | service_name | ) |
Makes a boostrap_check_in()
call to the process’ bootstrap server.
This function is provided to make it easier to call bootstrap_check_in()
while avoiding accidental leaks of the returned receive right.
[in] | service_name | The service name to check in. |
MACH_PORT_NULL
with a message logged. base::mac::ScopedMachSendRight crashpad::BootstrapLookUp | ( | const std::string & | service_name | ) |
Makes a boostrap_look_up()
call to the process’ bootstrap server.
This function is provided to make it easier to call bootstrap_look_up()
while avoiding accidental leaks of the returned send right.
[in] | service_name | The service name to look up. |
MACH_PORT_NULL
with a message logged. void crashpad::BuildMinidumpThreadIDMap | ( | const std::vector< const ThreadSnapshot * > & | thread_snapshots, |
MinidumpThreadIDMap * | thread_id_map | ||
) |
Builds a MinidumpThreadIDMap for a group of ThreadSnapshot objects.
[in] | thread_snapshots | The thread snapshots to use as source data. |
[out] | thread_id_map | A MinidumpThreadIDMap to be built by this method. This map must be empty when this function is called. |
The map ensures that for any unique 64-bit thread ID found in a ThreadSnapshot, the 32-bit thread ID used in a minidump file will also be unique.
size_t crashpad::c16lcpy | ( | base::char16 * | destination, |
const base::char16 * | source, | ||
size_t | length | ||
) |
Copy a NUL
-terminated char16-based string to a fixed-size buffer.
This function behaves identically to strlcpy()
, but it operates on char16 data instead of char
data. It copies the NUL
-terminated string in the buffer beginning at source to the buffer of size length at destination, ensuring that the destination buffer is NUL
-terminated. No data will be written outside of the destination buffer, but if length is smaller than the length of the string at source, the string will be truncated.
[out] | destination | A pointer to a buffer of at least size length char16 units (not bytes). The string will be copied to this buffer, possibly with truncation, and NUL -terminated. Nothing will be written following the NUL terminator. |
[in] | source | A pointer to a NUL -terminated string of char16 data. The NUL terminator must be a NUL value in a char16 unit, not just a single NUL byte. |
[in] | length | The length of the destination buffer in char16 units, not bytes. A maximum of length - 1 char16 units from source will be copied to destination. |
NUL
terminator. When truncation occurs, the return value will be equal to or greater than than the length parameter. void crashpad::CaptureContext | ( | CONTEXT * | context | ) |
Saves the CPU context.
The CPU context will be captured as accurately and completely as possible, containing an atomic snapshot at the point of this function’s return. This function does not modify any registers.
This function captures all integer registers as well as the floating-point and vector (SSE) state. It does not capture debug registers, which are inaccessible by user code.
This function is a replacement for RtlCaptureContext()
, which contains bugs and limitations. On 32-bit x86, RtlCaptureContext()
requires that ebp
be used as a frame pointer, and returns ebp
, esp
, and eip
out of sync with the other registers. Both the 32-bit x86 and 64-bit x86_64 versions of RtlCaptureContext()
capture only the state of the integer registers, ignoring floating-point and vector state.
[out] | context | The structure to store the context in. |
rcx
will be populated with the address of this function’s argument, as mandated by the ABI. void crashpad::CaptureContext | ( | NativeCPUContext * | cpu_context | ) |
Saves the CPU context.
The CPU context will be captured as accurately and completely as possible, containing an atomic snapshot at the point of this function’s return. This function does not modify any registers.
[out] | cpu_context | The structure to store the context in. |
%rdi
will be populated with the address of this function’s argument, as mandated by the ABI. If the value of %rdi
prior to calling this function is needed, it must be obtained separately prior to calling this function. For example: launch_data_t crashpad::CFPropertyToLaunchData | ( | CFPropertyListRef | property_cf | ) |
Converts a Core Foundation-type property list to a launchd-type launch_data_t
.
[in] | property_cf | The Core Foundation-type property list to convert. |
launch_data_t
. The caller takes ownership of the returned value. On error, returns nullptr
.CFPropertyListRef
types except for CFDateRef
, because there’s no launch_data_type_t
analogue. Not all types supported in a launchd-type launch_data_t
have CFPropertyListRef
analogues. void crashpad::CheckedCloseFile | ( | FileHandle | file | ) |
Wraps close()
or CloseHandle()
, ensuring that it succeeds.
If the underlying function fails, this function causes execution to terminate without returning.
void crashpad::CheckedReadFile | ( | FileHandle | file, |
void * | buffer, | ||
size_t | size | ||
) |
Wraps ReadFile(), ensuring that exactly size bytes are read.
If size is out of the range of possible ReadFile() return values, if the underlying ReadFile() fails, or if other than size bytes were read, this function causes execution to terminate without returning.
void crashpad::CheckedReadFileAtEOF | ( | FileHandle | file | ) |
Wraps ReadFile(), ensuring that it indicates end-of-file.
Attempts to read a single byte from file, 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.
void crashpad::CheckedWriteFile | ( | FileHandle | file, |
const void * | buffer, | ||
size_t | size | ||
) |
Wraps WriteFile(), ensuring that exactly size bytes are written.
If size is out of the range of possible WriteFile() return values, if the underlying WriteFile() fails, or if other than size bytes were written, this function causes execution to terminate without returning.
uint64_t crashpad::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.
void crashpad::CloseMultipleNowOrOnExec | ( | int | fd, |
int | preserve_fd | ||
) |
Close multiple file descriptors or mark them close-on-exec.
This is similar to the BSD/Solaris-style closefrom()
routine, which closes all open file descriptors equal to or higher than its fd argument. This function must not be called while other threads are active. It is intended to be used in a child process created by fork()
, prior to calling an exec()
-family function. This guarantees that a (possibly untrustworthy) child process does not inherit file descriptors that it has no need for.
Unlike the BSD function, this function may not close file descriptors immediately, but may instead mark them as close-on-exec. The actual behavior chosen is specific to the operating system. On macOS, file descriptors are marked close-on-exec instead of being closed outright in order to avoid raising EXC_GUARD
exceptions for guarded file descriptors that are protected against close()
.
[in] | fd | The lowest file descriptor to close or set as close-on-exec. |
[in] | preserve_fd | A file descriptor to preserve and not close (or set as close-on-exec), even if it is open and its value is greater than fd. To not preserve any file descriptor, pass -1 for this parameter. |
void crashpad::CloseStdinAndStdout | ( | ) |
Closes stdin
and stdout
by opening /dev/null
over them.
It is normally inadvisable to close()
the three standard input/output streams, because they occupy special file descriptors. Closing them outright could result in their file descriptors being reused. This causes problems for library code (including the standard library) that expects these file descriptors to have special meaning.
This function discards the standard input and standard output streams by opening /dev/null
and assigning it to their file descriptors, closing whatever had been at those file descriptors previously.
stderr
, the standard error stream, is not closed. It is often useful to retain the ability to send diagnostic messages to the standard error stream.
HANDLE crashpad::CreateNamedPipeInstance | ( | const std::wstring & | pipe_name, |
bool | first_instance | ||
) |
Wraps CreateNamedPipe() to create a single named pipe instance.
[in] | pipe_name | The name to use for the pipe. |
[in] | first_instance | If true , the named pipe instance will be created with FILE_FLAG_FIRST_PIPE_INSTANCE . This ensures that the the pipe name is not already in use when created. The first instance will be created with an untrusted integrity SACL so instances of this pipe can be connected to by processes of any integrity level. |
void crashpad::DropPrivileges | ( | ) |
Permanently drops privileges conferred by being a setuid or setgid executable.
The effective user ID and saved set-user ID are set to the real user ID, negating any effects of being a setuid executable. The effective group ID and saved set-group ID are set to the real group ID, negating any effects of being a setgid executable. Because the saved set-user ID and saved set-group ID are reset, there is no way to restore the prior privileges, and the drop is permanent.
This function drops privileges correctly when running setuid root and in other circumstances, including when running setuid non-root. If the program is not a setuid or setgid executable, this function has no effect.
No changes are made to the supplementary group list, which is normally not altered for setuid or setgid executables.
bool crashpad::ExcCrashCouldContainException | ( | exception_type_t | exception | ) |
Determines whether a given exception type could plausibly be carried within an EXC_CRASH
exception.
[in] | exception | The exception type to test. |
true
if an EXC_CRASH
exception could plausibly carry exception.An EXC_CRASH
exception can wrap exceptions that originate as hardware faults, as well as exceptions that originate from certain software sources such as POSIX signals. It cannot wrap another EXC_CRASH
exception, nor can it wrap EXC_RESOURCE
, EXC_GUARD
, or EXC_CORPSE_NOTIFY
exceptions. It also cannot wrap Crashpad-specific kMachExceptionSimulated exceptions.
exception_type_t crashpad::ExcCrashRecoverOriginalException | ( | mach_exception_code_t | code_0, |
mach_exception_code_t * | original_code_0, | ||
int * | signal | ||
) |
Recovers the original exception, first exception code, and signal from the encoded form of the first exception code delivered with EXC_CRASH
exceptions.
EXC_CRASH
exceptions are generated when the kernel has committed to terminating a process as a result of a core-generating POSIX signal and, for hardware exceptions, an earlier Mach exception. Information about this earlier exception and signal is made available to the EXC_CRASH
handler via its code[0]
parameter. This function recovers the original exception, the value of code[0]
from the original exception, and the value of the signal responsible for process termination.
[in] | code_0 | The first exception code (code[0] ) passed to a Mach exception handler in an EXC_CRASH exception. It is invalid to call this function with an exception code from any exception other than EXC_CRASH . |
[out] | original_code_0 | The first exception code (code[0] ) passed to the Mach exception handler for a hardware exception that resulted in the generation of a POSIX signal that caused process termination. If the signal that caused termination was not sent as a result of a hardware exception, this will be 0 . Callers that do not need this value may pass nullptr . |
[out] | signal | The POSIX signal that caused process termination. Callers that do not need this value may pass nullptr . |
0
. exception_behavior_t crashpad::ExceptionBehaviorBasic | ( | exception_behavior_t | behavior | ) |
Returns the basic behavior value of behavior, its value without MACH_EXCEPTION_CODES
set.
[in] | behavior | An exception behavior value. |
EXCEPTION_DEFAULT
, EXCEPTION_STATE
, or EXCEPTION_STATE_IDENTITY
, assuming behavior was a correct exception behavior value. bool crashpad::ExceptionBehaviorHasIdentity | ( | exception_behavior_t | behavior | ) |
Determines whether behavior indicates an exception behavior that carries thread and task identities.
When this function returns true
, an exception message of behavior will carry thread and task identities in the form of send rights to the thread and task ports. Its thread and task fields will be valid. When this function returns false
, these fields will not be valid.
Exception behaviors that carry thread and task identity information are EXCEPTION_DEFAULT
and EXCEPTION_STATE_IDENTITY
. MACH_EXCEPTION_CODES
may also be set. These behaviors correspond to exception_raise()
, exception_raise_state_identity()
, mach_exception_raise()
, and mach_exception_raise_state_identity()
.
[in] | behavior | An exception behavior value. |
true
if behavior is EXCEPTION_DEFAULT
or EXCEPTION_STATE_IDENTITY
, possibly with MACH_EXCEPTION_CODES
also set. bool crashpad::ExceptionBehaviorHasMachExceptionCodes | ( | exception_behavior_t | behavior | ) |
Determines whether behavior indicates an exception behavior that carries 64-bit exception codes (“Mach exception codes”).
When this function returns true
, an exception message of behavior will carry 64-bit exception codes of type mach_exception_code_t
in its code field. When this function returns false
, the exception message will carry 32-bit exception codes of type exception_data_type_t
in its code field.
Exception behaviors that carry 64-bit exception codes are those that have MACH_EXCEPTION_CODES
set. These behaviors correspond to mach_exception_raise()
, mach_exception_raise_state()
, and mach_exception_raise_state_identity()
.
[in] | behavior | An exception behavior value. |
true
if MACH_EXCEPTION_CODES
is set in behavior. bool crashpad::ExceptionBehaviorHasState | ( | exception_behavior_t | behavior | ) |
Determines whether behavior indicates an exception behavior that carries thread state information.
When this function returns true
, an exception message of behavior will carry thread state information. Its flavor, old_state, old_state_count, new_state, and new_state_count fields will be valid. When this function returns false
, these fields will not be valid.
Exception behaviors that carry thread state information are EXCEPTION_STATE
and EXCEPTION_STATE_IDENTITY
. MACH_EXCEPTION_CODES
may also be set. These behaviors correspond to exception_raise_state()
, exception_raise_state_identity()
, mach_exception_raise_state()
, and mach_exception_raise_state_identity()
.
[in] | behavior | An exception behavior value. |
true
if behavior is EXCEPTION_STATE
or EXCEPTION_STATE_IDENTITY
, possibly with MACH_EXCEPTION_CODES
also set. std::string crashpad::ExceptionBehaviorToString | ( | exception_behavior_t | behavior, |
SymbolicConstantToStringOptions | options | ||
) |
Converts a Mach exception behavior value to a textual representation.
[in] | behavior | The Mach exception behavior value to convert. |
[in] | options | Options affecting the conversion. kUseOr is ignored. MACH_EXCEPTION_CODES can always be ORed in, but no other values can be ORed with each other. For kUnknownIsNumeric, the format is "%#x" . |
int32_t crashpad::ExceptionCodeForMetrics | ( | exception_type_t | exception, |
mach_exception_code_t | code_0 | ||
) |
Returns the exception code to report via a configured metrics system.
[in] | exception | The exception type as received by a Mach exception handler. |
[in] | code_0 | The first exception code (code[0] ) as received by a Mach exception handler. |
For classic Mach exceptions (including hardware faults reported as Mach exceptions), the mapping is (exception << 16) | code_0
.
For EXC_CRASH
exceptions that originate as Mach exceptions described above, the mapping above is used, with the original exception’s values. For EXC_CRASH
exceptions that originate as POSIX signals without an underlying Mach exception, the mapping is (EXC_CRASH << 16) | code_0
.
EXC_RESOURCE
and EXC_GUARD
exceptions both contain exception-specific “type” values and type-specific “flavor” values. In these cases, the mapping is (exception << 16) | (type << 8) | flavor
. For EXC_GUARD
, the “flavor” value is rewritten to be more space-efficient by replacing the kernel-supplied bitmask having exactly one bit set with the index of the set bit.
EXC_CORPSE_NOTIFY
exceptions are reported as classic Mach exceptions with the code_0 field set to 0
.
If exception is kMachExceptionSimulated, that value is returned as-is.
Overflow conditions in any field are handled via saturation.
std::string crashpad::ExceptionMaskToString | ( | exception_mask_t | exception_mask, |
SymbolicConstantToStringOptions | options | ||
) |
Converts a Mach exception mask value to a textual representation.
[in] | exception_mask | The Mach exception mask value to convert. |
[in] | options | Options affecting the conversion. kUseOr is honored. For kUnknownIsNumeric, the format is "%#x" . |
std::string crashpad::ExceptionToString | ( | exception_type_t | exception, |
SymbolicConstantToStringOptions | options | ||
) |
Converts a Mach exception value to a textual representation.
[in] | exception | The Mach exception value to convert. |
[in] | options | Options affecting the conversion. kUseOr is ignored. For kUnknownIsNumeric, the format is "%d" . |
exception_mask_t crashpad::ExcMaskAll | ( | ) |
The value for EXC_MASK_ALL
appropriate for the operating system at run time.
The SDK’s definition of EXC_MASK_ALL
has changed over time, with later versions containing more bits set than earlier versions. However, older kernels will reject exception masks that contain bits set that they don’t recognize. Calling this function will return a value for EXC_MASK_ALL
appropriate for the system at run time.
EXC_MASK_ALL
does not include the value of EXC_MASK_CRASH
or EXC_MASK_CORPSE_NOTIFY
. Consumers that want EXC_MASK_ALL
along with EXC_MASK_CRASH
may use ExcMaskAll() | EXC_MASK_CRASH
. Consumers may use ExcMaskValid() for EXC_MASK_ALL
along with EXC_MASK_CRASH
, EXC_MASK_CORPSE_NOTIFY
, and any values that come into existence in the future. exception_mask_t crashpad::ExcMaskValid | ( | ) |
An exception mask containing every possible exception understood by the operating system at run time.
EXC_MASK_ALL
, and thus ExcMaskAll(), never includes the value of EXC_MASK_CRASH
or EXC_MASK_CORPSE_NOTIFY
. For situations where an exception mask corresponding to every possible exception understood by the running kernel is desired, use this function instead.
Should new exception types be introduced in the future, this function will be updated to include their bits in the returned mask value when run time support is present.
void crashpad::ExcServerCopyState | ( | exception_behavior_t | behavior, |
ConstThreadState | old_state, | ||
mach_msg_type_number_t | old_state_count, | ||
thread_state_t | new_state, | ||
mach_msg_type_number_t * | new_state_count | ||
) |
Copies the old state to the new state for state-carrying exceptions.
When the kernel sends a state-carrying exception request and the response is successful (MACH_MSG_SUCCESS
, a synonym for KERN_SUCCESS
), it will set a new thread state based on new_state and new_state_count. To ease initialization of the new state, this function copies old_state and old_state_count. This is only done if behavior indicates a state-carrying exception.
[in] | behavior | The behavior of the exception handler as invoked. This may be taken directly from the behavior parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. |
[in] | old_state | The original state value. This may be taken directly from the old_state parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. |
[in] | old_state_count | The number of significant natural_t words in old_state. This may be taken directly from the old_state_count parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. |
[out] | new_state | The state value to be set. This may be taken directly from the new_state parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. This parameter is untouched if behavior is not state-carrying. |
[in,out] | new_state_count | On entry, the number of natural_t words available to be written to in new_state. On return, the number of significant natural_t words in new_state. This may be taken directly from the new_state_count parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. This parameter is untouched if behavior is not state-carrying. If behavior is state-carrying, this parameter should be at least as large as old_state_count. |
kern_return_t crashpad::ExcServerSuccessfulReturnValue | ( | exception_type_t | exception, |
exception_behavior_t | behavior, | ||
bool | set_thread_state | ||
) |
Computes an approriate successful return value for an exception handler function.
For exception handlers that respond to state-carrying behaviors, when the handler is called by the kernel (as it is normally), the kernel will attempt to set a new thread state when the exception handler returns successfully. Other code that mimics the kernel’s exception-delivery semantics may implement the same or similar behavior. In some situations, it is undesirable to set a new thread state. If the exception handler were to return unsuccessfully, however, the kernel would continue searching for an exception handler at a wider (task or host) scope. This may also be undesirable.
If such exception handlers return MACH_RCV_PORT_DIED
, the kernel will not set a new thread state and will also not search for another exception handler. See 10.9.4 xnu-2422.110.17/osfmk/kern/exception.c
. exception_deliver()
will only set a new thread state if the handler’s return code was MACH_MSG_SUCCESS
(a synonym for KERN_SUCCESS
), and subsequently, exception_triage()
will not search for a new handler if the handler’s return code was KERN_SUCCESS
or MACH_RCV_PORT_DIED
.
This function allows exception handlers to compute an appropriate return code to influence their caller (the kernel) in the desired way with respect to setting a new thread state while suppressing the caller’s subsequent search for other exception handlers. An exception handler should return the value returned by this function.
This function is useful even for EXC_CRASH
handlers, where returning KERN_SUCCESS
and allowing the kernel to set a new thread state has been observed to cause a perceptible and unnecessary waste of time. The victim task in an EXC_CRASH
handler is already being terminated and is no longer schedulable, so there is no point in setting the states of any of its threads.
On OS X 10.11, the MACH_RCV_PORT_DIED
mechanism cannot be used with an EXC_CRASH
handler without triggering an undesirable EXC_CORPSE_NOTIFY
exception. In that case, KERN_SUCCESS
is always returned. Because this function may return KERN_SUCCESS
for a state-carrying exception, it is important to ensure that the state returned by a state-carrying exception handler is valid, because it will be passed to thread_set_status()
. ExcServerCopyState() may be used to achieve this.
[in] | exception | The exception type passed to the exception handler. This may be taken directly from the exception parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. |
[in] | behavior | The behavior of the exception handler as invoked. This may be taken directly from the behavior parameter of internal::SimplifiedExcServer::Interface::CatchException(), for example. |
[in] | set_thread_state | true if the handler would like its caller to set the new thread state using the flavor, new_state, and new_state_count out parameters. This can only happen when behavior is a state-carrying behavior. |
KERN_SUCCESS
or MACH_RCV_PORT_DIED
. KERN_SUCCESS
is used when behavior is not a state-carrying behavior, or when it is a state-carrying behavior and set_thread_state is true
, or for EXC_CRASH
exceptions on OS X 10.11 and later. Otherwise, MACH_RCV_PORT_DIED
is used. bool crashpad::GetModuleVersionAndType | ( | const base::FilePath & | path, |
VS_FIXEDFILEINFO * | vs_fixedfileinfo | ||
) |
Retrieve the type and version information from a given module (exe, dll, etc.)
This function calls GetFileVersionInfo()
, which can implicitly call LoadLibrary()
to load path into the calling process. Do not call this function on an untrusted module, because there is a risk of executing the module’s code.
[in] | path | The path to the module to be inspected. |
[out] | vs_fixedfileinfo | The VS_FIXEDFILEINFO on success. VS_FIXEDFILEINFO::dwFileFlags will have been masked with VS_FIXEDFILEINFO::dwFileFlagsMask already. |
true
on success, or false
on failure with a message logged. If the module has no VERSIONINFO
resource, false
will be returned without any messages logged. std::vector< CheckedRange< WinVMAddress, WinVMSize > > crashpad::GetReadableRangesOfMemoryMap | ( | const CheckedRange< WinVMAddress, WinVMSize > & | range, |
const ProcessInfo::MemoryBasicInformation64Vector & | memory_info | ||
) |
Given a memory map of a process, and a range to be read from the target process, returns a vector of ranges, representing the readable portions of the original range.
This is a free function for testing, but prefer ProcessInfo::GetReadableRanges().
const void * crashpad::GetSecurityDescriptorForNamedPipeInstance | ( | size_t * | size | ) |
Returns the SECURITY_DESCRIPTOR blob that will be used for creating the connection pipe in CreateNamedPipeInstance().
This function is exposed for only for testing.
[out] | size | The size of the returned blob. May be nullptr if not required. |
SECURITY_DESCRIPTOR
. Ownership is not transferred to the caller. int crashpad::HandlerMain | ( | int | argc, |
char * | argv[] | ||
) |
The main()
of the crashpad_handler
binary.
This is exposed so that crashpad_handler
can be embedded into another binary, but called and used as if it were a standalone executable.
int crashpad::HandleToInt | ( | HANDLE | handle | ) |
Converts a HANDLE
to an int
.
HANDLE
is a typedef
for void *
, but kernel HANDLE
values aren’t pointers to anything. Only 32 bits of kernel HANDLE
s are significant, even in 64-bit processes on 64-bit operating systems. See Interprocess Communication Between 32-bit and 64-bit Applications.
This function safely converts a kernel HANDLE
to an int
similarly to a cast operation. It checks that the operation can be performed safely, and aborts execution if it cannot.
[in] | handle | The kernel HANDLE to convert. |
int
, truncated (if necessary) from handle. If truncation would have resulted in an int
that could not be converted back to handle, aborts execution.bool crashpad::InitializeCriticalSectionWithDebugInfoIfPossible | ( | CRITICAL_SECTION * | critical_section | ) |
Equivalent to InitializeCritialSection()
, but attempts to allocate with a valid .DebugInfo
field on versions of Windows where it's possible to do so.
true
on success, or false
on failure with a message logged. Success means that the critical section was successfully initialized, but it does not necessarily have a valid .DebugInfo
field. Destination crashpad::InRangeCast | ( | Source | source, |
Destination | default_value | ||
) |
Casts to a different type if it can be done without data loss, logging a warning message and returing a default value otherwise.
[in] | source | The value to convert and return. |
[in] | default_value | The default value to return, in the event that source cannot be represented in the destination type. |
HANDLE crashpad::IntToHandle | ( | int | handle_int | ) |
Converts an int
to an HANDLE
.
HANDLE
is a typedef
for void *
, but kernel HANDLE
values aren’t pointers to anything. Only 32 bits of kernel HANDLE
s are significant, even in 64-bit processes on 64-bit operating systems. See Interprocess Communication Between 32-bit and 64-bit Applications.
This function safely convert an int
to a kernel HANDLE
similarly to a cast operation.
[in] | handle_int | The int to convert. This must have been produced by HandleToInt(), possibly in a different process. |
HANDLE
, sign-extended (if necessary) from handle_int.bool crashpad::IsExceptionNonfatalResource | ( | exception_type_t | exception, |
mach_exception_code_t | code_0, | ||
pid_t | pid | ||
) |
Determines whether an exception is a non-fatal EXC_RESOURCE
.
[in] | exception | The exception type as received by a Mach exception handler. |
[in] | code_0 | The first exception code (code[0] ) as received by a Mach exception handler. |
[in] | pid | The process ID that the exception occurred in. In some cases, process may need to be queried to determine whether an EXC_RESOURCE exception is fatal. |
true
if the exception is a non-fatal EXC_RESOURCE
. false
otherwise. If the exception is EXC_RESOURCE
of a recognized type but it is not possible to determine whether it is fatal, returns true
under the assumption that all known EXC_RESOURCE
exceptions are non-fatal by default. If the exception is not EXC_RESOURCE
or is an unknown EXC_RESOURCE
type, returns false
.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
|
inline |
Wraps the <launch.h>
function of the same name.
The OS X 10.10 SDK deprecates <launch.h>
, although the functionality it provides is still useful. These wrappers allow the deprecated functions to be called without triggering deprecated-declaration warnings.
bool crashpad::LoggingCloseFile | ( | FileHandle | file | ) |
Wraps close()
or CloseHandle()
, logging an error if the operation fails.
true
is returned. On failure, an error is logged and false
is returned. FileOffset crashpad::LoggingFileSizeByHandle | ( | FileHandle | file | ) |
Determines the size of a file.
[in] | file | The handle to the file for which the size should be retrived. |
-1
with an error logged. bool crashpad::LoggingLockFile | ( | FileHandle | file, |
FileLocking | locking | ||
) |
Locks the given file using flock()
on POSIX or LockFileEx()
on Windows.
It is an error to attempt to lock a file in a different mode when it is already locked. This call will block until the lock is acquired. The entire file is locked.
If locking is FileLocking::kShared, file must have been opened for reading, and if it's FileLocking::kExclusive, file must have been opened for writing.
[in] | file | The open file handle to be locked. |
[in] | locking | Controls whether the lock is a shared reader lock, or an exclusive writer lock. |
true
on success, or false
and a message will be logged. FileHandle crashpad::LoggingOpenFileForRead | ( | const base::FilePath & | path | ) |
Wraps OpenFileForRead(), logging an error if the operation fails.
FileHandle crashpad::LoggingOpenFileForReadAndWrite | ( | const base::FilePath & | path, |
FileWriteMode | mode, | ||
FilePermissions | permissions | ||
) |
Wraps OpenFileForReadAndWrite(), logging an error if the operation fails.
FileHandle crashpad::LoggingOpenFileForWrite | ( | const base::FilePath & | path, |
FileWriteMode | mode, | ||
FilePermissions | permissions | ||
) |
Wraps OpenFileForWrite(), logging an error if the operation fails.
bool crashpad::LoggingReadFile | ( | FileHandle | file, |
void * | buffer, | ||
size_t | size | ||
) |
Wraps ReadFile(), ensuring that exactly size bytes are read.
true
on success. If size is out of the range of possible ReadFile() return values, if the underlying ReadFile() fails, or if other than size bytes were read, this function logs a message and returns false
.FileOffset crashpad::LoggingSeekFile | ( | FileHandle | file, |
FileOffset | offset, | ||
int | whence | ||
) |
Wraps lseek()
or SetFilePointerEx()
. Logs an error if the operation fails.
Repositions the offset of the open file to the specified offset, relative to whence. whence must be one of SEEK_SET
, SEEK_CUR
, or SEEK_END
, and is interpreted in the usual way.
-1
on failure. bool crashpad::LoggingTruncateFile | ( | FileHandle | file | ) |
Truncates the given file to zero bytes in length.
true
on success, or false
, and a message will be logged. bool crashpad::LoggingUnlockFile | ( | FileHandle | file | ) |
Unlocks a file previously locked with LoggingLockFile().
It is an error to attempt to unlock a file that was not previously locked. A previously-locked file should be unlocked before closing the file handle, otherwise on some OSs the lock may not be released immediately.
[in] | file | The open locked file handle to be unlocked. |
true
on success, or false
and a message will be logged. bool crashpad::LoggingWriteFile | ( | FileHandle | file, |
const void * | buffer, | ||
size_t | size | ||
) |
Wraps WriteFile(), ensuring that exactly size bytes are written.
true
on success. If size is out of the range of possible WriteFile() return values, if the underlying WriteFile() fails, or if other than size bytes were written, this function logs a message and returns false
.MachMessageDeadline crashpad::MachMessageDeadlineFromTimeout | ( | mach_msg_timeout_t | timeout_ms | ) |
Computes the deadline for a specified timeout value.
While deadlines exist on an absolute time scale, timeouts are relative. This function calculates the deadline as timeout_ms milliseconds after it executes.
If timeout_ms is kMachMessageDeadlineNonblocking, this function will return kMachMessageDeadlineNonblocking. If timeout_ms is kMachMessageTimeoutWaitIndefinitely, this function will return kMachMessageDeadlineWaitIndefinitely.
bool crashpad::MachMessageDestroyReceivedPort | ( | mach_port_t | port, |
mach_msg_type_name_t | port_right_type | ||
) |
Destroys or deallocates a Mach port received in a Mach message.
This function disposes of port rights received in a Mach message. Receive rights will be destroyed with mach_port_mod_refs()
. Send and send-once rights will be deallocated with mach_port_deallocate()
.
[in] | port | The port to destroy or deallocate. |
[in] | port_right_type | The right type held for port: MACH_MSG_TYPE_PORT_RECEIVE , MACH_MSG_TYPE_PORT_SEND , or MACH_MSG_TYPE_PORT_SEND_ONCE . |
true
on success, or false
on failure with a message logged. const mach_msg_trailer_t * crashpad::MachMessageTrailerFromHeader | ( | const mach_msg_header_t * | header | ) |
Returns a Mach message trailer for a message that has been received.
This function must only be called on Mach messages that have been received via the Mach messaging interface, such as mach_msg()
. Messages constructed for sending do not contain trailers.
[in] | header | A pointer to a received Mach message. |
mach_msg()
or a similar function when the message was received. mach_msg_return_t crashpad::MachMessageWithDeadline | ( | mach_msg_header_t * | message, |
mach_msg_option_t | options, | ||
mach_msg_size_t | receive_size, | ||
mach_port_name_t | receive_port, | ||
MachMessageDeadline | deadline, | ||
mach_port_name_t | notify_port, | ||
bool | run_even_if_expired | ||
) |
Runs mach_msg()
with a deadline, as opposed to a timeout.
This function is similar to mach_msg()
, with the following differences:
timeout
parameter has been replaced by deadline. The deadline applies uniformly to a call that is requested to both send and receive a message.MACH_SEND_TIMEOUT
and MACH_RCV_TIMEOUT
bits in options are not used. Timeouts are specified by the deadline argument.send_size
parameter has been removed. Its value is implied by message when options contains MACH_SEND_MSG
.Like the mach_msg()
wrapper in libsyscall
, this function will retry operations when experiencing MACH_SEND_INTERRUPTED
and MACH_RCV_INTERRUPTED
, unless options contains MACH_SEND_INTERRUPT
or MACH_RCV_INTERRUPT
. Unlike mach_msg()
, which restarts the call with the full timeout when this occurs, this function continues enforcing the user-specified deadline.
Except as noted, the parameters and return value are identical to those of mach_msg()
.
[in,out] | message | |
[in] | options | |
[in] | receive_size | |
[in] | receive_port | |
[in] | deadline | The time by which this call should complete. If the deadline is exceeded, this call will return MACH_SEND_TIMED_OUT or MACH_RCV_TIMED_OUT . |
[in] | notify_port | |
[in] | run_even_if_expired | If true , a deadline that is expired when this function is called will be treated as though a deadline of kMachMessageDeadlineNonblocking had been specified. When false , an expired deadline will result in a MACH_SEND_TIMED_OUT or MACH_RCV_TIMED_OUT return value, even if the deadline is already expired when the function is called. |
mach_msg()
thread_t crashpad::MachThreadSelf | ( | ) |
Like mach_thread_self()
, but without the obligation to release the send right.
mach_thread_self()
returns a send right to the current thread port, incrementing its reference count. This burdens the caller with maintaining this send right, and calling mach_port_deallocate()
when it is no longer needed. This is burdensome, and is at odds with the normal operation of mach_task_self()
, which does not increment the task port’s reference count whose result must not be deallocated.
Callers can use this function in preference to mach_thread_self()
. This function returns an extant reference to the current thread’s port without incrementing its reference count.
mach_thread_self()
without incrementing its reference count. The returned port must not be deallocated by mach_port_deallocate()
. The returned value is valid as long as the thread continues to exist as a pthread_t
. void crashpad::MacModelAndBoard | ( | std::string * | model, |
std::string * | board_id | ||
) |
Returns the model name and board ID of the running system.
[out] | model | The system’s model name. A mid-2012 15" MacBook Pro would report “MacBookPro10,1”. |
[out] | board_id | The system’s board ID. A mid-2012 15" MacBook Pro would report “Mac-C3EC7CD22292981F”. |
If a value cannot be determined, its string is cleared.
int crashpad::MacOSXMinorVersion | ( | ) |
Returns the version of the running operating system.
12
for macOS 10.12.1.bool crashpad::MacOSXVersion | ( | int * | major, |
int * | minor, | ||
int * | bugfix, | ||
std::string * | build, | ||
bool * | server, | ||
std::string * | version_string | ||
) |
Returns the version of the running operating system.
All parameters are required. No parameter may be nullptr
.
[out] | major | The major version of the operating system, such as 10 for macOS 10.12.1. |
[out] | minor | The major version of the operating system, such as 12 for macOS 10.12.1. |
[out] | bugfix | The bugfix version of the operating system, such as 1 for macOS 10.12.1. |
[out] | build | The operating system’s build string, such as "16B2657" for macOS 10.12.1. |
[out] | server | true for a macOS Server installation, false otherwise (for a desktop/laptop, client, or workstation system). |
[out] | version_string | A string representing the full operating system version, such as "macOS 10.12.1 (16B2657)" . |
true
on success, false
on failure, with an error message logged. A failure is considered to have occurred if any element could not be determined. When this happens, their values will be untouched, but other values that could be determined will still be set properly. bool crashpad::MapInsertOrReplace | ( | T * | map, |
const typename T::key_type & | key, | ||
const typename T::mapped_type & | value, | ||
typename T::mapped_type * | old_value | ||
) |
Inserts a mapping from key to value into map, or replaces an existing mapping so that key maps to value.
This behaves similarly to std::map<>::insert_or_assign()
proposed for C++17, except that the old_value parameter is added.
[in,out] | map | The map to operate on. |
[in] | key | The key that should be mapped to value. |
[in] | value | The value that key should map to. |
[out] | old_value | If key was previously present in map, this will be set to its previous value. This parameter is optional and may be nullptr if this information is not required. |
false
if key was previously present in map. If old_value is not nullptr
, it will be set to the previous value. true
if key was not present in the map and was inserted. mach_port_t crashpad::NewMachPort | ( | mach_port_right_t | right | ) |
Creates a new Mach port in the current task.
This function wraps the mach_port_allocate()
providing a simpler interface.
[in] | right | The type of right to create. |
MACH_PORT_NULL
with a message logged. FileHandle crashpad::OpenFileForRead | ( | const base::FilePath & | path | ) |
Wraps open()
or CreateFile()
, opening an existing file for reading.
FileHandle crashpad::OpenFileForReadAndWrite | ( | const base::FilePath & | path, |
FileWriteMode | mode, | ||
FilePermissions | permissions | ||
) |
Wraps open()
or CreateFile()
, creating a file for both input and output.
mode determines the style (truncate, reuse, etc.) that is used to open the file. On POSIX, permissions 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.
FileHandle crashpad::OpenFileForWrite | ( | const base::FilePath & | path, |
FileWriteMode | mode, | ||
FilePermissions | permissions | ||
) |
Wraps open()
or CreateFile()
, creating a file for output.
mode determines the style (truncate, reuse, etc.) that is used to open the file. On POSIX, permissions 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.
void crashpad::PrepareMIGReplyFromRequest | ( | const mach_msg_header_t * | in_header, |
mach_msg_header_t * | out_header | ||
) |
Initializes a reply message for a MIG server routine based on its corresponding request.
If a request is handled by a server routine, it may be necessary to revise some of the fields set by this function, such as msgh_size
and any fields defined in a routine’s reply structure type.
[in] | in_header | The request message to base the reply on. |
[out] | out_header | The reply message to initialize. out_header will be treated as a mig_reply_error_t* and all of its fields will be set except for RetCode , which must be set by SetMIGReplyError(). This argument is accepted as a mach_msg_header_t* instead of a mig_reply_error_t* because that is the type that callers are expected to possess in the C API. |
void crashpad::PruneCrashReportDatabase | ( | CrashReportDatabase * | database, |
PruneCondition * | condition | ||
) |
Deletes crash reports from database that match condition.
This function can be used to remove old or large reports from the database. The condition will be evaluated against each report in the database, sorted in descending order by CrashReportDatabase::Report::creation_time. This guarantee allows conditions to be stateful.
[in] | database | The database from which crash reports will be deleted. |
[in] | condition | The condition against which all reports in the database will be evaluated. |
std::string crashpad::RandomString | ( | ) |
Returns a random string.
The string consists of 16 uppercase characters chosen at random. The returned string has over 75 bits of randomness (2616 > 275).
FileOperationResult crashpad::ReadFile | ( | FileHandle | file, |
void * | buffer, | ||
size_t | size | ||
) |
Reads from a file, retrying when interrupted on POSIX or following a short read.
This function reads into buffer, stopping only when size bytes have been read or when end-of-file has been reached. On Windows, reading from sockets is not currently supported.
-1
on error, with errno
or GetLastError()
set appropriately. On error, a portion of file may have been read into buffer.bool crashpad::ReadModuleAnnotations | ( | HANDLE | process, |
HMODULE | module, | ||
std::map< std::string, std::string > * | annotations | ||
) |
Reads the module annotations from another process.
[in] | process | The handle to the process that hosts the module. Requires PROCESS_QUERY_INFORMATION and PROCESS_VM_READ accesses. |
[in] | module | The handle to the module from which the annotations will be read. This module should be loaded in the target process. |
[out] | annotations | The map that will be filled with the annotations. Remains unchanged if the function returns 'false'. |
true
if the annotations could be read succesfully, even if the module doesn't contain any annotations. XattrStatus crashpad::ReadXattr | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
std::string * | value | ||
) |
Reads an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to read. |
[out] | value | The value of the attribute. |
XattrStatus crashpad::ReadXattrBool | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
bool * | value | ||
) |
Reads an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to read. |
[out] | value | The value of the attribute. |
Only the values "0"
and "1"
, for false
and true
respectively, are valid conversions.
XattrStatus crashpad::ReadXattrInt | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
int * | value | ||
) |
Reads an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to read. |
[out] | value | The value of the attribute. |
XattrStatus crashpad::ReadXattrTimeT | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
time_t * | value | ||
) |
Reads an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to read. |
[out] | value | The value of the attribute. |
XattrStatus crashpad::RemoveXattr | ( | const base::FilePath & | file, |
const base::StringPiece & | name | ||
) |
Removes an extended attribute from a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to remove. |
bool crashpad::SendToCrashHandlerServer | ( | const base::string16 & | pipe_name, |
const ClientToServerMessage & | message, | ||
ServerToClientMessage * | response | ||
) |
Connect over the given pipe_name, passing message to the server, storing the server's reply into response.
Typically clients will not use this directly, instead using CrashpadClient::SetHandler().
bool crashpad::ServiceManagementIsJobLoaded | ( | const std::string & | label | ) |
Determines whether a specified job is loaded in the user launchd domain.
[in] | label | The label for the job to look up. |
true
if the job is loaded, otherwise false
.SMJobCopyDictionary()
is deprecated in OS X 10.10. It may or may not be implemented using SMJobCopyDictionary()
from ServiceManagement.framework
. pid_t crashpad::ServiceManagementIsJobRunning | ( | const std::string & | label | ) |
Determines whether a specified job is running in the user launchd domain.
[in] | label | The label for the job to look up. |
0
.SMJobCopyDictionary()
is deprecated in OS X 10.10. It may or may not be implemented using SMJobCopyDictionary()
from ServiceManagement.framework
. bool crashpad::ServiceManagementRemoveJob | ( | const std::string & | label, |
bool | wait | ||
) |
Removes a job from the user launchd domain as in SMJobRemove()
.
[in] | label | The label for the job to remove. |
[in] | wait | true if this function should block, waiting for the job to be removed. false if the job may be removed asynchronously. |
true
if the job was removed successfully or if an asynchronous attempt to remove the job was started successfully, otherwise false
.SMJobRemove()
is deprecated in OS X 10.10. On OS X 10.10, observed in DP8 14A361c, it also blocks for far too long (_block_until_job_exits()
contains a one-second sleep()
, filed as radar 18398683) and does not signal failure via its return value when asked to remove a nonexistent job (filed as radar 18268941). bool crashpad::ServiceManagementSubmitJob | ( | CFDictionaryRef | job_cf | ) |
Submits a job to the user launchd domain as in SMJobSubmit()
.
[in] | job_cf | A dictionary describing a job. |
true
if the job was submitted successfully, otherwise false
.SMJobSubmit()
is deprecated in OS X 10.10. It may or may not be implemented using SMJobSubmit()
from ServiceManagement.framework
. void crashpad::SetMIGReplyError | ( | mach_msg_header_t * | out_header, |
kern_return_t | error | ||
) |
Sets the error code in a reply message for a MIG server routine.
[in,out] | out_header | The reply message to operate on. out_header will be treated as a mig_reply_error_t* and its RetCode field will be set. This argument is accepted as a mach_msg_header_t* instead of a mig_reply_error_t* because that is the type that callers are expected to possess in the C API. |
[in] | error | The error code to store in out_header. |
std::string crashpad::SignalToString | ( | int | signal, |
SymbolicConstantToStringOptions | options | ||
) |
Converts a POSIX signal value to a textual representation.
[in] | signal | The signal value to convert. |
[in] | options | Options affecting the conversion. kUseOr is ignored. For kUnknownIsNumeric, the format is "%d" . |
void crashpad::SimulateCrash | ( | const NativeCPUContext & | cpu_context | ) |
Simulates a exception without crashing.
This function searches for an EXC_CRASH
handler in the same manner that the kernel does, and sends it an exception message to that handler in the format that the handler expects, considering the behavior and thread state flavor that are registered for it. The exception sent to the handler will be kMachExceptionSimulated, not EXC_CRASH
.
Typically, the CRASHPAD_SIMULATE_CRASH() macro will be used in preference to this function, because it combines the context-capture operation with the raising of a simulated exception.
This function returns normally after the exception message is processed. If no valid handler was found, or no handler processed the exception successfully, a warning will be logged, but these conditions are not considered fatal.
[in] | cpu_context | The thread state to pass to the exception handler as the exception context, provided that it is compatible with the thread state flavor that the exception handler accepts. If it is not compatible, the correct thread state for the handler will be obtained by calling thread_get_state() . |
void crashpad::SleepNanoseconds | ( | uint64_t | nanoseconds | ) |
Sleeps for the specified duration.
[in] | nanoseconds | The number of nanoseconds to sleep. The actual sleep may be slightly longer due to latencies and timer resolution. |
This function is resilient against the underlying nanosleep()
system call being interrupted by a signal.
std::vector< std::string > crashpad::SplitString | ( | const std::string & | string, |
char | delimiter | ||
) |
Splits a string into multiple parts on the given delimiter.
[in] | string | The string to split. |
[in] | delimiter | The delimiter to split at. |
bool crashpad::SplitStringFirst | ( | const std::string & | string, |
char | delimiter, | ||
std::string * | left, | ||
std::string * | right | ||
) |
Splits a string into two parts at the first delimiter found.
[in] | string | The string to split. |
[in] | delimiter | The delimiter to split at. |
[out] | left | The portion of string up to, but not including, the first delimiter character. |
[out] | right | The portion of string after the first delimiter character. |
true
if string was split successfully. false
if string did not contain a delimiter character or began with a delimiter character. bool crashpad::StringToException | ( | const base::StringPiece & | string, |
StringToSymbolicConstantOptions | options, | ||
exception_type_t * | exception | ||
) |
Converts a string to its corresponding Mach exception value.
[in] | string | The string to convert. |
[in] | options | Options affecting the conversion. kAllowOr is ignored. |
[out] | exception | The converted Mach exception value. |
true
on success, false
if string could not be converted as requested. bool crashpad::StringToExceptionBehavior | ( | const base::StringPiece & | string, |
StringToSymbolicConstantOptions | options, | ||
exception_behavior_t * | behavior | ||
) |
Converts a string to its corresponding Mach exception behavior value.
[in] | string | The string to convert. |
[in] | options | Options affecting the conversion. kAllowOr is ignored. MACH_EXCEPTION_CODES can always be ORed in, but no other values can be ORed with each other. |
[out] | behavior | The converted Mach exception behavior value. |
true
on success, false
if string could not be converted as requested. bool crashpad::StringToExceptionMask | ( | const base::StringPiece & | string, |
StringToSymbolicConstantOptions | options, | ||
exception_mask_t * | exception_mask | ||
) |
Converts a string to its corresponding Mach exception mask value.
[in] | string | The string to convert. |
[in] | options | Options affecting the conversion. kAllowOr is honored. |
[out] | exception_mask | The converted Mach exception mask value. |
true
on success, false
if string could not be converted as requested. bool crashpad::StringToNumber | ( | const base::StringPiece & | string, |
int * | number | ||
) |
Convert a string to a number.
A conversion will only be performed if it can be done perfectly: if string contains no leading or trailing characters (including whitespace) other than the number to convert, and does not overflow the targeted data type.
[in] | string | The string to convert to a number. As in strtol() with a base parameter of 0 , the string is treated as decimal unless it begins with a "0x" or "0X" prefix, in which case it is treated as hexadecimal, or a "0" prefix, in which case it is treated as octal. |
[out] | number | The converted number. This will only be set if a perfect conversion can be performed. |
true
if a perfect conversion could be performed, with number set appropriately. false
if a perfect conversion was not possible.base/strings/string_number_conversions.h
doesn’t allow arbitrary bases based on whether the string begins with a prefix indicating its base. The functions here are provided for situations where such prefix recognition is desirable. bool crashpad::StringToNumber | ( | const base::StringPiece & | string, |
unsigned int * | number | ||
) |
Convert a string to a number.
A conversion will only be performed if it can be done perfectly: if string contains no leading or trailing characters (including whitespace) other than the number to convert, and does not overflow the targeted data type.
[in] | string | The string to convert to a number. As in strtol() with a base parameter of 0 , the string is treated as decimal unless it begins with a "0x" or "0X" prefix, in which case it is treated as hexadecimal, or a "0" prefix, in which case it is treated as octal. |
[out] | number | The converted number. This will only be set if a perfect conversion can be performed. |
true
if a perfect conversion could be performed, with number set appropriately. false
if a perfect conversion was not possible.base/strings/string_number_conversions.h
doesn’t allow arbitrary bases based on whether the string begins with a prefix indicating its base. The functions here are provided for situations where such prefix recognition is desirable. bool crashpad::StringToNumber | ( | const base::StringPiece & | string, |
int64_t * | number | ||
) |
Convert a string to a number.
A conversion will only be performed if it can be done perfectly: if string contains no leading or trailing characters (including whitespace) other than the number to convert, and does not overflow the targeted data type.
[in] | string | The string to convert to a number. As in strtol() with a base parameter of 0 , the string is treated as decimal unless it begins with a "0x" or "0X" prefix, in which case it is treated as hexadecimal, or a "0" prefix, in which case it is treated as octal. |
[out] | number | The converted number. This will only be set if a perfect conversion can be performed. |
true
if a perfect conversion could be performed, with number set appropriately. false
if a perfect conversion was not possible.base/strings/string_number_conversions.h
doesn’t allow arbitrary bases based on whether the string begins with a prefix indicating its base. The functions here are provided for situations where such prefix recognition is desirable. bool crashpad::StringToNumber | ( | const base::StringPiece & | string, |
uint64_t * | number | ||
) |
Convert a string to a number.
A conversion will only be performed if it can be done perfectly: if string contains no leading or trailing characters (including whitespace) other than the number to convert, and does not overflow the targeted data type.
[in] | string | The string to convert to a number. As in strtol() with a base parameter of 0 , the string is treated as decimal unless it begins with a "0x" or "0X" prefix, in which case it is treated as hexadecimal, or a "0" prefix, in which case it is treated as octal. |
[out] | number | The converted number. This will only be set if a perfect conversion can be performed. |
true
if a perfect conversion could be performed, with number set appropriately. false
if a perfect conversion was not possible.base/strings/string_number_conversions.h
doesn’t allow arbitrary bases based on whether the string begins with a prefix indicating its base. The functions here are provided for situations where such prefix recognition is desirable. bool crashpad::StringToSignal | ( | const base::StringPiece & | string, |
StringToSymbolicConstantOptions | options, | ||
int * | signal | ||
) |
Converts a string to its corresponding POSIX signal value.
[in] | string | The string to convert. |
[in] | options | Options affecting the conversion. kAllowOr is ignored. |
[out] | signal | The converted POSIX signal value. |
true
on success, false
if string could not be converted as requested. bool crashpad::StringToThreadStateFlavor | ( | const base::StringPiece & | string, |
StringToSymbolicConstantOptions | options, | ||
thread_state_flavor_t * | flavor | ||
) |
Converts a string to its corresponding thread state flavor value.
[in] | string | The string to convert. |
[in] | options | Options affecting the conversion. kAllowOr is ignored. |
[out] | flavor | The converted thread state flavor value. |
true
on success, false
if string could not be converted as requested.
|
inline |
Returns the length of a string, not to exceed a maximum.
[in] | string | The string whose length is to be calculated. |
[in] | max_length | The maximum length to return. |
NUL
byte found, not exceeding max_length.base::mac::ScopedMachSendRight crashpad::SystemCrashReporterHandler | ( | ) |
Obtains the system’s default Mach exception handler for crash-type exceptions.
This is obtained by looking up "com.apple.ReportCrash"
with the bootstrap server. The service name comes from the first launch agent loaded by launchd
with a MachServices
entry having ExceptionServer
set. This launch agent is normally loaded from /System/Library/LaunchAgents/com.apple.ReportCrash.plist
.
exception_handler_t
corresponding to the system’s default crash reporter. On failure, MACH_PORT_NULL
, with a message logged. task_t crashpad::TaskForPID | ( | pid_t | pid | ) |
Wraps task_for_pid()
.
This function exists to support task_for_pid()
access checks in a setuid environment. Normally, task_for_pid()
can only return an arbitrary task’s port when running as root or when taskgated(8) approves. When not running as root, a series of access checks are perfomed to ensure that the running process has permission to obtain the other process’ task port.
It is possible to make an executable setuid root to give it broader task_for_pid()
access by bypassing taskgated(8) checks, but this also has the effect of bypassing the access checks, allowing any process’ task port to be obtained. In most situations, these access checks are desirable to prevent security and privacy breaches.
When running as setuid root, this function wraps task_for_pid()
, reimplementing those access checks. A process whose effective user ID is 0 and whose real user ID is nonzero is understood to be running setuid root. In this case, the requested task’s real, effective, and saved set-user IDs must all equal the running process’ real user ID, the requested task must not have changed privileges, and the requested task’s set of all group IDs (including its real, effective, and saved set-group IDs and supplementary group list) must be a subset of the running process’ set of all group IDs. These access checks mimic those that the kernel performs.
When not running as setuid root, task_for_pid()
is called directly, without imposing any additional checks beyond what the kernel does.
[in] | pid | The process ID of the task whose task port is desired. |
TASK_NULL
otherwise, with an error message logged. If a send right is returned, the caller takes ownership of it. std::string crashpad::ThreadStateFlavorToString | ( | thread_state_flavor_t | flavor, |
SymbolicConstantToStringOptions | options | ||
) |
Converts a thread state flavor value to a textual representation.
[in] | flavor | The thread state flavor value to convert. |
[in] | options | Options affecting the conversion. kUseOr is ignored. For kUnknownIsNumeric, the format is "%d" . |
kern_return_t crashpad::UniversalExceptionRaise | ( | exception_behavior_t | behavior, |
exception_handler_t | exception_port, | ||
thread_t | thread, | ||
task_t | task, | ||
exception_type_t | exception, | ||
const mach_exception_data_type_t * | code, | ||
mach_msg_type_number_t | code_count, | ||
thread_state_flavor_t * | flavor, | ||
ConstThreadState | old_state, | ||
mach_msg_type_number_t | old_state_count, | ||
thread_state_t | new_state, | ||
mach_msg_type_number_t * | new_state_count | ||
) |
Calls the appropriate *exception_raise*()
function for the specified behavior.
The function called will be exception_raise()
for EXCEPTION_DEFAULT
, exception_raise_state()
for EXCEPTION_STATE
, or exception_raise_state_identity()
for EXCEPTION_STATE_IDENTITY
. If MACH_EXCEPTION_CODES
is also set, the function called will instead be mach_exception_raise()
, mach_exception_raise_state()
or mach_exception_raise_state_identity()
, respectively.
This function does not fetch the existing thread state for behavior values that require a thread state. The caller must provide the existing thread state in the flavor, old_state, and old_state_count parameters for behavior values that require a thread state. Thread states may be obtained by calling thread_get_state()
if needed. Similarly, this function does not do anything with the new thread state returned for these behavior values. Callers that wish to make use of the new thread state may do so by using the returned flavor, new_state, and new_state_count values. Thread states may be set by calling thread_set_state()
if needed.
thread and task are only used when behavior indicates that the exception message will carry identity information, when it has the value value EXCEPTION_DEFAULT
or EXCEPTION_STATE_IDENTITY
, possibly with MACH_EXCEPTION_CODES
also set. In other cases, these parameters are unused and may be set to THREAD_NULL
and TASK_NULL
, respectively.
flavor, old_state, old_state_count, new_state, and new_state_count are only used when behavior indicates that the exception message will carry thread state information, when it has the value EXCEPTION_STATE
or EXCEPTION_STATE_IDENTITY
, possibly with MACH_EXCEPTION_CODES
also set. In other cases, these parameters are unused and may be set to 0
(old_state_count) or nullptr
(the remaining parameters).
Except as noted, the parameters and return value are equivalent to those of the *exception_raise*()
family of functions.
[in] | behavior | The exception behavior, which dictates which function will be called. It is an error to call this function with an invalid value for behavior. |
[in] | exception_port | |
[in] | thread | |
[in] | task | |
[in] | exception | |
[in] | code | If behavior indicates a behavior without MACH_EXCEPTION_CODES , the elements of code will be truncated in order to be passed to the appropriate exception handler. |
[in] | code_count | |
[in,out] | flavor | |
[in] | old_state | |
[in] | old_state_count | |
[out] | new_state | |
[out] | new_state_count |
FileOperationResult crashpad::WriteFile | ( | FileHandle | file, |
const void * | buffer, | ||
size_t | size | ||
) |
Writes to a file, retrying when interrupted or following a short write on POSIX.
This function writes to file, stopping only when size bytes have been written.
-1
on error, with errno
or GetLastError()
set appropriately. On error, a portion of buffer may have been written to file.bool crashpad::WriteXattr | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
const std::string & | value | ||
) |
Writes an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to write. |
[in] | value | The value of the attribute. |
true
if the write was successful. false
on error, with a message logged. bool crashpad::WriteXattrBool | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
bool | value | ||
) |
Writes an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to write. |
[in] | value | The value of the attribute. |
true
if the write was successful. false
on error, with a message logged. bool crashpad::WriteXattrInt | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
int | value | ||
) |
Writes an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to write. |
[in] | value | The value of the attribute. |
true
if the write was successful. false
on error, with a message logged. bool crashpad::WriteXattrTimeT | ( | const base::FilePath & | file, |
const base::StringPiece & | name, | ||
time_t | value | ||
) |
Writes an extended attribute on a file.
[in] | file | The path to the file. |
[in] | name | The name of the extended attribute to write. |
[in] | value | The value of the attribute. |
true
if the write was successful. false
on error, with a message logged. std::string crashpad::ZlibErrorString | ( | int | zr | ) |
Formats a string for an error received from the zlib library.
[in] | zr | A zlib result code, such as Z_STREAM_ERROR . |
int crashpad::ZlibWindowBitsWithGzipWrapper | ( | int | window_bits | ) |
Obtain a window_bits parameter to pass to deflateInit2()
or inflateInit2()
that specifies a gzip
wrapper instead of the default zlib wrapper.
[in] | window_bits | A window_bits value that only specifies the base-2 logarithm of the deflate sliding window size. |
gzip
wrapper, to be passed to deflateInit2()
or inflateInit2()
. const exception_behavior_t crashpad::kMachExceptionCodes = MACH_EXCEPTION_CODES |
MACH_EXCEPTION_CODES
with the correct type for a Mach exception behavior, exception_behavior_t
.
Signedness problems can occur when ORing MACH_EXCEPTION_CODES
as a signed integer, because a signed integer overflow results. This constant can be used instead of MACH_EXCEPTION_CODES
in such cases.
const mach_msg_option_t crashpad::kMachMessageReceiveAuditTrailer |
A Mach message option specifying that an audit trailer should be delivered during a receive operation.
This constant is provided because the macros normally used to request this behavior are cumbersome.
const mach_port_t crashpad::kMachPortNull = MACH_PORT_NULL |
MACH_PORT_NULL
with the correct type for a Mach port, mach_port_t
.
For situations where implicit conversions between signed and unsigned types are not performed, use kMachPortNull instead of an explicit implicit_cast
of MACH_PORT_NULL
to mach_port_t
. This is useful for logging and testing assertions.