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

Combined mmap() arguments for the old variant of mmap() on 32-bit ABIs like I386. More...

#include <mmap.hxx>

+ Inheritance diagram for clues::item::OldMmapArgs:

Public Member Functions

bool valid () const
 
ForeignPtr addr () const
 
size_t length () const
 
size_t offset () const
 
cosmos::mem::MapType type () const
 
cosmos::mem::MapFlags flags () const
 
cosmos::mem::AccessFlags prot () const
 
cosmos::FileNum fd () const
 
- Public Member Functions inherited from clues::item::PointerInValue
 PointerInValue (const std::string_view short_name, const std::string_view long_name={})
 
- 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 &) override
 Processes the value stored in m_val acc. to the actual item type.
 
std::string str () const override
 Returns a human readable string representation of the item.
 
- 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

bool m_valid = false
 
ForeignPtr m_addr = ForeignPtr::NO_POINTER
 
size_t m_length = 0
 
size_t m_offset = 0
 
cosmos::mem::MapType m_type {0}
 
cosmos::mem::MapFlags m_flags
 
cosmos::mem::AccessFlags m_prot
 
cosmos::FileNum m_fd
 
- 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

Combined mmap() arguments for the old variant of mmap() on 32-bit ABIs like I386.

Definition at line 75 of file mmap.hxx.

Constructor & Destructor Documentation

◆ OldMmapArgs()

clues::item::OldMmapArgs::OldMmapArgs ( )
inlineexplicit

Definition at line 79 of file mmap.hxx.

79 :
80 PointerInValue{"args"} {
81 }

Member Function Documentation

◆ addr()

ForeignPtr clues::item::OldMmapArgs::addr ( ) const
inline

Definition at line 87 of file mmap.hxx.

87 {
88 return m_addr;
89 }

◆ fd()

cosmos::FileNum clues::item::OldMmapArgs::fd ( ) const
inline

Definition at line 111 of file mmap.hxx.

111 {
112 return m_fd;
113 }

◆ flags()

cosmos::mem::MapFlags clues::item::OldMmapArgs::flags ( ) const
inline

Definition at line 103 of file mmap.hxx.

103 {
104 return m_flags;
105 }

◆ length()

size_t clues::item::OldMmapArgs::length ( ) const
inline

Definition at line 91 of file mmap.hxx.

91 {
92 return m_length;
93 }

◆ offset()

size_t clues::item::OldMmapArgs::offset ( ) const
inline

Definition at line 95 of file mmap.hxx.

95 {
96 return m_offset;
97 }

◆ processValue()

void clues::item::OldMmapArgs::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 73 of file mmap.cxx.

73 {
74 struct mmap_arg_struct args;
75
76 if (!proc.readStruct(asPtr(), args)) {
77 m_valid = false;
78 return;
79 }
80
81 m_addr = ForeignPtr{static_cast<uintptr_t>(args.addr)};
82 m_length = args.len;
83 m_offset = args.offset;
84 m_prot = cosmos::mem::AccessFlags{static_cast<int>(args.prot)};
85 m_fd = cosmos::FileNum{static_cast<int>(args.fd)};
86 const auto raw_flags = static_cast<int>(args.flags);
87 m_flags = cosmos::mem::MapFlags{raw_flags & ~0x3};
88 m_type = cosmos::mem::MapType{raw_flags & 0x3};
89
90 m_valid = true;
91}
ForeignPtr
Strongly typed opaque pointer to tracee memory.
Definition types.hxx:140

◆ prot()

cosmos::mem::AccessFlags clues::item::OldMmapArgs::prot ( ) const
inline

Definition at line 107 of file mmap.hxx.

107 {
108 return m_prot;
109 }

◆ str()

std::string clues::item::OldMmapArgs::str ( ) const
overrideprotectedvirtual

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 93 of file mmap.cxx.

93 {
94 auto &mmap_call = dynamic_cast<const MmapSystemCall&>(*m_call);
95
96 std::stringstream ss;
97 ss << "{hint=" << mmap_call.hint.str()
98 << ", length=" << mmap_call.length.str()
99 << ", prot=" << mmap_call.protection.str()
100 << ", flags=" << mmap_call.flags.str()
101 << ", fd=" << mmap_call.fd.str()
102 << ", offset=" << mmap_call.offset.str()
103 << "}";
104
105 return ss.str();
106}

◆ type()

cosmos::mem::MapType clues::item::OldMmapArgs::type ( ) const
inline

Definition at line 99 of file mmap.hxx.

99 {
100 return m_type;
101 }

◆ valid()

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

Definition at line 83 of file mmap.hxx.

83 {
84 return m_valid;
85 }

Member Data Documentation

◆ m_addr

ForeignPtr clues::item::OldMmapArgs::m_addr = ForeignPtr::NO_POINTER
protected

Definition at line 124 of file mmap.hxx.

◆ m_fd

cosmos::FileNum clues::item::OldMmapArgs::m_fd
protected

Definition at line 130 of file mmap.hxx.

◆ m_flags

cosmos::mem::MapFlags clues::item::OldMmapArgs::m_flags
protected

Definition at line 128 of file mmap.hxx.

◆ m_length

size_t clues::item::OldMmapArgs::m_length = 0
protected

Definition at line 125 of file mmap.hxx.

◆ m_offset

size_t clues::item::OldMmapArgs::m_offset = 0
protected

Definition at line 126 of file mmap.hxx.

◆ m_prot

cosmos::mem::AccessFlags clues::item::OldMmapArgs::m_prot
protected

Definition at line 129 of file mmap.hxx.

◆ m_type

cosmos::mem::MapType clues::item::OldMmapArgs::m_type {0}
protected

Definition at line 127 of file mmap.hxx.

127{0};

◆ m_valid

bool clues::item::OldMmapArgs::m_valid = false
protected

Definition at line 123 of file mmap.hxx.


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