diff --git a/runtime/actions.cpp b/runtime/actions.cpp index edc1d1f..acdfaf0 100644 --- a/runtime/actions.cpp +++ b/runtime/actions.cpp @@ -3,7 +3,7 @@ auto sliger::rpc::action::RunDebug::perform_action( std::unique_ptr writer, - vm_provider::VmProvider vm) -> void + vm_provider::VmProvider& vm) -> void { auto program = this->instructions; vm.load_and_run(program); @@ -13,12 +13,12 @@ auto sliger::rpc::action::RunDebug::perform_action( auto sliger::rpc::action::FlameGraph::perform_action( std::unique_ptr writer, - vm_provider::VmProvider vm) -> void + vm_provider::VmProvider& vm) -> void { auto json = vm.flame_graph_json(); if (json) { writer->write(std::format( - "{{ \"ok\": true, \"flameGraph\": \"{}\" }}", json.value())); + "{{ \"ok\": true, \"flameGraph\": {} }}", json.value())); } else { writer->write("{ \"ok\": false }"); } @@ -27,12 +27,12 @@ auto sliger::rpc::action::FlameGraph::perform_action( auto sliger::rpc::action::CodeCoverage::perform_action( std::unique_ptr writer, - vm_provider::VmProvider vm) -> void + vm_provider::VmProvider& vm) -> void { auto json = vm.code_coverage_json(); if (json) { writer->write(std::format( - "{{ \"ok\": true, \"codeCoverage\": \"{}\" }}", json.value())); + "{{ \"ok\": true, \"codeCoverage\": {} }}", json.value())); } else { writer->write("{ \"ok\": false }"); } diff --git a/runtime/actions.hpp b/runtime/actions.hpp index 1e722ea..a19ba14 100644 --- a/runtime/actions.hpp +++ b/runtime/actions.hpp @@ -7,7 +7,7 @@ namespace sliger::rpc::action { struct Action { virtual auto perform_action( std::unique_ptr writer, - sliger::rpc::vm_provider::VmProvider vm_provider) -> void = 0; + sliger::rpc::vm_provider::VmProvider& vm_provider) -> void = 0; virtual ~Action() = default; }; @@ -15,14 +15,14 @@ class FlameGraph : public Action { public: FlameGraph() { } auto perform_action(std::unique_ptr writer, - sliger::rpc::vm_provider::VmProvider vm_provider) -> void; + sliger::rpc::vm_provider::VmProvider& vm_provider) -> void; }; class CodeCoverage : public Action { public: CodeCoverage() { } auto perform_action(std::unique_ptr writer, - sliger::rpc::vm_provider::VmProvider vm_provider) -> void; + sliger::rpc::vm_provider::VmProvider& vm_provider) -> void; }; class RunDebug : public Action { @@ -32,7 +32,7 @@ public: { } auto perform_action(std::unique_ptr writer, - sliger::rpc::vm_provider::VmProvider vm_provider) -> void; + sliger::rpc::vm_provider::VmProvider& vm_provider) -> void; private: std::vector instructions; @@ -44,7 +44,7 @@ static auto action_from_json( auto& obj = value->as(); auto type = obj.fields.at("type")->as(); - if (type.value == "flamegraph") { + if (type.value == "flame-graph") { auto action = FlameGraph(); return std::make_unique(action); }