libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
clues::item::CloneFlagsValue Class Reference
+ Inheritance diagram for clues::item::CloneFlagsValue:

Public Member Functions

std::string str () const override
 Returns a human readable string representation of the item.
 
cosmos::CloneFlags flags () const
 
std::optional< cosmos::SignalNr > exitSignal () const
 
- 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 &) 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

cosmos::CloneFlags m_flags
 
std::optional< cosmos::SignalNr > exit_signal
 For clone() 1/2 this contains the child exit signal, which is additionally encoded in the flags.
 
- 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

Definition at line 14 of file clone.hxx.

Constructor & Destructor Documentation

◆ CloneFlagsValue()

clues::item::CloneFlagsValue::CloneFlagsValue ( )
inlineexplicit

Definition at line 18 of file clone.hxx.

18 :
19 SystemCallItem{ItemType::PARAM_IN, "flags", "clone flags"} {
20 }
SystemCallItem(const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
Constructs a new SystemCallItem.
@ PARAM_IN
An input parameter to the system call.

Member Function Documentation

◆ exitSignal()

std::optional< cosmos::SignalNr > clues::item::CloneFlagsValue::exitSignal ( ) const
inline

Definition at line 28 of file clone.hxx.

28 {
29 return exit_signal;
30 }
std::optional< cosmos::SignalNr > exit_signal
For clone() 1/2 this contains the child exit signal, which is additionally encoded in the flags.
Definition clone.hxx:40

◆ flags()

cosmos::CloneFlags clues::item::CloneFlagsValue::flags ( ) const
inline

Definition at line 24 of file clone.hxx.

24 {
25 return m_flags;
26 }

◆ processValue()

void clues::item::CloneFlagsValue::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 59 of file clone.cxx.

59 {
60 if (m_call->callNr() == SystemCallNr::CLONE) {
61 // child exit signal is piggy-backed in the low byte of flags
62 // although clone(2) shows an `int` here, this is a 64-bit flags typetype
63 const auto raw = valueAs<uint64_t>();
64 // CloneFlags are based on uint64_t (type used in clone3()),
65 // thus cast accordingly.
66 m_flags = cosmos::CloneFlags{static_cast<uint64_t>(raw & (~0xFF))};
67 exit_signal.emplace(cosmos::SignalNr{static_cast<int>(raw) & 0xFF});
68 } else {
70 exit_signal.reset();
71 }
72}
const SystemCall * m_call
The system call context this item part of.
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.

◆ str()

std::string clues::item::CloneFlagsValue::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 55 of file clone.cxx.

55 {
56 return clone_flags_str(m_flags, exit_signal);
57}

Member Data Documentation

◆ exit_signal

std::optional<cosmos::SignalNr> clues::item::CloneFlagsValue::exit_signal
protected

For clone() 1/2 this contains the child exit signal, which is additionally encoded in the flags.

Definition at line 40 of file clone.hxx.

◆ m_flags

cosmos::CloneFlags clues::item::CloneFlagsValue::m_flags
protected

Definition at line 38 of file clone.hxx.


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