Crashpad
Public Member Functions | Protected Member Functions | List of all members
crashpad::MinidumpModuleWriter Class Referencefinal

The writer for a MINIDUMP_MODULE object in a minidump file. More...

#include "minidump/minidump_module_writer.h"

Inheritance diagram for crashpad::MinidumpModuleWriter:
crashpad::internal::MinidumpWritable

Public Member Functions

void InitializeFromSnapshot (const ModuleSnapshot *module_snapshot)
 Initializes the MINIDUMP_MODULE based on module_snapshot. More...
 
const MINIDUMP_MODULEMinidumpModule () const
 Returns a MINIDUMP_MODULE referencing this object’s data. More...
 
void SetName (const std::string &name)
 Arranges for MINIDUMP_MODULE::ModuleNameRva to point to a MINIDUMP_STRING containing name. More...
 
void SetCodeViewRecord (std::unique_ptr< MinidumpModuleCodeViewRecordWriter > codeview_record)
 Arranges for MINIDUMP_MODULE::CvRecord to point to a CodeView record to be written by codeview_record. More...
 
void SetMiscDebugRecord (std::unique_ptr< MinidumpModuleMiscDebugRecordWriter > misc_debug_record)
 Arranges for MINIDUMP_MODULE::MiscRecord to point to an IMAGE_DEBUG_MISC object to be written by misc_debug_record. More...
 
void SetImageBaseAddress (uint64_t image_base_address)
 Sets IMAGE_DEBUG_MISC::BaseOfImage.
 
void SetImageSize (uint32_t image_size)
 Sets IMAGE_DEBUG_MISC::SizeOfImage.
 
void SetChecksum (uint32_t checksum)
 Sets IMAGE_DEBUG_MISC::CheckSum.
 
void SetTimestamp (time_t timestamp)
 Sets IMAGE_DEBUG_MISC::TimeDateStamp. More...
 
void SetFileVersion (uint16_t version_0, uint16_t version_1, uint16_t version_2, uint16_t version_3)
 Sets IMAGE_DEBUG_MISC::VersionInfo::dwFileVersionMS and IMAGE_DEBUG_MISC::VersionInfo::dwFileVersionLS. More...
 
void SetProductVersion (uint16_t version_0, uint16_t version_1, uint16_t version_2, uint16_t version_3)
 Sets IMAGE_DEBUG_MISC::VersionInfo::dwProductVersionMS and IMAGE_DEBUG_MISC::VersionInfo::dwProductVersionLS. More...
 
void SetFileFlagsAndMask (uint32_t file_flags, uint32_t file_flags_mask)
 Sets IMAGE_DEBUG_MISC::VersionInfo::dwFileFlags and IMAGE_DEBUG_MISC::VersionInfo::dwFileFlagsMask. More...
 
void SetFileOS (uint32_t file_os)
 Sets IMAGE_DEBUG_MISC::VersionInfo::dwFileOS.
 
void SetFileTypeAndSubtype (uint32_t file_type, uint32_t file_subtype)
 Sets IMAGE_DEBUG_MISC::VersionInfo::dwFileType and IMAGE_DEBUG_MISC::VersionInfo::dwFileSubtype.
 
- Public Member Functions inherited from crashpad::internal::MinidumpWritable
virtual bool WriteEverything (FileWriterInterface *file_writer)
 Writes an object and all of its children to a minidump file. More...
 
void RegisterRVA (RVA *rva)
 Registers a file offset pointer as one that should point to the object on which this method is called. More...
 
void RegisterLocationDescriptor (MINIDUMP_LOCATION_DESCRIPTOR *location_descriptor)
 Registers a location descriptor as one that should point to the object on which this method is called. More...
 

Protected Member Functions

bool Freeze () override
 Transitions the object from kStateMutable to kStateFrozen. More...
 
size_t SizeOfObject () override
 Returns the amount of space that this object will consume when written to a minidump file, in bytes, not including any leading or trailing padding necessary to maintain proper alignment. More...
 
std::vector< MinidumpWritable * > Children () override
 Returns the object’s children. More...
 
bool WriteObject (FileWriterInterface *file_writer) override
 Writes the object’s content. More...
 
- Protected Member Functions inherited from crashpad::internal::MinidumpWritable
State state () const
 The state of the object.
 
virtual size_t Alignment ()
 Returns the object’s desired byte-boundary alignment. More...
 
virtual Phase WritePhase ()
 Returns the object’s desired write phase. More...
 
size_t WillWriteAtOffset (Phase phase, FileOffset *offset, std::vector< MinidumpWritable * > *write_sequence)
 Prepares the object to be written at a known file offset, transitioning it from kStateFrozen to kStateWritable. More...
 
virtual bool WillWriteAtOffsetImpl (FileOffset offset)
 Called once an object’s writable file offset is determined, as it transitions into kStateWritable. More...
 
bool WritePaddingAndObject (FileWriterInterface *file_writer)
 Writes the object, transitioning it from kStateWritable to kStateWritten. More...
 

Additional Inherited Members

- Protected Types inherited from crashpad::internal::MinidumpWritable
enum  State
 Identifies the state of an object. More...
 
enum  Phase
 Identifies the phase during which an object will be written to a minidump file. More...
 
