Crashpad
|
The writer for a MINIDUMP_MEMORY_LIST stream in a minidump file, containing a list of MINIDUMP_MEMORY_DESCRIPTOR objects. More...
#include "minidump/minidump_memory_writer.h"
Public Member Functions | |
void | AddFromSnapshot (const std::vector< const MemorySnapshot * > &memory_snapshots) |
Adds a concrete initialized SnapshotMinidumpMemoryWriter for each memory snapshot in memory_snapshots to the MINIDUMP_MEMORY_LIST. More... | |
void | AddMemory (std::unique_ptr< SnapshotMinidumpMemoryWriter > memory_writer) |
Adds a SnapshotMinidumpMemoryWriter to the MINIDUMP_MEMORY_LIST. More... | |
void | AddNonOwnedMemory (SnapshotMinidumpMemoryWriter *memory_writer) |
Adds a SnapshotMinidumpMemoryWriter that’s a child of another internal::MinidumpWritable object to the MINIDUMP_MEMORY_LIST. More... | |
Public Member Functions inherited from crashpad::internal::MinidumpStreamWriter | |
const MINIDUMP_DIRECTORY * | DirectoryListEntry () const |
Returns a MINIDUMP_DIRECTORY entry that serves as a pointer to this stream. More... | |
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... | |
MinidumpStreamType | StreamType () const override |
Returns an object’s stream type. More... | |
void | CoalesceOwnedMemory () |
Merges any overlapping and abutting memory ranges that were added via AddFromSnapshot() and AddMemory() into single entries. More... | |
Protected Member Functions inherited from crashpad::internal::MinidumpStreamWriter | |
bool | Freeze () override |
Transitions the object from kStateMutable to kStateFrozen. 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 . | |
The writer for a MINIDUMP_MEMORY_LIST stream in a minidump file, containing a list of MINIDUMP_MEMORY_DESCRIPTOR objects.
void crashpad::MinidumpMemoryListWriter::AddFromSnapshot | ( | const std::vector< const MemorySnapshot * > & | memory_snapshots | ) |
Adds a concrete initialized SnapshotMinidumpMemoryWriter for each memory snapshot in memory_snapshots to the MINIDUMP_MEMORY_LIST.
Memory snapshots are added in the fashion of AddMemory().
[in] | memory_snapshots | The memory snapshots to use as source data. |
void crashpad::MinidumpMemoryListWriter::AddMemory | ( | std::unique_ptr< SnapshotMinidumpMemoryWriter > | memory_writer | ) |
Adds a SnapshotMinidumpMemoryWriter to the MINIDUMP_MEMORY_LIST.
This object takes ownership of memory_writer and becomes its parent in the overall tree of internal::MinidumpWritable objects.
void crashpad::MinidumpMemoryListWriter::AddNonOwnedMemory | ( | SnapshotMinidumpMemoryWriter * | memory_writer | ) |
Adds a SnapshotMinidumpMemoryWriter that’s a child of another internal::MinidumpWritable object to the MINIDUMP_MEMORY_LIST.
memory_writer does not become a child of this object, but the MINIDUMP_MEMORY_LIST will still contain a MINIDUMP_MEMORY_DESCRIPTOR for it. memory_writer must be a child of another object in the internal::MinidumpWritable tree.
This method exists to be called by objects that have their own SnapshotMinidumpMemoryWriter children but wish for them to also appear in the minidump file’s MINIDUMP_MEMORY_LIST. MinidumpThreadWriter, which has a SnapshotMinidumpMemoryWriter for thread stack memory, is an example.
|
overrideprotectedvirtual |
Returns the object’s children.
Reimplemented from crashpad::internal::MinidumpWritable.
|
protected |
Merges any overlapping and abutting memory ranges that were added via AddFromSnapshot() and AddMemory() into single entries.
This is expected to be called once just before writing, generally from Freeze().
This function has the side-effect of merging owned ranges, dropping any owned ranges that overlap with non-owned ranges, removing empty ranges, and sorting all ranges by address.
Per its name, this coalesces owned memory, however, this is not a complete solution for ensuring that no overlapping memory ranges are emitted in the minidump. In particular, if AddNonOwnedMemory() is used to add multiple overlapping ranges, then overlapping ranges will still be emitted to the minidump. Currently, AddNonOwnedMemory() is used only for adding thread stacks, so overlapping shouldn't be a problem in practice. For more details see https://crashpad.chromium.org/bug/61 and https://crrev.com/c/374539.
|
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.
|
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.
Implements crashpad::internal::MinidumpWritable.
|
overrideprotectedvirtual |
Returns an object’s stream type.
Implements crashpad::internal::MinidumpStreamWriter.
|
overrideprotectedvirtual |
Writes the object’s content.
[in] | file_writer | The file writer to receive the object’s content. |
true
on success. false
on error, indicating that the content could not be written to the minidump file.Implements crashpad::internal::MinidumpWritable.