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

The writer for a MINIDUMP_THREAD_LIST stream in a minidump file, containing a list of MINIDUMP_THREAD objects. More...

#include "minidump/minidump_thread_writer.h"

Inheritance diagram for crashpad::MinidumpThreadListWriter:
crashpad::internal::MinidumpStreamWriter crashpad::internal::MinidumpWritable

Public Member Functions

void InitializeFromSnapshot (const std::vector< const ThreadSnapshot * > &thread_snapshots, MinidumpThreadIDMap *thread_id_map)
 Adds an initialized MINIDUMP_THREAD for each thread in thread_snapshots to the MINIDUMP_THREAD_LIST. More...
 
void SetMemoryListWriter (MinidumpMemoryListWriter *memory_list_writer)
 Sets the MinidumpMemoryListWriter that each thread’s stack memory region should be added to as extra memory. More...
 
void AddThread (std::unique_ptr< MinidumpThreadWriter > thread)
 Adds a MinidumpThreadWriter to the MINIDUMP_THREAD_LIST. More...
 
- Public Member Functions inherited from crashpad::internal::MinidumpStreamWriter
const MINIDUMP_DIRECTORYDirectoryListEntry () 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...
 
- 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_THREAD_LIST stream in a minidump file, containing a list of MINIDUMP_THREAD objects.

Member Function Documentation

◆ AddThread()

void crashpad::MinidumpThreadListWriter::AddThread ( std::unique_ptr< MinidumpThreadWriter thread)

Adds a MinidumpThreadWriter to the MINIDUMP_THREAD_LIST.

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

Note
Valid in kStateMutable.

◆ Children()

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

Returns the object’s children.

Note
Valid in kStateFrozen or any subsequent state.

Reimplemented from crashpad::internal::MinidumpWritable.

◆ Freeze()

bool crashpad::MinidumpThreadListWriter::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::MinidumpStreamWriter.

◆ InitializeFromSnapshot()

void crashpad::MinidumpThreadListWriter::InitializeFromSnapshot ( const std::vector< const ThreadSnapshot * > &  thread_snapshots,
MinidumpThreadIDMap thread_id_map 
)

Adds an initialized MINIDUMP_THREAD for each thread in thread_snapshots to the MINIDUMP_THREAD_LIST.

Parameters
[in]thread_snapshotsThe thread snapshots to use as source data.
[out]thread_id_mapA MinidumpThreadIDMap to be built by this method. This map must be empty when this method is called.
Note
Valid in kStateMutable. AddThread() may not be called before this method, and it is not normally necessary to call AddThread() after this method.

◆ SetMemoryListWriter()

void crashpad::MinidumpThreadListWriter::SetMemoryListWriter ( MinidumpMemoryListWriter memory_list_writer)

Sets the MinidumpMemoryListWriter that each thread’s stack memory region should be added to as extra memory.

Each MINIDUMP_THREAD object can contain a reference to a SnapshotMinidumpMemoryWriter object that contains a snapshot of its stac memory. In the overall tree of internal::MinidumpWritable objects, these SnapshotMinidumpMemoryWriter objects are considered children of their MINIDUMP_THREAD, and are referenced by a MINIDUMP_MEMORY_DESCRIPTOR contained in the MINIDUMP_THREAD. It is also possible for the same memory regions to have MINIDUMP_MEMORY_DESCRIPTOR objects present in a MINIDUMP_MEMORY_LIST stream. This is accomplished by calling this method, which informs a MinidumpThreadListWriter that it should call MinidumpMemoryListWriter::AddExtraMemory() for each extant thread stack while the thread is being added in AddThread(). When this is done, the MinidumpMemoryListWriter will contain a MINIDUMP_MEMORY_DESCRIPTOR pointing to the thread’s stack memory in its MINIDUMP_MEMORY_LIST. Note that the actual contents of the memory is only written once, as a child of the MinidumpThreadWriter. The MINIDUMP_MEMORY_DESCRIPTOR objects in both the MINIDUMP_THREAD and MINIDUMP_MEMORY_LIST will point to the same copy of the memory’s contents.

Note
This method must be called before AddThread() is called. Threads added by AddThread() prior to this method being called will not have their stacks added to memory_list_writer as extra memory.
Valid in kStateMutable.

◆ SizeOfObject()

size_t crashpad::MinidumpThreadListWriter::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.

◆ StreamType()

MinidumpStreamType crashpad::MinidumpThreadListWriter::StreamType ( ) const
overrideprotectedvirtual

Returns an object’s stream type.

Note
Valid in any state.

Implements crashpad::internal::MinidumpStreamWriter.

◆ WriteObject()

bool crashpad::MinidumpThreadListWriter::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: