Files
Language-Server/include/vls/debug/inspection/ReplaySession.hpp
T
faumaray da8003f6d4 Implement the VLS roadmap on the native VBS build
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.
2026-12-05 14:06:50 +03:00

67 lines
2.7 KiB
C++

#pragma once
#include <Void/LanguageServer/Protocol/Json.hpp>
#include <cstdint>
#include <expected>
#include <filesystem>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
namespace vls::gcc {
class ReplayRecording;
}
namespace vls::debug {
namespace Protocol = Void::LanguageServer::Protocol;
using Json = Protocol::Json;
// DAP and the versioned inspection requests share the same cursor and generation.
class ReplaySession {
public:
static std::expected<ReplaySession, std::string> open(const std::filesystem::path &path);
ReplaySession(const ReplaySession &) = delete;
ReplaySession &operator=(const ReplaySession &) = delete;
ReplaySession(ReplaySession &&) noexcept = default;
ReplaySession &operator=(ReplaySession &&) = delete;
[[nodiscard]] Json::Object identity() const;
[[nodiscard]] Json::Object describe() const;
[[nodiscard]] bool matches(const Json::Object &arguments) const;
[[nodiscard]] std::expected<Json::Object, std::string> timeline(std::size_t start,
std::size_t count) const;
[[nodiscard]] std::expected<Json::Object, std::string> frames(std::size_t start,
std::size_t count) const;
// A false result represents the boundary in the requested direction. It preserves the cursor.
[[nodiscard]] std::expected<bool, std::string> initial_position();
[[nodiscard]] std::expected<bool, std::string> move_to_value(bool forward);
[[nodiscard]] std::expected<void, std::string> seek(std::uint32_t sequence);
void finish();
[[nodiscard]] bool paused() const { return sequence_.has_value(); }
[[nodiscard]] std::string_view pause_kind() const { return pause_kind_; }
[[nodiscard]] bool source_available() const { return source_available_; }
[[nodiscard]] std::string_view source_bytes() const;
[[nodiscard]] std::size_t frame_count() const;
[[nodiscard]] const Json &frame(std::size_t top_first_index) const;
[[nodiscard]] std::int64_t frame_handle(std::size_t index) const;
[[nodiscard]] std::int64_t scope_handle(std::size_t index) const;
[[nodiscard]] std::optional<std::size_t> handle_index(std::int64_t handle, bool scope) const;
private:
ReplaySession(std::shared_ptr<const gcc::ReplayRecording> recording, std::string id);
std::shared_ptr<const gcc::ReplayRecording> recording_;
std::string id_;
bool source_available_;
bool finished_{};
std::int64_t generation_{};
std::int64_t next_handle_{1};
std::int64_t frame_base_{1};
std::optional<std::uint32_t> sequence_;
std::string_view pause_kind_{"none"};
Json cursor_{nullptr};
};
} // namespace vls::debug