protected override void OnNextLine()
 {
     try {
         protocolClient.SendRequestSync(new NextRequest(currentThreadId));
     } catch (Exception ex) {
         DebuggerLoggingService.LogError("[VSCodeDebugger] StepOver request failed", ex);
     }
 }
 protected override void OnDetach()
 {
     try {
         protocolClient.SendRequestSync(new DisconnectRequest());
     } catch (Exception ex) {
         DebuggerLoggingService.LogError("[VSCodeDebugger] Error detaching debugger session", ex);
     }
 }
 protected override void OnExit()
 {
     try {
         HasExited = true;
         protocolClient.SendRequestSync(new DisconnectRequest());
     } catch (Exception ex) {
         DebuggerLoggingService.LogError("[VSCodeDebugger] Error closing debugger session", ex);
     }
 }
Beispiel #4
0
 void ChangeBusyState(bool busy, string description)
 {
     try {
         BusyStateChanged(this, new BusyStateEventArgs {
             IsBusy = busy, Description = description
         });
     }
     catch (Exception e) {
         DebuggerLoggingService.LogError("Exception during ChangeBusyState", e);
     }
 }
        protected override void OnSetNextStatement(long threadId, string fileName, int line, int column)
        {
            var source = new Source {
                Name = Path.GetFileName(fileName), Path = fileName
            };
            var request = new GotoTargetsRequest(source, line)
            {
                Column = column
            };
            GotoTargetsResponse response;
            GotoTarget          target = null;

            try {
                response = protocolClient.SendRequestSync(request);
            } catch (Exception ex) {
                DebuggerLoggingService.LogError("[VSCodeDebugger] Requesting target locations failed", ex);
                throw new NotSupportedException(ex.Message);
            }

            foreach (var location in response.Targets)
            {
                if (location.Line <= line && location.EndLine >= line && location.Column <= column && location.EndColumn >= column)
                {
                    // exact match for location
                    target = location;
                    break;
                }

                if (target == null)
                {
                    // closest match so far...
                    target = location;
                }
            }

            if (target == null)
            {
                throw new NotSupportedException();
            }

            try {
                protocolClient.SendRequestSync(new GotoRequest((int)threadId, target.Id));
            } catch (Exception ex) {
                DebuggerLoggingService.LogMessage("[VSCodeDebugger] Setting next statement failed", ex);
                throw new NotSupportedException(ex.Message);
            }

            RaiseStopEvent();
        }
 void DebugAgentProcess_Exited(object sender, EventArgs e)
 {
     if (protocolClient != null)
     {
         try {
             HasExited = true;
             protocolClient.RequestReceived -= OnDebugAdaptorRequestReceived;
             protocolClient.Stop();
         } catch (Exception ex) {
             DebuggerLoggingService.LogError("[VSCodeDebugger] Stop request failed", ex);
         }
         protocolClient = null;
     }
     OnTargetEvent(new TargetEventArgs(TargetEventType.TargetExited));
 }
        protected override ThreadInfo [] OnGetThreads(long processId)
        {
            ThreadsResponse response;

            try {
                response = protocolClient.SendRequestSync(new ThreadsRequest());
            } catch (Exception ex) {
                DebuggerLoggingService.LogError("[VSCodeDebugger] Error getting threads", ex);
                return(new ThreadInfo[0]);
            }

            var threads = new ThreadInfo[response.Threads.Count];

            for (int i = 0; i < threads.Length; i++)
            {
                var thread = response.Threads[i];

                threads[i] = new ThreadInfo(processId, thread.Id, thread.Name, null);
            }

            return(threads);
        }
        public ObjectValue CreateObjectValue(EvaluationOptions options)
        {
            if (!CanEvaluate(options))
            {
                return(DC.ObjectValue.CreateImplicitNotSupported(this, new ObjectPath(Name), Context.Adapter.GetDisplayTypeName(GetContext(options), Type), Flags));
            }

            Connect();
            try {
                return(OnCreateObjectValue(options));
            } catch (ImplicitEvaluationDisabledException) {
                return(DC.ObjectValue.CreateImplicitNotSupported(this, new ObjectPath(Name), Context.Adapter.GetDisplayTypeName(GetContext(options), Type), Flags));
            } catch (NotSupportedExpressionException ex) {
                return(DC.ObjectValue.CreateNotSupported(this, new ObjectPath(Name), Context.Adapter.GetDisplayTypeName(GetContext(options), Type), ex.Message, Flags));
            } catch (EvaluatorExceptionThrownException ex) {
                return(DC.ObjectValue.CreateEvaluationException(Context, Context.ExpressionValueSource, new ObjectPath(Name), ex));
            } catch (EvaluatorException ex) {
                return(DC.ObjectValue.CreateError(this, new ObjectPath(Name), "", ex.Message, Flags));
            }
            catch (Exception ex) {
                DebuggerLoggingService.LogError("Exception in CreateObjectValue()", ex);
                return(DC.ObjectValue.CreateUnknown(Name));
            }
        }
Beispiel #9
0
 void CancelOperations(List <IAsyncOperationBase> operations, bool wait)
 {
     foreach (var operation in operations)
     {
         var taskDescription = operation.Description;
         try {
             operation.Abort();
             if (wait)
             {
                 WaitAfterCancel(operation);
             }
         }
         catch (Exception e) {
             if (IsOperationCancelledException(e))
             {
                 DebuggerLoggingService.LogMessage(string.Format("Invocation of {0} cancelled in CancelOperations()", taskDescription));
             }
             else
             {
                 DebuggerLoggingService.LogError(string.Format("Invocation of {0} thrown an exception in CancelOperations()", taskDescription), e);
             }
         }
     }
 }
 public void Error(string message, Exception e)
 {
     DebuggerLoggingService.LogError(message, e);
 }
 protected override void OnNextLine()
 {
     protocolClient.SendRequest(new NextRequest(currentThreadId), null, (args, ex) => {
         DebuggerLoggingService.LogError("[VSCodeDebugger] StepOver request failed", ex);
     });
 }