LLVM 22.0.0git
llvm::object::MinidumpFile Class Reference

A class providing access to the contents of a minidump file. More...

#include "llvm/Object/Minidump.h"

Inheritance diagram for llvm::object::MinidumpFile:
[legend]

Classes

class  ExceptionStreamsIterator
class  Memory64Iterator
 Class the provides an iterator over the memory64 memory ranges. More...
class  MemoryInfoIterator

Public Types

using FallibleMemory64Iterator = llvm::fallible_iterator<Memory64Iterator>

Public Member Functions

const minidump::Headerheader () const
 Returns the contents of the minidump header.
ArrayRef< minidump::Directorystreams () const
 Returns the list of streams (stream directory entries) in this file.
ArrayRef< uint8_tgetRawStream (const minidump::Directory &Stream) const
 Returns the raw contents of the stream given by the directory entry.
LLVM_ABI std::optional< ArrayRef< uint8_t > > getRawStream (minidump::StreamType Type) const
 Returns the raw contents of the stream of the given type, or std::nullopt if the file does not contain a stream of this type.
Expected< ArrayRef< uint8_t > > getRawData (minidump::LocationDescriptor Desc) const
 Returns the raw contents of an object given by the LocationDescriptor.
LLVM_ABI Expected< std::string > getString (size_t Offset) const
 Returns the minidump string at the given offset.
Expected< const minidump::SystemInfo & > getSystemInfo () const
 Returns the contents of the SystemInfo stream, cast to the appropriate type.
Expected< ArrayRef< minidump::Module > > getModuleList () const
 Returns the module list embedded in the ModuleList stream.
Expected< ArrayRef< minidump::Thread > > getThreadList () const
 Returns the thread list embedded in the ThreadList stream.
Expected< const minidump::ExceptionStream & > getExceptionStream (minidump::Directory Directory) const
 Returns the contents of the Exception stream.
Expected< const minidump::ExceptionStream & > getExceptionStream () const
 Returns the first exception stream in the file.
Expected< ArrayRef< minidump::MemoryDescriptor > > getMemoryList () const
 Returns the list of descriptors embedded in the MemoryList stream.
Expected< minidump::Memory64ListHeadergetMemoryList64Header () const
 Returns the header to the memory 64 list stream.
LLVM_ABI iterator_range< ExceptionStreamsIteratorgetExceptionStreams () const
 Returns an iterator that reads each exception stream independently.
LLVM_ABI iterator_range< FallibleMemory64IteratorgetMemory64List (Error &Err) const
 Returns an iterator that pairs each descriptor with it's respective content from the Memory64List stream.
LLVM_ABI Expected< iterator_range< MemoryInfoIterator > > getMemoryInfoList () const
 Returns the list of descriptors embedded in the MemoryInfoList stream.
Public Member Functions inherited from llvm::object::Binary
 Binary ()=delete
 Binary (const Binary &other)=delete
virtual ~Binary ()
virtual Error initContent ()
StringRef getData () const
StringRef getFileName () const
MemoryBufferRef getMemoryBufferRef () const
unsigned int getType () const
bool isObject () const
bool isSymbolic () const
bool isArchive () const
bool isMachOUniversalBinary () const
bool isTapiUniversal () const
bool isELF () const
bool isMachO () const
bool isCOFF () const
bool isXCOFF () const
bool isWasm () const
bool isOffloadFile () const
bool isCOFFImportFile () const
bool isIR () const
bool isGOFF () const
bool isMinidump () const
bool isTapiFile () const
bool isLittleEndian () const
bool isWinRes () const
bool isDXContainer () const
Triple::ObjectFormatType getTripleObjectFormat () const

Static Public Member Functions

static LLVM_ABI Expected< std::unique_ptr< MinidumpFile > > create (MemoryBufferRef Source)
 Construct a new MinidumpFile object from the given memory buffer.
static bool classof (const Binary *B)
Static Public Member Functions inherited from llvm::object::Binary
static Error checkOffset (MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)

Additional Inherited Members

Protected Types inherited from llvm::object::Binary
enum  {
  ID_Archive , ID_MachOUniversalBinary , ID_COFFImportFile , ID_IR ,
  ID_TapiUniversal , ID_TapiFile , ID_Minidump , ID_WinRes ,
  ID_Offload , ID_StartObjects , ID_COFF , ID_XCOFF32 ,
  ID_XCOFF64 , ID_ELF32L , ID_ELF32B , ID_ELF64L ,
  ID_ELF64B , ID_MachO32L , ID_MachO32B , ID_MachO64L ,
  ID_MachO64B , ID_GOFF , ID_Wasm , ID_DXContainer ,
  ID_EndObjects
}
Protected Member Functions inherited from llvm::object::Binary
 Binary (unsigned int Type, MemoryBufferRef Source)
Static Protected Member Functions inherited from llvm::object::Binary
static unsigned int getELFType (bool isLE, bool is64Bits)
static unsigned int getMachOType (bool isLE, bool is64Bits)
Protected Attributes inherited from llvm::object::Binary
MemoryBufferRef Data

Detailed Description

A class providing access to the contents of a minidump file.

Definition at line 25 of file Minidump.h.

Member Typedef Documentation

◆ FallibleMemory64Iterator

Member Function Documentation

◆ classof()

bool llvm::object::MinidumpFile::classof ( const Binary * B)
inlinestatic

Definition at line 33 of file Minidump.h.

References B(), and llvm::object::Binary::Binary().

◆ create()

Expected< std::unique_ptr< MinidumpFile > > MinidumpFile::create ( MemoryBufferRef Source)
static

Construct a new MinidumpFile object from the given memory buffer.

Returns an error if this file cannot be identified as a minidump file, or if its contents are badly corrupted (i.e. we cannot read the stream directory).

Definition at line 91 of file Minidump.cpp.

References llvm::arrayRefFromStringRef(), llvm::object::Binary::Data, llvm::enumerate(), llvm::minidump::Header::MagicSignature, llvm::minidump::Header::MagicVersion, llvm::minidump::Header::NumberOfStreams, llvm::minidump::Header::Signature, llvm::minidump::Header::StreamDirectoryRVA, llvm::Expected< T >::takeError(), llvm::Type::Type(), llvm::minidump::Unused, and llvm::minidump::Header::Version.

Referenced by llvm::object::createBinary().

◆ getExceptionStream() [1/2]

Expected< const minidump::ExceptionStream & > llvm::object::MinidumpFile::getExceptionStream ( ) const
inline

Returns the first exception stream in the file.

An error is returned if the associated stream is smaller than the size of the ExceptionStream structure. Or the directory supplied is not of kind exception stream.

Definition at line 103 of file Minidump.h.

References getExceptionStreams().

◆ getExceptionStream() [2/2]

Expected< const minidump::ExceptionStream & > llvm::object::MinidumpFile::getExceptionStream ( minidump::Directory Directory) const
inline

Returns the contents of the Exception stream.

An error is returned if the associated stream is smaller than the size of the ExceptionStream structure. Or the directory supplied is not of kind exception stream.

Definition at line 92 of file Minidump.h.

References llvm::minidump::Directory::Type.

◆ getExceptionStreams()

iterator_range< llvm::object::MinidumpFile::ExceptionStreamsIterator > MinidumpFile::getExceptionStreams ( ) const

Returns an iterator that reads each exception stream independently.

The contents of the exception strema are not validated before being read, an error will be returned if the stream is not large enough to contain an exception stream, or if the stream points beyond the end of the file.

Definition at line 56 of file Minidump.cpp.

References llvm::make_range().

Referenced by getExceptionStream().

◆ getMemory64List()

iterator_range< MinidumpFile::FallibleMemory64Iterator > MinidumpFile::getMemory64List ( Error & Err) const

Returns an iterator that pairs each descriptor with it's respective content from the Memory64List stream.

An error is returned if the file does not contain a Memory64List stream, or if the descriptor data is unreadable.

Definition at line 147 of file Minidump.cpp.

References llvm::object::MinidumpFile::Memory64Iterator::begin(), llvm::fallible_iterator< Memory64Iterator >::end(), llvm::object::MinidumpFile::Memory64Iterator::end(), llvm::object::Binary::getData(), getMemoryList64Header(), getRawStream(), llvm::fallible_iterator< Memory64Iterator >::itr(), llvm::make_range(), llvm::size(), and llvm::Expected< T >::takeError().

◆ getMemoryInfoList()

Expected< iterator_range< MinidumpFile::MemoryInfoIterator > > MinidumpFile::getMemoryInfoList ( ) const

Returns the list of descriptors embedded in the MemoryInfoList stream.

The descriptors provide properties (e.g. permissions) of interesting regions of memory at the time the minidump was taken. An error is returned if the file does not contain this stream, or if the stream is not large enough to contain the number of memory descriptors declared in the stream header. The consistency of the MemoryInfoList entries themselves is not checked in any way.

Definition at line 62 of file Minidump.cpp.

References llvm::object::Binary::Data, getRawStream(), H, and llvm::make_range().

◆ getMemoryList()

Expected< ArrayRef< minidump::MemoryDescriptor > > llvm::object::MinidumpFile::getMemoryList ( ) const
inline

Returns the list of descriptors embedded in the MemoryList stream.

The descriptors provide the content of interesting regions of memory at the time the minidump was taken. An error is returned if the file does not contain this stream, or if the stream is not large enough to contain the number of memory descriptors declared in the stream header. The consistency of the MemoryDescriptor entries themselves is not checked in any way.

Definition at line 117 of file Minidump.h.

◆ getMemoryList64Header()

Expected< minidump::Memory64ListHeader > llvm::object::MinidumpFile::getMemoryList64Header ( ) const
inline

Returns the header to the memory 64 list stream.

An error is returned if the file does not contain this stream.

Definition at line 124 of file Minidump.h.

Referenced by getMemory64List().

◆ getModuleList()

Expected< ArrayRef< minidump::Module > > llvm::object::MinidumpFile::getModuleList ( ) const
inline

Returns the module list embedded in the ModuleList stream.

An error is returned if the file does not contain this stream, or if the stream is not large enough to contain the number of modules declared in the stream header. The consistency of the Module entries themselves is not checked in any way.

Definition at line 75 of file Minidump.h.

◆ getRawData()

Expected< ArrayRef< uint8_t > > llvm::object::MinidumpFile::getRawData ( minidump::LocationDescriptor Desc) const
inline

Returns the raw contents of an object given by the LocationDescriptor.

An error is returned if the descriptor points outside of the minidump file.

Definition at line 54 of file Minidump.h.

References llvm::object::Binary::getData().

◆ getRawStream() [1/2]

ArrayRef< uint8_t > llvm::object::MinidumpFile::getRawStream ( const minidump::Directory & Stream) const
inline

◆ getRawStream() [2/2]

std::optional< ArrayRef< uint8_t > > MinidumpFile::getRawStream ( minidump::StreamType Type) const

Returns the raw contents of the stream of the given type, or std::nullopt if the file does not contain a stream of this type.

Definition at line 17 of file Minidump.cpp.

References getRawStream().

◆ getString()

Expected< std::string > MinidumpFile::getString ( size_t Offset) const

Returns the minidump string at the given offset.

An error is returned if we fail to parse the string, or the string is invalid UTF16.

Definition at line 24 of file Minidump.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::convertUTF16ToUTF8String(), llvm::copy(), llvm::object::Binary::getData(), llvm::Offset, and Size.

◆ getSystemInfo()

Expected< const minidump::SystemInfo & > llvm::object::MinidumpFile::getSystemInfo ( ) const
inline

Returns the contents of the SystemInfo stream, cast to the appropriate type.

An error is returned if the file does not contain this stream, or the stream is smaller than the size of the SystemInfo structure. The internal consistency of the stream is not checked in any way.

Definition at line 66 of file Minidump.h.

◆ getThreadList()

Expected< ArrayRef< minidump::Thread > > llvm::object::MinidumpFile::getThreadList ( ) const
inline

Returns the thread list embedded in the ThreadList stream.

An error is returned if the file does not contain this stream, or if the stream is not large enough to contain the number of threads declared in the stream header. The consistency of the Thread entries themselves is not checked in any way.

Definition at line 84 of file Minidump.h.

◆ header()

const minidump::Header & llvm::object::MinidumpFile::header ( ) const
inline

Returns the contents of the minidump header.

Definition at line 36 of file Minidump.h.

◆ streams()

ArrayRef< minidump::Directory > llvm::object::MinidumpFile::streams ( ) const
inline

Returns the list of streams (stream directory entries) in this file.

Definition at line 39 of file Minidump.h.


The documentation for this class was generated from the following files: