libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
clues::item::SigSetParameter Class Reference

A set of POSIX signals for setting or masking in the context of various system calls. More...

#include <signal.hxx>

+ Inheritance diagram for clues::item::SigSetParameter:

Public Member Functions

 SigSetParameter (const ItemType type=ItemType::PARAM_IN, const std::string_view short_name="sigset", const std::string_view name="signal set")
 
std::string str () const override
 Returns a human readable string representation of the item.
 
const std::optional< cosmos::SigSet > & sigset () const
 
- Public Member Functions inherited from clues::item::PointerValue
 PointerValue (const ItemType type, const std::string_view short_name, const std::string_view long_name)
 
- Public Member Functions inherited from clues::SystemCallItem
 SystemCallItem (const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
 Constructs a new SystemCallItem.
 
auto type () const
 
bool isIn () const
 
bool isOut () const
 
bool isInOut () const
 
bool isReturnValue () const
 
void fill (const Tracee &proc, const Word word)
 Fills the item from the given register data.
 
bool needsUpdate () const
 Returns whether the item needs to be updated after the system call is finished.
 
std::string_view shortName () const
 Returns the friendly short name for this item.
 
std::string_view longName () const
 Returns the friendly long name for this item, if available, else the short name.
 
auto hasLongName () const
 
bool isZero () const
 Returns whether the parameter is set to 0 / NULL.
 
Word value () const
 Returns the currently stored raw value of the item.
 
template<typename OTHER>
OTHER valueAs () const
 Helper to cast the strongly typed Word m_val to other strong enum types.
 
ForeignPtr asPtr () const
 
Flags flags () const
 
bool deferFill () const
 

Protected Member Functions

void processValue (const Tracee &proc) override
 Processes the value stored in m_val acc. to the actual item type.
 
- Protected Member Functions inherited from clues::SystemCallItem
virtual void updateData (const Tracee &t)
 Called upon exit of the system call to update possible out parameters.
 
void setSystemCall (const SystemCall &sc)
 Sets the system call context this item is a part of.
 

Protected Attributes

std::optional< cosmos::SigSet > m_sigset
 
- Protected Attributes inherited from clues::SystemCallItem
const SystemCallm_call = nullptr
 The system call context this item part of.
 
const ItemType m_type
 The type of item.
 
std::string_view m_short_name
 A human readable short name for the item, should be one word only.
 
std::string_view m_long_name
 A human readable longer name for the item.
 
Word m_val
 The raw register value for the item.
 
Flags m_flags
 Flags influencing the processing of the item.
 

Additional Inherited Members

- Public Types inherited from clues::SystemCallItem
enum class  Flag { DEFER_FILL = 1 << 0 }
 
using Flags = cosmos::BitMask<Flag>
 

Detailed Description

A set of POSIX signals for setting or masking in the context of various system calls.

Definition at line 101 of file signal.hxx.

Constructor & Destructor Documentation

◆ SigSetParameter()

clues::item::SigSetParameter::SigSetParameter ( const ItemType type = ItemType::PARAM_IN,
const std::string_view short_name = "sigset",
const std::string_view name = "signal set" )
inlineexplicit

Definition at line 105 of file signal.hxx.

107 :
108 PointerValue{type, short_name, name} {
109 }

Member Function Documentation

◆ processValue()

void clues::item::SigSetParameter::processValue ( const Tracee & )
overrideprotectedvirtual

Processes the value stored in m_val acc. to the actual item type.

This function is called for all parameter types upon entry to a system call, and for ItemType::RETVAL upon exit from a system call.

For parameters of ItemType::PARAM_OUT this callback can be used to reset any stored data to be filled in later when updateData() is called.

Reimplemented from clues::SystemCallItem.

Definition at line 149 of file signal.cxx.

149 {
150 if (proc.isEnterStop() && isOut()) {
151 m_sigset.reset();
152 return;
153 }
154
155 if (!m_sigset) {
156 m_sigset = cosmos::SigSet{};
157 }
158
159 if (m_call->callNr() == SystemCallNr::SIGPROCMASK) {
160 uint32_t mask;
161 /* legacy i386 sigprocmask() using a 32-bit sigset_t */
162 if (!proc.readStruct(asPtr(), mask)) {
163 m_sigset.reset();
164 return;
165 }
166
167 m_sigset->raw()->__val[0] = mask;
168 } else {
169 if (!proc.readStruct(asPtr(), *m_sigset->raw())) {
170 m_sigset.reset();
171 return;
172 }
173 }
174}
const SystemCall * m_call
The system call context this item part of.

◆ sigset()

const std::optional< cosmos::SigSet > & clues::item::SigSetParameter::sigset ( ) const
inline

Definition at line 113 of file signal.hxx.

113 {
114 return m_sigset;
115 }

◆ str()

std::string clues::item::SigSetParameter::str ( ) const
overridevirtual

Returns a human readable string representation of the item.

This member function should be specialized in derived classes to output the item's data in a fashion suitable for the concrete item type.

Reimplemented from clues::SystemCallItem.

Definition at line 176 of file signal.cxx.

176 {
177 if (m_sigset) {
178 return format::signal_set(*m_sigset);
179 } else {
180 return "NULL";
181 }
182}

Member Data Documentation

◆ m_sigset

std::optional<cosmos::SigSet> clues::item::SigSetParameter::m_sigset
protected

Definition at line 123 of file signal.hxx.


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