CppInterOp
C++ Language Interoperability Layer
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
CppInterOp::Tracing::TraceInfo Class Reference

#include "lib/CppInterOp/Tracing.h"

Public Member Functions

 TraceInfo ()
 
 ~TraceInfo ()
 
 TraceInfo (const TraceInfo &)=delete
 
TraceInfooperator= (const TraceInfo &)=delete
 
 TraceInfo (TraceInfo &&)=delete
 
TraceInfooperator= (TraceInfo &&)=delete
 
llvm::Timer & getTimer (llvm::StringRef Name)
 
bool insideTracedRegion () const
 True when at least one TraceRegion is currently active.
 
void pushTimer (llvm::Timer *T)
 
void popTimer ()
 
std::string getOrRegisterHandle (const void *p)
 
std::string lookupHandle (const void *p)
 Resolve a pointer to a printable form.
 
unsigned nextRetIndex ()
 Allocate the next _retN index for a vector-return placeholder.
 
std::pair< unsigned, bool > outIndexFor (const void *Addr)
 Resolve an OUT-container source address to its _outN index.
 
size_t appendToLog (const std::string &line)
 Append a line; the returned index pairs with setLogEntry to rewrite the same slot later (TraceRegion's placeholder pattern).
 
void setLogEntry (size_t idx, const std::string &line)
 
void setDumping (bool v)
 
const std::vector< std::string > & getLog () const
 
std::string getLastLogEntry () const
 
std::string writeToFile (const std::string &Version="")
 Write the accumulated reproducer log to a file.
 
std::string StartRegion (bool WriteOnStdErr=true)
 Begin a traced region.
 
void StopRegion (const std::string &Version="")
 End the traced region and write only the region's entries to the file.
 
void clear ()
 

Static Public Member Functions

static bool isEnabled ()
 

Detailed Description

Definition at line 57 of file Tracing.h.

Constructor & Destructor Documentation

◆ TraceInfo() [1/3]

CppInterOp::Tracing::TraceInfo::TraceInfo ( )
inline

Definition at line 86 of file Tracing.h.

◆ ~TraceInfo()

CppInterOp::Tracing::TraceInfo::~TraceInfo ( )
inline

Definition at line 87 of file Tracing.h.

References CppInterOp::Tracing::TheTraceInfo.

◆ TraceInfo() [2/3]

CppInterOp::Tracing::TraceInfo::TraceInfo ( const TraceInfo )
delete

◆ TraceInfo() [3/3]

CppInterOp::Tracing::TraceInfo::TraceInfo ( TraceInfo &&  )
delete

Member Function Documentation

◆ appendToLog()

size_t CppInterOp::Tracing::TraceInfo::appendToLog ( const std::string &  line)
inline

Append a line; the returned index pairs with setLogEntry to rewrite the same slot later (TraceRegion's placeholder pattern).

Definition at line 164 of file Tracing.h.

Referenced by CppInterOp::Tracing::MakeOutParam().

◆ clear()

void CppInterOp::Tracing::TraceInfo::clear ( )
inline

Definition at line 200 of file Tracing.h.

◆ getLastLogEntry()

std::string CppInterOp::Tracing::TraceInfo::getLastLogEntry ( ) const
inline

Definition at line 180 of file Tracing.h.

◆ getLog()

const std::vector< std::string > & CppInterOp::Tracing::TraceInfo::getLog ( ) const
inline

Definition at line 179 of file Tracing.h.

◆ getOrRegisterHandle()

std::string CppInterOp::Tracing::TraceInfo::getOrRegisterHandle ( const void *  p)
inline

Definition at line 121 of file Tracing.h.

Referenced by CppInterOp::Tracing::MakeOutParam().

◆ getTimer()

llvm::Timer & CppInterOp::Tracing::TraceInfo::getTimer ( llvm::StringRef  Name)
inline

Definition at line 95 of file Tracing.h.

◆ insideTracedRegion()

bool CppInterOp::Tracing::TraceInfo::insideTracedRegion ( ) const
inline

True when at least one TraceRegion is currently active.

Definition at line 103 of file Tracing.h.

◆ isEnabled()

static bool CppInterOp::Tracing::TraceInfo::isEnabled ( )
inlinestatic

Definition at line 93 of file Tracing.h.

References CppInterOp::Tracing::TheTraceInfo.

◆ lookupHandle()

std::string CppInterOp::Tracing::TraceInfo::lookupHandle ( const void *  p)
inline

Resolve a pointer to a printable form.

  • "nullptr" for an actual null pointer.
  • "vN" for a pointer registered via getOrRegisterHandle.
  • "" (empty) for a non-null pointer never seen by the tracer – the caller decides how to render the unknown case (e.g. nullptr /*unknown*&zwj;/ in argument lists, "is this new?" in the producer-side auto vN = ... gating logic).

Definition at line 137 of file Tracing.h.

Referenced by CppInterOp::Tracing::ReproBuffer::append(), and CppInterOp::Tracing::MakeOutParam().

◆ nextRetIndex()

unsigned CppInterOp::Tracing::TraceInfo::nextRetIndex ( )
inline

Allocate the next _retN index for a vector-return placeholder.

Definition at line 145 of file Tracing.h.

◆ operator=() [1/2]

TraceInfo & CppInterOp::Tracing::TraceInfo::operator= ( const TraceInfo )
delete

◆ operator=() [2/2]

TraceInfo & CppInterOp::Tracing::TraceInfo::operator= ( TraceInfo &&  )
delete

◆ outIndexFor()

std::pair< unsigned, bool > CppInterOp::Tracing::TraceInfo::outIndexFor ( const void *  Addr)
inline

Resolve an OUT-container source address to its _outN index.

First call with a given address allocates a fresh slot; later calls return the same slot so the reproducer reuses the buffer.

Precondition
Addr is non-null (MakeOutParam captures &C).
Returns
{idx, true} on first use, {idx, false} on alias.

Definition at line 152 of file Tracing.h.

◆ popTimer()

void CppInterOp::Tracing::TraceInfo::popTimer ( )
inline

Definition at line 112 of file Tracing.h.

◆ pushTimer()

void CppInterOp::Tracing::TraceInfo::pushTimer ( llvm::Timer *  T)
inline

Definition at line 105 of file Tracing.h.

◆ setDumping()

void CppInterOp::Tracing::TraceInfo::setDumping ( bool  v)
inline

Definition at line 178 of file Tracing.h.

◆ setLogEntry()

void CppInterOp::Tracing::TraceInfo::setLogEntry ( size_t  idx,
const std::string &  line 
)
inline

Definition at line 173 of file Tracing.h.

◆ StartRegion()

std::string CppInterOp::Tracing::TraceInfo::StartRegion ( bool  WriteOnStdErr = true)

Begin a traced region.

Returns the path where StopTracing will write.

Parameters
WriteOnStdErrif true, also emit the reproducer to stderr.

Definition at line 223 of file Tracing.cpp.

Referenced by CppInterOp::Tracing::StartTracing().

◆ StopRegion()

void CppInterOp::Tracing::TraceInfo::StopRegion ( const std::string &  Version = "")

End the traced region and write only the region's entries to the file.

Definition at line 247 of file Tracing.cpp.

References Cpp::GetVersion(), and CppInterOp::Tracing::WriteReproducerPrologue().

Referenced by CppInterOp::Tracing::StopTracing().

◆ writeToFile()

std::string CppInterOp::Tracing::TraceInfo::writeToFile ( const std::string &  Version = "")

Write the accumulated reproducer log to a file.

Parameters
Versionoptional version string embedded as comments.

Definition at line 196 of file Tracing.cpp.

References Cpp::GetVersion(), and CppInterOp::Tracing::WriteReproducerPrologue().

Referenced by Cpp::DefaultProcessCrashHandler().


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