- Static Protected Attributes inherited from crashpad::internal::MinidumpWritable
static constexpr size_t kInvalidSize = std::numeric_limits<size_t>::max()
 A size value used to signal failure by methods that return size_t.
 

Detailed Description

The writer for a MINIDUMP_MODULE object in a minidump file.

Because MINIDUMP_MODULE objects only appear as elements of MINIDUMP_MODULE_LIST objects, this class does not write any data on its own. It makes its MINIDUMP_MODULE data available to its MinidumpModuleListWriter parent, which writes it as part of a MINIDUMP_MODULE_LIST.

Member Function Documentation

◆ Children()

std::vector< internal::MinidumpWritable * > crashpad::MinidumpModuleWriter::Children ( )
overrideprotectedvirtual

Returns the object’s children.

Note
Valid in kStateFrozen or any subsequent state.

Reimplemented from crashpad::internal::MinidumpWritable.

◆ Freeze()

bool crashpad::MinidumpModuleWriter::Freeze ( )
overrideprotectedvirtual

Transitions the object from kStateMutable to kStateFrozen.

The default implementation marks the object as frozen and recursively calls Freeze() on all of its children. Subclasses may override this method to perform processing that should only be done once callers have finished populating an object with data. Typically, a subclass implementation would call RegisterRVA() or RegisterLocationDescriptor() on other objects as appropriate, because at the time Freeze() runs, the in-memory locations of RVAs and location descriptors are known and will not change for the remaining duration of an object’s lifetime.

Returns
true on success. false on failure, with an appropriate message logged.

Reimplemented from crashpad::internal::MinidumpWritable.

◆ InitializeFromSnapshot()

void crashpad::MinidumpModuleWriter::InitializeFromSnapshot ( const ModuleSnapshot module_snapshot)

Initializes the MINIDUMP_MODULE based on module_snapshot.

Parameters
[in]module_snapshotThe module snapshot to use as source data.
Note
Valid in kStateMutable. No mutator methods may be called before this method, and it is not normally necessary to call any mutator methods after this method.

◆ MinidumpModule()

const MINIDUMP_MODULE * crashpad::MinidumpModuleWriter::MinidumpModule ( ) const

Returns a MINIDUMP_MODULE referencing this object’s data.

This method is expected to be called by a MinidumpModuleListWriter in order to obtain a MINIDUMP_MODULE to include in its list.

Note
Valid in kStateWritable.

◆ SetCodeViewRecord()

void crashpad::MinidumpModuleWriter::SetCodeViewRecord ( std::unique_ptr< MinidumpModuleCodeViewRecordWriter codeview_record)

Arranges for MINIDUMP_MODULE::CvRecord to point to a CodeView record to be written by codeview_record.

This object takes ownership of codeview_record and becomes its parent in the overall tree of internal::MinidumpWritable objects.

Note
Valid in kStateMutable.

◆ SetFileFlagsAndMask()

void crashpad::MinidumpModuleWriter::SetFileFlagsAndMask ( uint32_t  file_flags,
uint32_t  file_flags_mask 
)

◆ SetFileVersion()

void crashpad::MinidumpModuleWriter::SetFileVersion ( uint16_t  version_0,
uint16_t  version_1,
uint16_t  version_2,
uint16_t  version_3 
)

◆ SetMiscDebugRecord()

void crashpad::MinidumpModuleWriter::SetMiscDebugRecord ( std::unique_ptr< MinidumpModuleMiscDebugRecordWriter misc_debug_record)

Arranges for MINIDUMP_MODULE::MiscRecord to point to an IMAGE_DEBUG_MISC object to be written by misc_debug_record.

This object takes ownership of misc_debug_record and becomes its parent in the overall tree of internal::MinidumpWritable objects.

Note
Valid in kStateMutable.

◆ SetName()

void crashpad::MinidumpModuleWriter::SetName ( const std::string &  name)

Arranges for MINIDUMP_MODULE::ModuleNameRva to point to a MINIDUMP_STRING containing name.

A name is required in all MINIDUMP_MODULE objects.

Note
Valid in kStateMutable.

◆ SetProductVersion()

void crashpad::MinidumpModuleWriter::SetProductVersion ( uint16_t  version_0,
uint16_t  version_1,
uint16_t  version_2,
uint16_t  version_3 
)

◆ SetTimestamp()

void crashpad::MinidumpModuleWriter::SetTimestamp ( time_t  timestamp)

Sets IMAGE_DEBUG_MISC::TimeDateStamp.

Note
Valid in kStateMutable.

◆ SizeOfObject()

size_t crashpad::MinidumpModuleWriter::SizeOfObject ( )
overrideprotectedvirtual

Returns the amount of space that this object will consume when written to a minidump file, in bytes, not including any leading or trailing padding necessary to maintain proper alignment.

Note
Valid in kStateFrozen or any subsequent state.

Implements crashpad::internal::MinidumpWritable.

◆ WriteObject()

bool crashpad::MinidumpModuleWriter::WriteObject ( FileWriterInterface file_writer)
overrideprotectedvirtual

Writes the object’s content.

Parameters
[in]file_writerThe file writer to receive the object’s content.
Returns
true on success. false on error, indicating that the content could not be written to the minidump file.
Note
Valid in kStateWritable. The object will transition to kStateWritten after this method returns.

Implements crashpad::internal::MinidumpWritable.


The documentation for this class was generated from the following files: