LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
lldb_private::UnixSignals Class Reference

#include <UnixSignals.h>

Inheritance diagram for lldb_private::UnixSignals:
Inheritance graph
[legend]

Classes

struct  Signal
 
struct  SignalCode
 

Public Types

enum  SignalCodePrintOption { None , Address , Bounds }
 

Public Member Functions

 UnixSignals ()
 
virtual ~UnixSignals ()
 
llvm::StringRef GetSignalAsStringRef (int32_t signo) const
 
std::string GetSignalDescription (int32_t signo, std::optional< int32_t > code=std::nullopt, std::optional< lldb::addr_t > addr=std::nullopt, std::optional< lldb::addr_t > lower=std::nullopt, std::optional< lldb::addr_t > upper=std::nullopt) const
 
bool SignalIsValid (int32_t signo) const
 
int32_t GetSignalNumberFromName (const char *name) const
 
bool GetSignalInfo (int32_t signo, bool &should_suppress, bool &should_stop, bool &should_notify) const
 Gets the information for a particular signal.
 
bool GetShouldSuppress (int32_t signo) const
 
bool SetShouldSuppress (int32_t signo, bool value)
 
bool SetShouldSuppress (const char *signal_name, bool value)
 
bool GetShouldStop (int32_t signo) const
 
bool SetShouldStop (int32_t signo, bool value)
 
bool SetShouldStop (const char *signal_name, bool value)
 
bool GetShouldNotify (int32_t signo) const
 
bool SetShouldNotify (int32_t signo, bool value)
 
bool SetShouldNotify (const char *signal_name, bool value)
 
bool ResetSignal (int32_t signo, bool reset_stop=true, bool reset_notify=true, bool reset_suppress=true)
 
int32_t GetFirstSignalNumber () const
 
int32_t GetNextSignalNumber (int32_t current_signal) const
 
int32_t GetNumSignals () const
 
int32_t GetSignalAtIndex (int32_t index) const
 
void AddSignal (int signo, llvm::StringRef name, bool default_suppress, bool default_stop, bool default_notify, llvm::StringRef description, llvm::StringRef alias=llvm::StringRef())
 
void AddSignalCode (int signo, int code, const llvm::StringLiteral description, SignalCodePrintOption print_option=SignalCodePrintOption::None)
 
void RemoveSignal (int signo)
 
void IncrementSignalHitCount (int signo)
 Track how many times signals are hit as stop reasons.
 
llvm::json::Value GetHitCountStatistics () const
 Get the hit count statistics for signals.
 
uint64_t GetVersion () const
 
std::vector< int32_t > GetFilteredSignals (std::optional< bool > should_suppress, std::optional< bool > should_stop, std::optional< bool > should_notify)
 

Static Public Member Functions

static lldb::UnixSignalsSP Create (const ArchSpec &arch)
 
static lldb::UnixSignalsSP CreateForHost ()
 

Protected Types

typedef std::map< int32_t, Signalcollection
 

Protected Member Functions

llvm::StringRef GetShortName (llvm::StringRef name) const
 
virtual void Reset ()
 
 UnixSignals (const UnixSignals &rhs)
 
const UnixSignalsoperator= (const UnixSignals &rhs)=delete
 

Protected Attributes

collection m_signals
 
uint64_t m_version = 0
 

Detailed Description

Definition at line 22 of file UnixSignals.h.

Member Typedef Documentation

◆ collection

typedef std::map<int32_t, Signal> lldb_private::UnixSignals::collection
protected

Definition at line 173 of file UnixSignals.h.

Member Enumeration Documentation

◆ SignalCodePrintOption

Enumerator
None 
Address 
Bounds 

Definition at line 108 of file UnixSignals.h.

Constructor & Destructor Documentation

◆ UnixSignals() [1/2]

UnixSignals::UnixSignals ( )

Definition at line 51 of file UnixSignals.cpp.

References Reset().

◆ ~UnixSignals()

UnixSignals::~UnixSignals ( )
virtualdefault

◆ UnixSignals() [2/2]

UnixSignals::UnixSignals ( const UnixSignals rhs)
protected

Definition at line 53 of file UnixSignals.cpp.

Member Function Documentation

◆ AddSignal()

void UnixSignals::AddSignal ( int  signo,
llvm::StringRef  name,
bool  default_suppress,
bool  default_stop,
bool  default_notify,
llvm::StringRef  description,
llvm::StringRef  alias = llvm::StringRef() 
)

◆ AddSignalCode()

void UnixSignals::AddSignalCode ( int  signo,
int  code,
const llvm::StringLiteral  description,
SignalCodePrintOption  print_option = SignalCodePrintOption::None 
)

Definition at line 113 of file UnixSignals.cpp.

References m_signals, and m_version.

◆ Create()

lldb::UnixSignalsSP UnixSignals::Create ( const ArchSpec arch)
static

◆ CreateForHost()

lldb::UnixSignalsSP UnixSignals::CreateForHost ( )
static

◆ GetFilteredSignals()

std::vector< int32_t > UnixSignals::GetFilteredSignals ( std::optional< bool >  should_suppress,
std::optional< bool >  should_stop,
std::optional< bool >  should_notify 
)

◆ GetFirstSignalNumber()

int32_t UnixSignals::GetFirstSignalNumber ( ) const

Definition at line 215 of file UnixSignals.cpp.

References LLDB_INVALID_SIGNAL_NUMBER, and m_signals.

Referenced by GetFilteredSignals().

◆ GetHitCountStatistics()

json::Value UnixSignals::GetHitCountStatistics ( ) const

Get the hit count statistics for signals.

Gettings statistics on the hit counts of signals can help explain why some debug sessions are slow since each stop takes a few hundred ms and some software use signals a lot and can cause slow debugging performance if they are used too often. Even if a signal is not stopped at, it will auto continue the process and a delay will happen.

