LLDB  mainline
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::repro::Generator Class Referencefinal

The generator is responsible for the logic needed to generate a reproducer. More...

#include <Reproducer.h>

Collaboration diagram for lldb_private::repro::Generator:
Collaboration graph
[legend]

Public Member Functions

 Generator (FileSpec root)
 
 ~Generator ()
 
void Keep ()
 Method to indicate we want to keep the reproducer. More...
 
void Discard ()
 Method to indicate we do not want to keep the reproducer. More...
 
void SetAutoGenerate (bool b)
 Enable or disable auto generate. More...
 
bool IsAutoGenerate () const
 Return whether auto generate is enabled. More...
 
template<typename T >
T * Create ()
 Create and register a new provider. More...
 
template<typename T >
T * Get ()
 Get an existing provider. More...
 
template<typename T >
T & GetOrCreate ()
 Get a provider if it exists, otherwise create it. More...
 
const FileSpecGetRoot () const
 

Private Member Functions

ProviderBaseRegister (std::unique_ptr< ProviderBase > provider)
 
void AddProvidersToIndex ()
 Builds and index with provider info. More...
 

Private Attributes

friend Reproducer
 
llvm::DenseMap< const void *, std::unique_ptr< ProviderBase > > m_providers
 Map of provider IDs to provider instances. More...
 
std::mutex m_providers_mutex
 
FileSpec m_root
 The reproducer root directory. More...
 
bool m_done = false
 Flag to ensure that we never call both keep and discard. More...
 
bool m_auto_generate = false
 Flag to auto generate a reproducer when it would otherwise be discarded. More...
 

Detailed Description

The generator is responsible for the logic needed to generate a reproducer.

For doing so it relies on providers, who serialize data that is necessary for reproducing a failure.

Definition at line 225 of file Reproducer.h.

Constructor & Destructor Documentation

◆ Generator()

Generator::Generator ( FileSpec  root)

Definition at line 167 of file Reproducer.cpp.

◆ ~Generator()

Generator::~Generator ( )

Definition at line 171 of file Reproducer.cpp.

References Discard(), Keep(), m_auto_generate, and m_done.

Member Function Documentation

◆ AddProvidersToIndex()

void Generator::AddProvidersToIndex ( )
private

Builds and index with provider info.

Definition at line 214 of file Reproducer.cpp.

References lldb_private::FileSpec::AppendPathComponent(), lldb_private::FileSpec::GetPath(), m_providers, and m_root.

Referenced by Keep().

◆ Create()

template<typename T >
T* lldb_private::repro::Generator::Create ( )
inline

Create and register a new provider.

Definition at line 247 of file Reproducer.h.

◆ Discard()

void Generator::Discard ( )

Method to indicate we do not want to keep the reproducer.

This is unaffected by whether or not generation reproduction is enabled, as we might need to clean up files already written to disk.

Definition at line 198 of file Reproducer.cpp.

References lldb_private::FileSpec::GetPath(), m_done, m_providers, and m_root.

Referenced by ~Generator().

◆ Get()

template<typename T >
T* lldb_private::repro::Generator::Get ( )
inline

Get an existing provider.

Definition at line 253 of file Reproducer.h.

◆ GetOrCreate()

template<typename T >
T& lldb_private::repro::Generator::GetOrCreate ( )
inline

Get a provider if it exists, otherwise create it.

Definition at line 261 of file Reproducer.h.

◆ GetRoot()

const FileSpec & Generator::GetRoot ( ) const

Definition at line 212 of file Reproducer.cpp.

References m_root.

◆ IsAutoGenerate()

bool Generator::IsAutoGenerate ( ) const

Return whether auto generate is enabled.

Definition at line 210 of file Reproducer.cpp.

References m_auto_generate.

◆ Keep()

void Generator::Keep ( )

Method to indicate we want to keep the reproducer.

If reproducer generation is disabled, this does nothing.

Definition at line 188 of file Reproducer.cpp.

References AddProvidersToIndex(), m_done, and m_providers.

Referenced by ~Generator().

◆ Register()

ProviderBase * Generator::Register ( std::unique_ptr< ProviderBase provider)
private

Definition at line 180 of file Reproducer.cpp.

References m_providers, and m_providers_mutex.

◆ SetAutoGenerate()

void Generator::SetAutoGenerate ( bool  b)

Enable or disable auto generate.

Definition at line 208 of file Reproducer.cpp.

References m_auto_generate.

Member Data Documentation

◆ m_auto_generate

bool lldb_private::repro::Generator::m_auto_generate = false
private

Flag to auto generate a reproducer when it would otherwise be discarded.

Definition at line 289 of file Reproducer.h.

Referenced by IsAutoGenerate(), SetAutoGenerate(), and ~Generator().

◆ m_done

bool lldb_private::repro::Generator::m_done = false
private

Flag to ensure that we never call both keep and discard.

Definition at line 286 of file Reproducer.h.

Referenced by Discard(), Keep(), and ~Generator().

◆ m_providers

llvm::DenseMap<const void *, std::unique_ptr<ProviderBase> > lldb_private::repro::Generator::m_providers
private

Map of provider IDs to provider instances.

Definition at line 279 of file Reproducer.h.

Referenced by AddProvidersToIndex(), Discard(), Keep(), and Register().

◆ m_providers_mutex

std::mutex lldb_private::repro::Generator::m_providers_mutex
private

Definition at line 280 of file Reproducer.h.

Referenced by Register().

◆ m_root

FileSpec lldb_private::repro::Generator::m_root
private

The reproducer root directory.

Definition at line 283 of file Reproducer.h.

Referenced by AddProvidersToIndex(), Discard(), and GetRoot().

◆ Reproducer

friend lldb_private::repro::Generator::Reproducer
private

Definition at line 271 of file Reproducer.h.


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