7#include <clues/SystemCallItem.hxx>
13namespace clues::item {
19 explicit ReturnValue(
const std::string_view short_name,
const std::string_view long_name = {}) :
37 explicit ValueParameter(
39 const std::string_view short_name,
40 const std::string_view long_name = {}) :
46class ValueInParameter :
47 public ValueParameter {
50 explicit ValueInParameter(
51 const std::string_view short_name,
52 const std::string_view long_name = {}) :
58class ValueOutParameter :
59 public ValueParameter {
62 explicit ValueOutParameter(
63 const std::string_view short_name,
64 const std::string_view long_name) :
80 explicit PointerValue(
82 const std::string_view short_name,
83 const std::string_view long_name) :
94class PointerOutValue :
98 explicit PointerOutValue(
99 const std::string_view short_name,
100 const std::string_view long_name = {},
102 PointerValue{type, short_name, long_name} {
112class PointerInValue :
113 public PointerValue {
116 explicit PointerInValue(
117 const std::string_view short_name,
118 const std::string_view long_name = {}) :
123class CLUES_API GenericPointerValue :
124 public PointerValue {
127 explicit GenericPointerValue(
128 const std::string_view short_name,
129 const std::string_view long_name = {},
131 PointerValue{type, short_name, long_name} {
134 std::string
str()
const override;
152class CLUES_API BufferPointer :
153 public PointerValue {
156 explicit BufferPointer(
159 const std::string_view short_name,
160 const std::string_view long_name = {}) :
161 PointerValue{type, short_name, long_name},
162 m_size_par{size_par} {
172 const auto& data()
const {
187 std::string
str()
const override;
194 void fillBuffer(
const Tracee &);
199 std::vector<uint8_t> m_data;
207template <
typename INT>
208class CLUES_API PointerToScalar :
209 public PointerValue {
212 explicit PointerToScalar(
213 const std::string_view short_name,
214 const std::string_view long_name = {},
216 PointerValue{type, short_name, long_name} {
223 std::optional<INT> value()
const {
227 std::string
str()
const override;
229 void setBase(
const Base base) {
238 if (isIn() || isInOut()) {
251 void fetchValue(
const Tracee &tracee);
253 virtual std::string scalarToString()
const;
258 std::optional<INT> m_val;
259 Base m_base = Base::DEC;
263template <
typename INT>
264class CLUES_API IntValueT :
265 public ValueParameter {
269 const std::string_view short_name,
270 const std::string_view long_name = {},
272 ValueParameter{type, short_name, long_name} {
279 std::string
str()
const override;
281 void setBase(
const Base base) {
294 Base m_base = Base::DEC;
297using IntValue = IntValueT<int>;
298using UintValue = IntValueT<unsigned int>;
299using Uint32Value = IntValueT<uint32_t>;
300using ULongValue = IntValueT<unsigned long>;
301using SizeValue = IntValueT<size_t>;
302using OffsetValue = IntValueT<off_t>;
314 return &item == &unused;
319 public ValueInParameter {
322 ValueInParameter{
"unknown"} {
325 std::string
str()
const override {
326 return "<yet unsupported system call>";
Base class for any kind of system call parameter or return value.
bool needsUpdate() const
Returns whether the item needs to be updated after the system call is finished.
Flags m_flags
Flags influencing the processing of the item.
OTHER valueAs() const
Helper to cast the strongly typed Word m_val to other strong enum types.
SystemCallItem(const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
Constructs a new SystemCallItem.
@ DEFER_FILL
Only fill in this item after all other items have been filled.
Base class for traced processes.
std::string str() const override
Returns a human readable string representation of the item.
size_t availableBytes() const
Returns the actual number of input bytes available in the Tracee.
void updateData(const Tracee &) override
Called upon exit of the system call to update possible out parameters.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
void updateData(const Tracee &) override
Called upon exit of the system call to update possible out parameters.
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.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &) override
Processes the value stored in m_val acc. to the actual item type.
void updateData(const Tracee &tracee) override
Called upon exit of the system call to update possible out parameters.
std::string str() const override
Returns a human readable string representation of the item.
void processValue(const Tracee &tracee) override
Processes the value stored in m_val acc. to the actual item type.
ItemType
Basic type of a SystemCallItem.
@ PARAM_OUT
An output parameter filled by in by the system call.
@ PARAM_IN
An input parameter to the system call.
@ RETVAL
A system call return value.
Base
Integer number display base for formatting purposes.
ForeignPtr
Strongly typed opaque pointer to tracee memory.
std::string str() const override
Returns a human readable string representation of the item.