MCPcopy Create free account
hub / github.com/Norbyte/bg3se / HandleScopesRequest

Method HandleScopesRequest

LuaDebugger/DAPMessageHandler.cs:662–707  ·  view source on GitHub ↗
(DAPRequest request, DAPScopesRequest msg)

Source from the content-addressed store, hash-verified

660 }
661
662 private void HandleScopesRequest(DAPRequest request, DAPScopesRequest msg)
663 {
664 var threadId = msg.frameId >> 16;
665 var frameIndex = msg.frameId & 0xffff;
666
667 var state = GetThread(threadId);
668
669 if (!state.Stopped)
670 {
671 throw new RequestFailedException("Cannot get scopes when thread is not stopped");
672 }
673
674 if (frameIndex < 0 || frameIndex >= state.Stack.Count)
675 {
676 throw new RequestFailedException("Requested scopes for unknown frame");
677 }
678
679 var frame = state.Stack[frameIndex];
680 var stackScope = new DAPScope
681 {
682 name = "Locals",
683 variablesReference = Evaluator.MakeStackRef(threadId, frameIndex, 0),
684 namedVariables = 0, // TODO - get hinted named/indexed variable count,
685 indexedVariables = 0,
686 expensive = false
687 };
688 SetScopeRange(stackScope, frame);
689
690 var upvalueScope = new DAPScope
691 {
692 name = "Upvalues",
693 variablesReference = Evaluator.MakeStackRef(threadId, frameIndex, 1),
694 namedVariables = 0,
695 indexedVariables = 0,
696 expensive = false
697 };
698 SetScopeRange(upvalueScope, frame);
699
700 var scopes = new List<DAPScope> { stackScope, upvalueScope };
701
702 var reply = new DAPScopesResponse
703 {
704 scopes = scopes
705 };
706 Stream.SendReply(request, reply);
707 }
708
709 private void SendContinue(DbgContext context, DbgContinue.Types.Action action)
710 {

Callers

nothing calls this directly

Calls 2

MakeStackRefMethod · 0.80
SendReplyMethod · 0.80

Tested by

no test coverage detected