Definition at line 370 of file UnixSignals.cpp.

References m_signals.

◆ GetNextSignalNumber()

int32_t UnixSignals::GetNextSignalNumber ( int32_t  current_signal) const

Definition at line 222 of file UnixSignals.cpp.

References LLDB_INVALID_SIGNAL_NUMBER, and m_signals.

Referenced by GetFilteredSignals().

◆ GetNumSignals()

int32_t UnixSignals::GetNumSignals ( ) const

Definition at line 321 of file UnixSignals.cpp.

References m_signals.

◆ GetShortName()

llvm::StringRef UnixSignals::GetShortName ( llvm::StringRef  name) const
protected

Definition at line 194 of file UnixSignals.cpp.

Referenced by GetSignalNumberFromName().

◆ GetShouldNotify()

bool UnixSignals::GetShouldNotify ( int32_t  signo) const

Definition at line 297 of file UnixSignals.cpp.

References m_signals.

◆ GetShouldStop()

bool UnixSignals::GetShouldStop ( int32_t  signo) const

Definition at line 273 of file UnixSignals.cpp.

References m_signals.

◆ GetShouldSuppress()

bool UnixSignals::GetShouldSuppress ( int32_t  signo) const

Definition at line 249 of file UnixSignals.cpp.

References m_signals.

◆ GetSignalAsStringRef()

llvm::StringRef UnixSignals::GetSignalAsStringRef ( int32_t  signo) const

Definition at line 131 of file UnixSignals.cpp.

References m_signals.

◆ GetSignalAtIndex()

int32_t UnixSignals::GetSignalAtIndex ( int32_t  index) const

Definition at line 323 of file UnixSignals.cpp.

References LLDB_INVALID_SIGNAL_NUMBER, and m_signals.

◆ GetSignalDescription()

std::string UnixSignals::GetSignalDescription ( int32_t  signo,
std::optional< int32_t >  code = std::nullopt,
std::optional< lldb::addr_t addr = std::nullopt,
std::optional< lldb::addr_t lower = std::nullopt,
std::optional< lldb::addr_t upper = std::nullopt 
) const

◆ GetSignalInfo()

bool UnixSignals::GetSignalInfo ( int32_t  signo,
bool &  should_suppress,
bool &  should_stop,
bool &  should_notify 
) const

Gets the information for a particular signal.

GetSignalInfo takes a signal number and populates 3 out parameters describing how lldb should react when a particular signal is received in the inferior.

Parameters
[in]signoThe signal number to get information about.
[out]should_suppressShould we suppress this signal?
[out]should_stopShould we stop if this signal is received?
[out]should_notifyShould we notify the user if this signal is received?
Returns
Returns a boolean value. Returns true if the out parameters were successfully populated, false otherwise.

Definition at line 236 of file UnixSignals.cpp.

References lldb_private::UnixSignals::Signal::m_notify, m_signals, lldb_private::UnixSignals::Signal::m_stop, and lldb_private::UnixSignals::Signal::m_suppress.

Referenced by GetFilteredSignals().

◆ GetSignalNumberFromName()

int32_t UnixSignals::GetSignalNumberFromName ( const char *  name) const

◆ GetVersion()

uint64_t UnixSignals::GetVersion ( ) const

Definition at line 331 of file UnixSignals.cpp.

References m_version.

◆ IncrementSignalHitCount()

void UnixSignals::IncrementSignalHitCount ( int  signo)

Track how many times signals are hit as stop reasons.

Definition at line 364 of file UnixSignals.cpp.

References m_signals.

◆ operator=()

const UnixSignals & lldb_private::UnixSignals::operator= ( const UnixSignals rhs)
protecteddelete

◆ RemoveSignal()

void UnixSignals::RemoveSignal ( int  signo)

Definition at line 124 of file UnixSignals.cpp.

References m_signals, and m_version.

◆ Reset()

void UnixSignals::Reset ( )
protectedvirtual

◆ ResetSignal()

bool UnixSignals::ResetSignal ( int32_t  signo,
bool  reset_stop = true,
bool  reset_notify = true,
bool  reset_suppress = true 
)

Definition at line 390 of file UnixSignals.cpp.

References m_signals.

◆ SetShouldNotify() [1/2]

bool UnixSignals::SetShouldNotify ( const char *  signal_name,
bool  value 
)

◆ SetShouldNotify() [2/2]

bool lldb_private::UnixSignals::SetShouldNotify ( int32_t  signo,
bool  value 
)

Referenced by SetShouldNotify().

◆ SetShouldStop() [1/2]

bool UnixSignals::SetShouldStop ( const char *  signal_name,
bool  value 
)

◆ SetShouldStop() [2/2]

bool lldb_private::UnixSignals::SetShouldStop ( int32_t  signo,
bool  value 
)

Referenced by SetShouldStop().

◆ SetShouldSuppress() [1/2]

bool UnixSignals::SetShouldSuppress ( const char *  signal_name,
bool  value 
)

◆ SetShouldSuppress() [2/2]

bool lldb_private::UnixSignals::SetShouldSuppress ( int32_t  signo,
bool  value 
)

Referenced by SetShouldSuppress().

◆ SignalIsValid()

bool UnixSignals::SignalIsValid ( int32_t  signo) const

Definition at line 190 of file UnixSignals.cpp.

References m_signals.

Member Data Documentation

◆ m_signals

collection lldb_private::UnixSignals::m_signals
protected

◆ m_version

uint64_t lldb_private::UnixSignals::m_version = 0
protected

Definition at line 181 of file UnixSignals.h.

Referenced by AddSignal(), AddSignalCode(), GetVersion(), and RemoveSignal().


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