Crashpad
|
The base class for writers of memory ranges pointed to by MINIDUMP_MEMORY_DESCRIPTOR objects in a minidump file. More...
#include "minidump/minidump_memory_writer.h"
Public Member Functions | |
const MINIDUMP_MEMORY_DESCRIPTOR * | MinidumpMemoryDescriptor () const |
Returns a MINIDUMP_MEMORY_DESCRIPTOR referencing the data that this object writes. More... | |
void | RegisterMemoryDescriptor (MINIDUMP_MEMORY_DESCRIPTOR *memory_descriptor) |
Registers a memory descriptor as one that should point to the object on which this method is called. More... | |
![]() | |
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... | |
Static Public Member Functions | |
static std::unique_ptr< MinidumpMemoryWriter > | CreateFromSnapshot (const MemorySnapshot *memory_snapshot) |
Creates a concrete initialized MinidumpMemoryWriter based on memory_snapshot. More... | |
Protected Member Functions | |
virtual uint64_t | MemoryRangeBaseAddress () const =0 |
Returns the base address of the memory region in the address space of the process that the snapshot describes. More... | |
virtual size_t | MemoryRangeSize () const =0 |
Returns the size of the memory region in bytes. More... | |
bool | Freeze () override |
Transitions the object from kStateMutable to kStateFrozen. More... | |
size_t | SizeOfObject () final |
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... | |
size_t | Alignment () override |
Returns the object’s desired byte-boundary alignment. More... | |
bool | WillWriteAtOffsetImpl (FileOffset offset) override |
Called once an object’s writable file offset is determined, as it transitions into kStateWritable. More... | |
Phase | WritePhase () final |
Returns the object’s desired write phase. More... | |
![]() | |
State | state () const |
The state of the object. | |
virtual std::vector< MinidumpWritable * > | Children () |
Returns the object’s children. 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... | |
bool | WritePaddingAndObject (FileWriterInterface *file_writer) |
Writes the object, transitioning it from kStateWritable to kStateWritten. More... | |
virtual bool | WriteObject (FileWriterInterface *file_writer)=0 |
Writes the object’s content. More... | |
Additional Inherited Members | |
![]() | |
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 const size_t | kInvalidSize |
A size value used to signal failure by methods that return size_t . More... | |
The base class for writers of memory ranges pointed to by MINIDUMP_MEMORY_DESCRIPTOR objects in a minidump file.
This is an abstract base class because users are expected to provide their own implementations that, when possible, obtain the memory contents on-demand in their WriteObject() methods. Memory ranges may be large, and the alternative construction would require the contents of multiple ranges to be held in memory simultaneously while a minidump file is being written.
|
overrideprotectedvirtual |
Returns the object’s desired byte-boundary alignment.
Memory regions are aligned to a 16-byte boundary. The actual alignment requirements of any data within the memory region are unknown, and may be more or less strict than this depending on the platform.
16
.Reimplemented from crashpad::internal::MinidumpWritable.
|
static |
Creates a concrete initialized MinidumpMemoryWriter based on memory_snapshot.
[in] | memory_snapshot | The memory snapshot to use as source data. |
|
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.
true
on success. false
on failure, with an appropriate message logged. Reimplemented from crashpad::internal::MinidumpWritable.
|
protectedpure virtual |
Returns the base address of the memory region in the address space of the process that the snapshot describes.
Implemented in crashpad::test::TestMinidumpMemoryWriter.
|
protectedpure virtual |
Returns the size of the memory region in bytes.
Implemented in crashpad::test::TestMinidumpMemoryWriter.
const MINIDUMP_MEMORY_DESCRIPTOR * crashpad::MinidumpMemoryWriter::MinidumpMemoryDescriptor | ( | ) | const |
Returns a MINIDUMP_MEMORY_DESCRIPTOR referencing the data that this object writes.
This method is expected to be called by a MinidumpMemoryListWriter in order to obtain a MINIDUMP_MEMORY_DESCRIPTOR to include in its list.
void crashpad::MinidumpMemoryWriter::RegisterMemoryDescriptor | ( | MINIDUMP_MEMORY_DESCRIPTOR * | memory_descriptor | ) |
Registers a memory descriptor as one that should point to the object on which this method is called.
This method is expected to be called by objects of other classes, when those other classes have their own memory descriptors that need to point to memory ranges within a minidump file. MinidumpThreadWriter is one such class. This method is public for this reason, otherwise it would suffice to be private.
|
finalprotectedvirtual |
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.
Implements crashpad::internal::MinidumpWritable.
|
overrideprotectedvirtual |
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.
[in] | offset | 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. |
true
on success. false
on error, indicating that the minidump file should not be written.Reimplemented from crashpad::internal::MinidumpWritable.
Reimplemented in crashpad::test::TestMinidumpMemoryWriter.
|
finalprotectedvirtual |
Returns the object’s desired write phase.
Memory regions are written at the end of minidump files, because it is expected that unlike most other data in a minidump file, the contents of memory regions will be accessed sparsely.
Reimplemented from crashpad::internal::MinidumpWritable.