Native VBS and CMake builds of the server and every registered suite: protocol and document sync, VBS/compdb providers, stock GCC diagnostics (including in-process default profile preparation), the stock occurrence observer and hover/definition, the bounded Scheduler, C++ module graph, scan and artifact cache with real CMI production, the context-aware symbol index with schema-2 snapshot migration, navigation and guarded rename, reflection provenance with splice-origin extraction, index-backed completion and signature help, live GCC worker control with a registered DAP suite, and the Neovim and VS Code clients. VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced from the versioned patches and verified stepping reflection/template code with projected values 17/34 and 41/82.
80 lines
3.0 KiB
C++
80 lines
3.0 KiB
C++
// Scripted private-compiler worker for the LiveSession suite. It speaks the
|
|
// same notice/control protocol as vls_gcc_probe without running a compiler.
|
|
#include <chrono>
|
|
#include <filesystem>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
namespace {
|
|
constexpr std::string_view nonce = "0123456789abcdef0123456789abcdef";
|
|
|
|
void notice(const std::string &line) { std::cout << line << '\n' << std::flush; }
|
|
|
|
void stopped(unsigned sequence) {
|
|
notice(R"({"kind":"stopped","nonce":")" + std::string{nonce} + R"(","stop":)" +
|
|
std::to_string(sequence) + "}");
|
|
}
|
|
|
|
void finished(std::string_view outcome) {
|
|
notice(R"({"kind":"finished","nonce":")" + std::string{nonce} + R"(","outcome":")" +
|
|
std::string{outcome} + R"(","exitCode":0,"reason":""})");
|
|
}
|
|
} // namespace
|
|
|
|
int main(int argc, char **argv) {
|
|
if (argc < 6 || std::string_view(argv[1]) != "run")
|
|
return 2;
|
|
const std::string scenario = std::filesystem::path(argv[4]).filename().string();
|
|
notice(R"({"kind":"started","nonce":")" + std::string{nonce} + R"(","pid":1})");
|
|
if (scenario == "silent.cpp") {
|
|
std::this_thread::sleep_for(std::chrono::seconds(60));
|
|
return 0;
|
|
}
|
|
if (scenario == "malformed.cpp") {
|
|
std::cout << std::string(70000, 'x') << '\n' << std::flush;
|
|
return 0;
|
|
}
|
|
unsigned sequence = 1;
|
|
stopped(sequence);
|
|
std::string line;
|
|
while (std::getline(std::cin, line)) {
|
|
std::istringstream fields{line};
|
|
std::string received, action;
|
|
unsigned requested = 0;
|
|
fields >> received >> requested >> action;
|
|
if (received != nonce) {
|
|
notice(R"({"kind":"rejected"})");
|
|
continue;
|
|
}
|
|
if (action == "inspect") {
|
|
notice(
|
|
R"({"kind":"inspection","snapshot":{"schemaVersion":1,"sessionId":"live-fixture","generation":)" +
|
|
std::to_string(requested) + R"(,"eventSequence":)" + std::to_string(requested) +
|
|
R"(,"frames":[{"name":")" +
|
|
std::string(requested == 1 ? "reflected_value"
|
|
: requested == 2 ? "twice<State>"
|
|
: "twice<int>") +
|
|
R"(","line":)" + std::to_string(requested) +
|
|
R"(,"source":"input.cpp","depth":0,"cached":false}],"values":[{"name":"Result","value":")" +
|
|
std::to_string(requested * 17) +
|
|
R"("}],"origins":[{"source":"input.cpp","line":4,"byteColumn":31,"targetKind":"declaration","targetName":"Ready","targetSource":"input.cpp","targetLine":1,"targetByteColumn":20}]}})");
|
|
} else if (action == "step") {
|
|
if (sequence < 3) {
|
|
stopped(++sequence);
|
|
} else {
|
|
finished("completed");
|
|
return 0;
|
|
}
|
|
} else if (action == "continue") {
|
|
finished("completed");
|
|
return 0;
|
|
} else if (action == "cancel") {
|
|
finished("cancelled");
|
|
return 125;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|