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

An always-success return value. More...

#include <error.hxx>

+ Inheritance diagram for clues::item::SuccessResult:

Public Member Functions

 SuccessResult (const std::string_view short_label="success", const std::string_view long_label={})
 
std::string str () const override
 Returns a human readable string representation of the item.
 
bool valid () const
 Checks whether the success value actually is a success value.
 
- Public Member Functions inherited from clues::item::ReturnValue
 ReturnValue (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
 

Additional Inherited Members

- Public Types inherited from clues::SystemCallItem
enum class  Flag { DEFER_FILL = 1 << 0 }
 
using Flags = cosmos::BitMask<Flag>
 
- Protected Member Functions inherited from clues::SystemCallItem
virtual void processValue (const Tracee &)
 Processes the value stored in m_val acc. to the actual item type.
 
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 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.
 

Detailed Description

An always-success return value.

Since errors are reported separately in PTRACE_GET_SYSCALL_INFO, there are a lot of system calls that can otherwise only return 0 as a legit value. This type exists to model this.

Definition at line 14 of file error.hxx.

Constructor & Destructor Documentation

◆ SuccessResult()

clues::item::SuccessResult::SuccessResult ( const std::string_view short_label = "success",
const std::string_view long_label = {} )
inline

Definition at line 17 of file error.hxx.

19 {}) :
20 ReturnValue{short_label, long_label} {
21 }

Member Function Documentation

◆ str()

std::string clues::item::SuccessResult::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 10 of file error.cxx.

10 {
11 if (valid()) {
12 return "0";
13 } else {
14 return cosmos::sprintf("%d (\?\?\?)", valueAs<int>());
15 }
16}
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.
bool valid() const
Checks whether the success value actually is a success value.
Definition error.hxx:30

◆ valid()

bool clues::item::SuccessResult::valid ( ) const
inline

Checks whether the success value actually is a success value.

Should the return value for some reason not be zero, as expected, then this function returns false.,

Definition at line 30 of file error.hxx.

30 {
31 return m_val == Word::ZERO;
32 }
Word m_val
The raw register value for the item.

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