libclues
Linux C++ Tracing Library
Loading...
Searching...
No Matches
strings.hxx
1#pragma once
2
3// clues
4#include <clues/items/items.hxx>
5#include <clues/SystemCallItem.hxx>
6
7namespace clues::item {
8
10class CLUES_API StringData :
11 public SystemCallItem {
12public: // functions
13 explicit StringData(
14 const std::string_view short_name = "string",
15 const std::string_view long_name = {},
16 const ItemType type = ItemType::PARAM_IN) :
17 SystemCallItem{type, short_name, long_name} {
18 }
19
20 std::string str() const override;
21
23 const std::optional<std::string>& data() const {
24 return m_str;
25 }
26
27protected: // functions
28
29 void processValue(const Tracee &proc) override {
30 if (!this->isOut()) {
31 fetch(proc);
32 }
33 }
34
35 void updateData(const Tracee &proc) override {
36 fetch(proc);
37 }
38
39
40 void fetch(const Tracee &);
41
42protected: // data
43
44 std::optional<std::string> m_str;
45};
46
48
51class CLUES_API StringArrayData :
52 public PointerInValue {
53public: // functions
54
55 explicit StringArrayData(
56 const std::string_view short_name = "string-array",
57 const std::string_view long_name = {}) :
58 PointerInValue{short_name, long_name} {
59 }
60
61 std::string str() const override;
62
64 const auto& data() const {
65 return m_strs;
66 }
67
68protected: // functions
69
70 void processValue(const Tracee &proc) override;
71
72 template <typename PTR>
73 void fetchPointers(const Tracee &proc);
74
75protected: // functions
76
77 std::vector<std::string> m_strs;
78};
79
80} // end ns
SystemCallItem(const ItemType type, const std::string_view short_name={}, const std::string_view long_name={})
Constructs a new SystemCallItem.
Base class for traced processes.
Definition Tracee.hxx:39
const auto & data() const
Returns the unmodified string array data as a std::vector.
Definition strings.hxx:64
std::string str() const override
Returns a human readable string representation of the item.
Definition strings.cxx:59
void processValue(const Tracee &proc) override
Processes the value stored in m_val acc. to the actual item type.
Definition strings.hxx:29
const std::optional< std::string > & data() const
Returns the unmodified string data.
Definition strings.hxx:23
std::string str() const override
Returns a human readable string representation of the item.
Definition strings.cxx:10
void updateData(const Tracee &proc) override
Called upon exit of the system call to update possible out parameters.
Definition strings.hxx:35
ItemType
Basic type of a SystemCallItem.
@ PARAM_IN
An input parameter to the system call.