• Home
  • Raw
  • Download

Lines Matching +full:server +full:- +full:id

7 //    http://www.apache.org/licenses/LICENSE-2.0
15 #include "Server.hpp"
46 class Server::Impl : public Server, public ServerEventListener
53 void onThreadStarted(ID<Thread>) override;
54 void onThreadStepped(ID<Thread>) override;
55 void onLineBreakpointHit(ID<Thread>) override;
56 void onFunctionBreakpointHit(ID<Thread>) override;
63 const std::unique_ptr<dap::net::Server> server; member in vk::dbg::Server::Impl
68 Server::Impl::Impl(const std::shared_ptr<Context> &context, int port) in Impl()
70 , server(dap::net::Server::create()) in Impl()
73 session->registerHandler([](const dap::DisconnectRequest &req) { in Impl()
78 session->registerHandler([&](const dap::InitializeRequest &req) { in Impl()
88 session->registerSentHandler( in Impl()
91 session->send(dap::InitializedEvent()); in Impl()
94 session->registerHandler([](const dap::SetExceptionBreakpointsRequest &req) { in Impl()
100 session->registerHandler( in Impl()
110 ctx->clientEventBroadcast()->onSetBreakpoint(reqBP.name, verified); in Impl()
117 auto lock = ctx->lock(); in Impl()
124 ctx->clientEventBroadcast()->onBreakpointsChanged(); in Impl()
128 session->registerHandler( in Impl()
130 -> dap::ResponseOrError<dap::SetBreakpointsResponse> { in Impl()
138 if(auto file = this->file(req.source)) in Impl()
141 file->clearBreakpoints(); in Impl()
146 file->addBreakpoint(location.line); in Impl()
149 ctx->clientEventBroadcast()->onSetBreakpoint(location, verified); in Impl()
156 ctx->clientEventBroadcast()->onBreakpointsChanged(); in Impl()
168 ctx->lock().addPendingBreakpoints(req.source.name.value(), in Impl()
182 ctx->clientEventBroadcast()->onBreakpointsChanged(); in Impl()
186 session->registerHandler([this](const dap::ThreadsRequest &req) { in Impl()
188 auto lock = ctx->lock(); in Impl()
192 std::string name = thread->name(); in Impl()
206 out.id = thread->id.value(); in Impl()
213 session->registerHandler( in Impl()
215 -> dap::ResponseOrError<dap::StackTraceResponse> { in Impl()
218 auto lock = ctx->lock(); in Impl()
219 auto thread = lock.get(Thread::ID(req.threadId)); in Impl()
225 auto stack = thread->stack(); in Impl()
230 for(int i = static_cast<int>(stack.size()) - 1; i >= 0; i--) in Impl()
236 sf.id = frame.id.value(); in Impl()
248 session->registerHandler([this](const dap::ScopesRequest &req) in Impl()
249 -> dap::ResponseOrError<dap::ScopesResponse> { in Impl()
252 auto lock = ctx->lock(); in Impl()
253 auto frame = lock.get(Frame::ID(req.frameId)); in Impl()
261 scope(lock, "locals", frame->locals.get()), in Impl()
262 scope(lock, "arguments", frame->arguments.get()), in Impl()
263 scope(lock, "registers", frame->registers.get()), in Impl()
268 session->registerHandler([this](const dap::VariablesRequest &req) in Impl()
269 -> dap::ResponseOrError<dap::VariablesResponse> { in Impl()
272 auto lock = ctx->lock(); in Impl()
273 auto vars = lock.get(Variables::ID(req.variablesReference)); in Impl()
281 vars->foreach(req.start.value(0), req.count.value(~0), [&](const Variable &v) { in Impl()
285 out.type = v.value->type(); in Impl()
286 out.value = v.value->get(); in Impl()
287 if(auto children = v.value->children()) in Impl()
289 out.variablesReference = children->id.value(); in Impl()
298 session->registerHandler([this](const dap::SourceRequest &req) in Impl()
299 -> dap::ResponseOrError<dap::SourceResponse> { in Impl()
303 uint64_t id = req.sourceReference; in Impl() local
305 auto lock = ctx->lock(); in Impl()
306 auto file = lock.get(File::ID(id)); in Impl()
309 return dap::Error("Source %d not found", id); in Impl()
311 response.content = file->source; in Impl()
315 session->registerHandler([this](const dap::PauseRequest &req) in Impl()
316 -> dap::ResponseOrError<dap::PauseResponse> { in Impl()
322 auto lock = ctx->lock(); in Impl()
323 if(auto thread = lock.get(Thread::ID(req.threadId))) in Impl()
325 thread->pause(); in Impl()
333 thread->pause(); in Impl()
341 event.threadId = threads.front()->id.value(); in Impl()
345 session->send(event); in Impl()
351 session->registerHandler([this](const dap::ContinueRequest &req) in Impl()
352 -> dap::ResponseOrError<dap::ContinueResponse> { in Impl()
357 auto lock = ctx->lock(); in Impl()
358 if(auto thread = lock.get(Thread::ID(req.threadId))) in Impl()
360 thread->resume(); in Impl()
367 thread->resume(); in Impl()
375 session->registerHandler([this](const dap::NextRequest &req) in Impl()
376 -> dap::ResponseOrError<dap::NextResponse> { in Impl()
379 auto lock = ctx->lock(); in Impl()
380 auto thread = lock.get(Thread::ID(req.threadId)); in Impl()
386 thread->stepOver(); in Impl()
390 session->registerHandler([this](const dap::StepInRequest &req) in Impl()
391 -> dap::ResponseOrError<dap::StepInResponse> { in Impl()
394 auto lock = ctx->lock(); in Impl()
395 auto thread = lock.get(Thread::ID(req.threadId)); in Impl()
401 thread->stepIn(); in Impl()
405 session->registerHandler([this](const dap::StepOutRequest &req) in Impl()
406 -> dap::ResponseOrError<dap::StepOutResponse> { in Impl()
409 auto lock = ctx->lock(); in Impl()
410 auto thread = lock.get(Thread::ID(req.threadId)); in Impl()
416 thread->stepOut(); in Impl()
420 session->registerHandler([this](const dap::EvaluateRequest &req) in Impl()
421 -> dap::ResponseOrError<dap::EvaluateResponse> { in Impl()
424 auto lock = ctx->lock(); in Impl()
427 auto frame = lock.get(Frame::ID(req.frameId.value(0))); in Impl()
452 frame->locals->variables, in Impl()
453 frame->arguments->variables, in Impl()
454 frame->registers->variables, in Impl()
455 frame->hovers->variables, in Impl()
460 if(auto val = vars->get(req.expression)) in Impl()
462 response.result = val->get(fmt); in Impl()
463 response.type = val->type(); in Impl()
469 // TODO: This might be a configuration problem of the SPIRV-Tools in Impl()
470 // spirv-ls plugin. Investigate. in Impl()
474 if(auto val = vars->get(withPercent)) in Impl()
476 response.result = val->get(fmt); in Impl()
477 response.type = val->type(); in Impl()
486 session->registerHandler([](const dap::LaunchRequest &req) { in Impl()
492 session->registerHandler([=](const dap::ConfigurationDoneRequest &req) { in Impl()
498 server->start(port, [&](const std::shared_ptr<dap::ReaderWriter> &rw) { in Impl()
499 session->bind(rw); in Impl()
500 ctx->addListener(this); in Impl()
512 Server::Impl::~Impl() in ~Impl()
514 ctx->removeListener(this); in ~Impl()
515 server->stop(); in ~Impl()
518 void Server::Impl::onThreadStarted(ID<Thread> id) in onThreadStarted() argument
522 event.threadId = id.value(); in onThreadStarted()
523 session->send(event); in onThreadStarted()
526 void Server::Impl::onThreadStepped(ID<Thread> id) in onThreadStepped() argument
529 event.threadId = id.value(); in onThreadStepped()
531 session->send(event); in onThreadStepped()
534 void Server::Impl::onLineBreakpointHit(ID<Thread> id) in onLineBreakpointHit() argument
537 event.threadId = id.value(); in onLineBreakpointHit()
539 session->send(event); in onLineBreakpointHit()
542 void Server::Impl::onFunctionBreakpointHit(ID<Thread> id) in onFunctionBreakpointHit() argument
545 event.threadId = id.value(); in onFunctionBreakpointHit()
547 session->send(event); in onFunctionBreakpointHit()
550 dap::Scope Server::Impl::scope(Context::Lock &lock, const char *type, Scope *s) in scope()
553 // out.line = s->startLine; in scope()
554 // out.endLine = s->endLine; in scope()
555 out.source = source(s->file.get()); in scope()
558 out.variablesReference = s->variables->id.value(); in scope()
559 lock.track(s->variables); in scope()
563 dap::Source Server::Impl::source(File *file) in source()
566 out.name = file->name; in source()
567 if(file->isVirtual()) in source()
569 out.sourceReference = file->id.value(); in source()
571 out.path = file->path(); in source()
575 std::shared_ptr<File> Server::Impl::file(const dap::Source &source) in file()
577 auto lock = ctx->lock(); in file()
580 auto id = source.sourceReference.value(); in file() local
581 if(auto file = lock.get(File::ID(id))) in file()
594 if(file->path() == path) in file()
609 if(file->name == name) in file()
621 std::shared_ptr<Server> Server::create(const std::shared_ptr<Context> &ctx, int port) in create()
623 return std::make_shared<Server::Impl>(ctx, port); in create()