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

A MinidumpMemoryWriter implementation used for testing. More...

#include "minidump/test/minidump_memory_writer_test_util.h"

Inheritance diagram for crashpad::test::TestMinidumpMemoryWriter:
crashpad::MinidumpMemoryWriter crashpad::internal::MinidumpWritable

Public Member Functions

 TestMinidumpMemoryWriter (uint64_t base_address, size_t size, uint8_t value)
 
- Public Member Functions inherited from crashpad::MinidumpMemoryWriter
const MINIDUMP_MEMORY_DESCRIPTORMinidumpMemoryDescriptor () 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...
 
- 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

uint64_t MemoryRangeBaseAddress () const override
 Returns the base address of the memory region in the address space of the process that the snapshot describes. More...
 
size_t MemoryRangeSize () const override
 Returns the size of the memory region in bytes. More...
 
bool WillWriteAtOffsetImpl (FileOffset offset) override
 Called once an object’s writable file offset is determined, as it transitions into kStateWritable. More...
 
bool WriteObject (FileWriterInterface *file_writer) override
 Writes the object’s content. More...
 
- Protected Member Functions inherited from crashpad::MinidumpMemoryWriter
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...
 
Phase WritePhase () final
 Returns the object’s desired write phase. More...
 
- Protected Member Functions inherited from crashpad::internal::MinidumpWritable
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from crashpad::MinidumpMemoryWriter
static std::unique_ptr< MinidumpMemoryWriterCreateFromSnapshot (const MemorySnapshot *memory_snapshot)
 Creates a concrete initialized MinidumpMemoryWriter based on memory_snapshot. More...
 
- 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 const size_t kInvalidSize
 A size value used to signal failure by methods that return size_t. More...
 

Detailed Description

A MinidumpMemoryWriter implementation used for testing.

TestMinidumpMemoryWriter objects are created with a fixed base address and size, and will write the same byte (value) repeatedly, size times.

Member Function Documentation

uint64_t crashpad::test::TestMinidumpMemoryWriter::MemoryRangeBaseAddress ( ) const
overrideprotectedvirtual

Returns the base address of the memory region in the address space of the process that the snapshot describes.

Note
This method will only be called in kStateFrozen.

Implements crashpad::MinidumpMemoryWriter.

size_t crashpad::test::TestMinidumpMemoryWriter::MemoryRangeSize ( ) const
overrideprotectedvirtual

Returns the size of the memory region in bytes.

Note
This method will only be called in kStateFrozen or a subsequent state.

Implements crashpad::MinidumpMemoryWriter.

bool crashpad::test::TestMinidumpMemoryWriter::WillWriteAtOffsetImpl ( FileOffset  offset)
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.

Parameters
[in]offsetThe 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.
Note
Valid in kStateFrozen. The object will transition to kStateWritable after this method returns.

Reimplemented from crashpad::MinidumpMemoryWriter.

bool crashpad::test::TestMinidumpMemoryWriter::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: