2#include <cosmos/formatting.hxx>
5#include <clues/items/strings.hxx>
6#include <clues/Tracee.hxx>
13 }
else if (m_str->empty()) {
16 return cosmos::sprintf(
"\"%s\"", m_str->c_str());
20void StringData::fetch(
const Tracee &proc) {
21 m_str.emplace(std::string{});
31 if (
m_call->is32BitEmulationABI()) {
34 fetchPointers<uint32_t>(proc);
38 fetchPointers<uintptr_t>(proc);
41template <
typename PTR>
42void StringArrayData::fetchPointers(
const Tracee &proc) {
43 const auto array_start = asPtr();
44 std::vector<PTR> string_addrs;
47 if (array_start == ForeignPtr::NO_POINTER)
53 for (
const auto &addr: string_addrs) {
54 m_strs.push_back(std::string{});
73 for (
const auto &
str: m_strs) {
80 ret.erase(ret.size() - 2);
const SystemCall * m_call
The system call context this item part of.
bool isZero() const
Returns whether the parameter is set to 0 / NULL.
Base class for traced processes.
void readVector(const ForeignPtr pointer, VECTOR &out) const
Reads in a zero terminated array of data items into the STL-vector like parameter out.
void readString(const ForeignPtr addr, std::string &out) const
Reads a zero-terminated C-string from the tracee.
void processValue(const Tracee &proc) 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.
ForeignPtr
Strongly typed opaque pointer to tracee memory.