2024-11-27 12:28:45 +00:00
|
|
|
#include "rpc_server.hpp"
|
2024-12-09 12:03:21 +00:00
|
|
|
#include "vm_provider.hpp"
|
2024-11-27 12:28:45 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace sliger::rpc::action {
|
|
|
|
|
|
|
|
struct Action {
|
2024-12-13 15:11:16 +00:00
|
|
|
virtual auto perform_action(std::unique_ptr<BufferedWriter> writer,
|
2024-12-15 02:07:33 +00:00
|
|
|
VmProvider& vm_provider) -> void = 0;
|
2024-11-27 12:28:45 +00:00
|
|
|
virtual ~Action() = default;
|
|
|
|
};
|
|
|
|
|
2024-12-15 00:32:21 +00:00
|
|
|
class Status : public Action {
|
|
|
|
public:
|
|
|
|
Status() { }
|
|
|
|
auto perform_action(std::unique_ptr<BufferedWriter> writer,
|
2024-12-15 02:07:33 +00:00
|
|
|
VmProvider& vm_provider) -> void;
|
2024-12-15 00:32:21 +00:00
|
|
|
};
|
|
|
|
|
2024-12-09 12:03:21 +00:00
|
|
|
class FlameGraph : public Action {
|
|
|
|
public:
|
|
|
|
FlameGraph() { }
|
2024-12-13 15:11:16 +00:00
|
|
|
auto perform_action(std::unique_ptr<BufferedWriter> writer,
|
2024-12-15 02:07:33 +00:00
|
|
|
VmProvider& vm_provider) -> void;
|
2024-12-09 12:03:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CodeCoverage : public Action {
|
|
|
|
public:
|
|
|
|
CodeCoverage() { }
|
2024-12-13 15:11:16 +00:00
|
|
|
auto perform_action(std::unique_ptr<BufferedWriter> writer,
|
2024-12-15 02:07:33 +00:00
|
|
|
VmProvider& vm_provider) -> void;
|
2024-12-09 12:03:21 +00:00
|
|
|
};
|
|
|
|
|
2024-11-27 12:28:45 +00:00
|
|
|
class RunDebug : public Action {
|
|
|
|
public:
|
|
|
|
RunDebug(std::vector<uint32_t> instructions)
|
|
|
|
: instructions(instructions)
|
|
|
|
{
|
|
|
|
}
|
2024-12-13 15:11:16 +00:00
|
|
|
auto perform_action(std::unique_ptr<BufferedWriter> writer,
|
2024-12-15 02:07:33 +00:00
|
|
|
VmProvider& vm_provider) -> void;
|
2024-11-27 12:28:45 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<uint32_t> instructions;
|
|
|
|
};
|
|
|
|
|
2024-12-13 15:11:16 +00:00
|
|
|
auto action_from_json(const json::Value& value) -> std::unique_ptr<Action>;
|
2024-11-27 12:28:45 +00:00
|
|
|
|
|
|
|
}
|