Crashpad
|
The writer for a MINIDUMP_THREAD object in a minidump file. More...
#include "minidump/minidump_thread_writer.h"
Public Member Functions | |
void | InitializeFromSnapshot (const ThreadSnapshot *thread_snapshot, const MinidumpThreadIDMap *thread_id_map) |
Initializes the MINIDUMP_THREAD based on thread_snapshot. More... | |
const MINIDUMP_THREAD * | MinidumpThread () const |
Returns a MINIDUMP_THREAD referencing this object’s data. More... | |
SnapshotMinidumpMemoryWriter * | Stack () const |
Returns a SnapshotMinidumpMemoryWriter that will write the memory region corresponding to this object’s stack. More... | |
void | SetStack (std::unique_ptr< SnapshotMinidumpMemoryWriter > stack) |
Arranges for MINIDUMP_THREAD::Stack to point to the MINIDUMP_MEMORY object to be written by stack. More... | |
void | SetContext (std::unique_ptr< MinidumpContextWriter > context) |
Arranges for MINIDUMP_THREAD::ThreadContext to point to the CPU context to be written by context. More... | |
void | SetThreadID (uint32_t thread_id) |
Sets MINIDUMP_THREAD::ThreadId. | |
void | SetSuspendCount (uint32_t suspend_count) |
Sets MINIDUMP_THREAD::SuspendCount. | |
void | SetPriorityClass (uint32_t priority_class) |
Sets MINIDUMP_THREAD::PriorityClass. | |
void | SetPriority (uint32_t priority) |
Sets MINIDUMP_THREAD::Priority. | |
void | SetTEB (uint64_t teb) |
Sets MINIDUMP_THREAD::Teb. | |
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... | |
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_THREAD object in a minidump file.
Because MINIDUMP_THREAD objects only appear as elements of MINIDUMP_THREAD_LIST objects, this class does not write any data on its own. It makes its MINIDUMP_THREAD data available to its MinidumpThreadListWriter parent, which writes it as part of a MINIDUMP_THREAD_LIST.
|
overrideprotectedvirtual |
Returns the object’s children.
Reimplemented from crashpad::internal::MinidumpWritable.
|
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.
void crashpad::MinidumpThreadWriter::InitializeFromSnapshot | ( | const ThreadSnapshot * | thread_snapshot, |
const MinidumpThreadIDMap * | thread_id_map | ||
) |
Initializes the MINIDUMP_THREAD based on thread_snapshot.
[in] | thread_snapshot | The thread snapshot to use as source data. |
[in] | thread_id_map | A MinidumpThreadIDMap to be consulted to determine the 32-bit minidump thread ID to use for thread_snapshot. |
const MINIDUMP_THREAD * crashpad::MinidumpThreadWriter::MinidumpThread | ( | ) | const |
Returns a MINIDUMP_THREAD referencing this object’s data.
This method is expected to be called by a MinidumpThreadListWriter in order to obtain a MINIDUMP_THREAD to include in its list.
void crashpad::MinidumpThreadWriter::SetContext | ( | std::unique_ptr< MinidumpContextWriter > | context | ) |
Arranges for MINIDUMP_THREAD::ThreadContext to point to the CPU context to be written by context.
A context is required in all MINIDUMP_THREAD objects.
This object takes ownership of context and becomes its parent in the overall tree of internal::MinidumpWritable objects.
void crashpad::MinidumpThreadWriter::SetStack | ( | std::unique_ptr< SnapshotMinidumpMemoryWriter > | stack | ) |
Arranges for MINIDUMP_THREAD::Stack to point to the MINIDUMP_MEMORY object to be written by stack.
This object takes ownership of stack and becomes its parent in the overall tree of internal::MinidumpWritable objects.
|
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.
|
inline |
Returns a SnapshotMinidumpMemoryWriter that will write the memory region corresponding to this object’s stack.
If the thread does not have a stack, or its stack could not be determined, this will return nullptr
.
This method is provided so that MinidumpThreadListWriter can obtain thread stack memory regions for the purposes of adding them to a MinidumpMemoryListWriter (configured by calling MinidumpThreadListWriter::SetMemoryListWriter()) by calling MinidumpMemoryListWriter::AddExtraMemory().
|
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.