class MinidumpWritable

Defined at line 35 of file ../../third_party/crashpad/src/minidump/minidump_writable.h

The base class for all content that might be written to a minidump

file.

Protected Members

static const size_t kInvalidSize

Public Methods

void MinidumpWritable (const MinidumpWritable & )

Defined at line 37 of file ../../third_party/crashpad/src/minidump/minidump_writable.h

MinidumpWritable & operator= (const MinidumpWritable & )

Defined at line 38 of file ../../third_party/crashpad/src/minidump/minidump_writable.h

void ~MinidumpWritable ()
bool WriteEverything (FileWriterInterface * file_writer)

Writes an object and all of its children to a minidump file.

Use this on the root object of a tree of MinidumpWritable objects,

typically on a MinidumpFileWriter object.

Parameters

file_writer [in] The file writer to receive the minidump file’s content.

Returns

`true` on success. `false` on failure, with an appropriate message

logged.

void RegisterRVA (RVA * rva)

Registers a file offset pointer as one that should point to the

object on which this method is called.

Once the file offset at which an object will be written is known (when it

enters #kStateWritable), registered RVA pointers will be updated.

This is public instead of protected because objects of derived classes need

to be able to register their own pointers with distinct objects.

Parameters

rva [in] A pointer to storage for the file offset that should contain this object’s writable file offset, once it is known.
void RegisterRVA (RVA64 * rva)
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.

Once an object’s size and the file offset at it will be written is known

(when it enters #kStateFrozen), the relevant data in registered location

descriptors will be updated.

This is public instead of protected because objects of derived classes need

to be able to register their own pointers with distinct objects.

Parameters

location_descriptor [in] A pointer to a location descriptor that should contain this object’s writable size and file offset, once they are known.
void RegisterLocationDescriptor (MINIDUMP_LOCATION_DESCRIPTOR64 * location_descriptor64)

Protected Methods

void MinidumpWritable ()
bool Freeze ()

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.

size_t SizeOfObject ()

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.

size_t Alignment ()

Returns the object’s desired byte-boundary alignment.

The default implementation returns `4`. Subclasses may override this as

needed.

std::vector<MinidumpWritable *> Children ()

Returns the object’s children.

Phase WritePhase ()

Returns the object’s desired write phase.

The default implementation returns #kPhaseEarly. Subclasses may override

this method to alter their write phase.

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.

This method is responsible for determining the final file offset of the

object, which may be increased from

to meet alignment

requirements. It calls WillWriteAtOffsetImpl() for the benefit of

subclasses. It populates all RVAs and location descriptors registered with

it via RegisterRVA() and RegisterLocationDescriptor(). It also recurses

into all known children.

Parameters

phase [in] The phase during which the object will be written. If this does not match Phase(), processing is suppressed, although recursive processing will still occur on all children. This addresses the case where parents and children do not write in the same phase.
offset [in] The file offset at which the object will be written. The offset may need to be adjusted for alignment.
write_sequence [out] This object will append itself to this list, such that on return from a recursive tree of WillWriteAtOffset() calls, elements of the vector will be organized in the sequence that the objects will be written to the minidump file.

Returns

The file size consumed by this object and all children, including

any padding inserted to meet alignment requirements. On failure,

#kInvalidSize, with an appropriate message logged.

bool WillWriteAtOffsetImpl (FileOffset offset)

Called once an object’s writable file offset is determined, as it

transitions into #kStateWritable.

Subclasses can override this method if they need to provide additional

processing once their writable file offset is known. Typically, this will

be done by subclasses that handle certain RVAs themselves instead of using

the RegisterRVA() interface.

Parameters

offset [in] The file offset at which the object will be written. The value passed to this method will already have been adjusted to meet alignment requirements.

Returns

`true` on success. `false` on error, indicating that the minidump

file should not be written.

bool WritePaddingAndObject (FileWriterInterface * file_writer)

Writes the object, transitioning it from #kStateWritable to

#kStateWritten.

Writes any padding necessary to meet alignment requirements, and then

calls WriteObject() to write the object’s content.

Parameters

file_writer [in] The file writer to receive the object’s content.

Returns

`true` on success. `false` on error with an appropriate message

logged.

bool WriteObject (FileWriterInterface * file_writer)

Writes the object’s content.

Parameters

file_writer [in] The 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.

State state ()

The state of the object.

Defined at line 148 of file ../../third_party/crashpad/src/minidump/minidump_writable.h

Enumerations

enum State
Name Value
kStateMutable 0
kStateFrozen 1
kStateWritable 2
kStateWritten 3

Identifies the state of an object.

Objects will normally transition through each of these states as they are

created, populated with data, and then written to a minidump file.

Defined at line 100 of file ../../third_party/crashpad/src/minidump/minidump_writable.h

enum Phase
Name Value
kPhaseEarly 0
kPhaseLate 1

Identifies the phase during which an object will be written to a

minidump file.

Defined at line 123 of file ../../third_party/crashpad/src/minidump/minidump_writable.h