예제 #1
0
 public RequestContext(HttpActionContext actionContext, IDebugContext debugContext)
 {
     UserName = null;
     Password = null;
     DebugContext = debugContext;
     TryGetUserFromCurrentContext();
 }
예제 #2
0
        private void GenerateExceptionReport(IDebugContext context)
        {
            string tFn = _fileName;

            if (_maxCrashes > 0 && _crashesRecorded.Count > _maxCrashes)
            {
                return;
            }
            else if (_crashesRecorded.Count > 0)
            {
                string path = Path.GetDirectoryName(_fileName);
                string name = Path.GetFileNameWithoutExtension(_fileName);
                string ext  = Path.GetExtension(_fileName);

                tFn = Path.Combine(path, name + _crashesRecorded + ext);

                if (File.Exists(tFn))
                {
                    File.Delete(tFn);
                }
            }

            context.SaveDumpFile(tFn, DumpType.Small, _dumpFlags, "Auto-generated from crash monitor.");
            _crashesRecorded.Add(tFn);
        }
예제 #3
0
 void IDebugContextService.Push(IDebugContext context)
 {
     if (Context.Count > 0)
     {
         context.SetParentContext(Context[Context.Count - 1]);
     }
     Context.Add(context);
 }
예제 #4
0
        public Profiler(IDebugContext debugContext, LogLevel logLevel, string name = null)
        {
            _debugContext = debugContext;
            _logLevel = logLevel;
            _name = name;

            _watch = Stopwatch.StartNew();
            _debugContext.Log(logLevel, "Start: {0}", _name ?? String.Empty);
        }
예제 #5
0
        public Profiler(IDebugContext debugContext, LogLevel logLevel, string name = null)
        {
            _debugContext = debugContext;
            _logLevel     = logLevel;
            _name         = name;

            _watch = Stopwatch.StartNew();
            _debugContext.Log(logLevel, "Start: {0}", _name ?? String.Empty);
        }
예제 #6
0
 public void HandleEventTest(
     [PexAssumeUnderTest] SimpleTriggerListener target,
     DebugTrigger triggerType,
     DebuggerEventArgs eventArgs,
     IDebugContext context
     )
 {
     target.HandleEvent(triggerType, eventArgs, context);
     // TODO: add assertions to method SimpleTriggerListenerTest.HandleEventTest(SimpleTriggerListener, DebugTrigger, DebuggerEventArgs, IDebugContext)
 }
예제 #7
0
 public void HandleEventTest(
     [PexAssumeUnderTest] FileCrashMonitor target,
     DebugTrigger triggerType,
     DebuggerEventArgs eventArgs,
     IDebugContext context
     )
 {
     target.HandleEvent(triggerType, eventArgs, context);
     // TODO: add assertions to method FileCrashMonitorTest.HandleEventTest(FileCrashMonitor, DebugTrigger, DebuggerEventArgs, IDebugContext)
 }
예제 #8
0
        public PetControllerTests()
        {
            Kernel = new StandardKernel();
            Kernel.Bind<IConfiguration>().To<Configuration>();
            Kernel.Bind<IDebugContext>().To<DebugContext>();
            Kernel.Bind<IPetPolicyProvider>().To<PetPolicyProvider>();

            _policyProvider = Kernel.Get<PetPolicyProvider>();
            _debugContext = Kernel.Get<IDebugContext>();
            _policyProvider.DebugContext = _debugContext;
        }
예제 #9
0
        public PetControllerTests()
        {
            Kernel = new StandardKernel();
            Kernel.Bind <IConfiguration>().To <Configuration>();
            Kernel.Bind <IDebugContext>().To <DebugContext>();
            Kernel.Bind <IPetPolicyProvider>().To <PetPolicyProvider>();

            _policyProvider = Kernel.Get <PetPolicyProvider>();
            _debugContext   = Kernel.Get <IDebugContext>();
            _policyProvider.DebugContext = _debugContext;
        }
예제 #10
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 internal static TypeNodeList GetTypeList(string typeList, IDebugContext context){
   TypeNodeList list = new TypeNodeList();
   int startIndex = typeList.LastIndexOf(".")+1;
   int endIndex;
   IDebugType typ;
   while((endIndex = typeList.IndexOf("Or", startIndex)) > 0){
     typ = context.GetType(typeList.Substring(startIndex, endIndex - startIndex));
     if (typ != null) list.Add(typ.CompilerType);
     startIndex = endIndex+2;
   }
   typ = context.GetType(typeList.Substring(startIndex));
   if (typ != null) list.Add(typ.CompilerType);
   return list;
 }
예제 #11
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 internal static IDebugType DebugTypeFromField(IDebugField field, IDebugContext context) {
   IDebugType type = null;
   FIELD_KIND kind;
   field.GetKind(out kind);
   if (0 != (FIELD_KIND.FIELD_KIND_TYPE & kind)) {
     if (0 != (kind & FIELD_KIND.FIELD_TYPE_PRIMITIVE)){
       type = new CDebugPrimitiveType(field, context);
     } else if (0 != (kind & (FIELD_KIND.FIELD_TYPE_CLASS|FIELD_KIND.FIELD_TYPE_STRUCT|FIELD_KIND.FIELD_TYPE_INNERCLASS))) {
       IDebugClassField classField = null;
       if (null != (classField = field as IDebugClassField)) {
         if (classField.DoesInterfaceExist("StructuralTypes.TupleType") == (int)HResult.S_OK)
           type = new CDebugStructuralType(classField, context, StructTypes.Tuple);
         else if(classField.DoesInterfaceExist("StructuralTypes.TypeUnion") == (int)HResult.S_OK)
           type = new CDebugStructuralType(classField, context, StructTypes.Union);
         else if(classField.DoesInterfaceExist("StructuralTypes.TypeIntersection") == (int)HResult.S_OK)
           type = new CDebugStructuralType(classField, context, StructTypes.Intersection);
         else{
           FIELD_INFO name = new FIELD_INFO();
           classField.GetInfo(FIELD_INFO_FIELDS.FIF_NAME, out name);
           if (name.bstrName.IndexOf("IEnumerableOf") >=0)
             type = new CDebugStreamType(classField, context, StreamType.GenericIEnumerable);
           else if (name.bstrName.IndexOf("NonEmptyIEnumerableOf") >=0)
             type = new CDebugStreamType(classField, context, StreamType.GenericNonEmptyIEnumerable);
           else if (name.bstrName.IndexOf("NonNullOf") >=0)
             type = new CDebugStreamType(classField, context, StreamType.GenericNonNull);
           else if (name.bstrName.IndexOf("BoxedOf") >=0)
             type = new CDebugStreamType(classField, context, StreamType.GenericBoxed);
           else if (name.bstrName.IndexOf("IListOf") >=0)
             type = new CDebugFlexArrayType(classField, context);
           else 
             type = new CDebugClassType(classField, context);
         }
       }
     } else if (0 != (kind & FIELD_KIND.FIELD_TYPE_ENUM)) {
       IDebugEnumField enumField = null;
       if (null != (enumField = field as IDebugEnumField)) {
         type = new CDebugEnumType(enumField, context);
       }
     } else if (0 != (kind & FIELD_KIND.FIELD_TYPE_ARRAY)) {
       IDebugArrayField arrayField = null;
       if (null != (arrayField = field as IDebugArrayField)) {
         type = new CDebugArrayType(arrayField, context);
       }
     }
   }
   return type;
 }
예제 #12
0
 public BreedController(IBreedProvider breedProvider, IDebugContext debugContext)
 {
     _breedProvider = breedProvider;
     _breedProvider.DebugContext = debugContext;
 }
예제 #13
0
 public CountriesController(ICountryProvider countryProvider, IDebugContext debugContext)
 {
     _countryProvider = countryProvider;
     _countryProvider.DebugContext = debugContext;
 }
예제 #14
0
 public DebugEnvironment()
 {
     this.context = null;
 }
예제 #15
0
 public CountriesController(ICountryProvider countryProvider, IDebugContext debugContext)
 {
     _countryProvider = countryProvider;
     _countryProvider.DebugContext = debugContext;
 }
예제 #16
0
 public CDebugValue(IDebugObject pObject, IDebugContext pContext)
 {
     this.m_Object      = pObject;
     this.m_Context     = pContext;
     this.m_RuntimeType = null;
 }
예제 #17
0
 public PetPoliciesController(IPetPolicyProvider policyProvider, IDebugContext debugContext)
 {
     _policyProvider = policyProvider;
     _policyProvider.DebugContext = debugContext;
 }
예제 #18
0
 public Profiler(IDebugContext debugContext, string name = null) :
     this(debugContext, LogLevel.All, name)
 {
 }
예제 #19
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  static CDebugMethodSymbol Create(IDebugMethodField field, IDebugContext context) {
   return new CDebugMethodSymbol(field, context);
 }
예제 #20
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugMethodSymbol(IDebugMethodField field, IDebugContext context) : base (field as IDebugField, context) {
   this.m_MethodField = field;
 }
예제 #21
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugFieldSymbol(IDebugField field, IDebugValue parent, IDebugContext context) 
   : this(field, context){
   this.m_Parent = parent;
 }
예제 #22
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugFieldSymbol(IDebugField field, IDebugContext context) 
   : base(field, context){
   this.m_Parent = null;
 }
예제 #23
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugEnumType(IDebugEnumField enumField, IDebugContext context) : base(enumField as IDebugField, context) {
   this.m_EnumField = enumField;
 }
예제 #24
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugArrayType(IDebugArrayField arrayField, IDebugContext context) 
   : base(arrayField as IDebugField, context) {
   this.m_ArrayField = arrayField;
 }
예제 #25
0
 public DebugEnvironment(){
   this.context = null;
 }
예제 #26
0
 public static void Init(IDebugContext context)
 {
     Current = context;
 }
예제 #27
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugPropertySymbol(IDebugPropertyField field, IDebugContext context) : base (field as IDebugField, context) {
   this.m_PropertyField = field;
 }
예제 #28
0
파일: Values.cs 프로젝트: hesam/SketchSharp
 public CEnumDebugValues(IEnumDebugObjects pObjects, IDebugContext pContext) {
   this.m_Objects = pObjects;
   this.m_Context = pContext;
   this.m_Current = null;
 }
예제 #29
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  static CDebugPropertySymbol Create(IDebugPropertyField field, IDebugContext context) {
   return new CDebugPropertySymbol(field, context);
 }
예제 #30
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public CDebugFlexArrayType(IDebugClassField flexType, IDebugContext context) 
   : base(flexType as IDebugField, context){
   this.m_ClassField = flexType;
 }
예제 #31
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CEnumSymbols(IEnumDebugFields fields, IDebugContext context) {
   this.m_Fields = fields;
   this.m_Context = context;
   this.m_Current = null;
 }
예제 #32
0
 void IDebugContext.SetParentContext(IDebugContext parent)
 {
     Parent = parent;
 }
예제 #33
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public CEnumClosureClassSymbols(IDebugValue parent, IDebugContext context){
   this.m_Context = context;
   this.m_Parent = parent;
   this.m_ClassType = parent.RuntimeType() as IDebugClassType;
   this.m_Current = null;
   if (this.m_Parent != null && this.m_ClassType != null){
     this.m_FieldEnumerator = this.m_ClassType.GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All);
   }
 }
예제 #34
0
        private IDebugProperty EvaluateExpression(uint evalFlags, uint timeout, IDebugContext context, String resultType)
        {
            if (this.debugContext == null)
            {
                this.debugContext = new DebugEnvironment();
            }
            this.debugContext.context = context;
            BlockScope    scope  = new DebugBlockScope(this.debugContext);
            ErrorNodeList errors = new ErrorNodeList();

            if (this.cciExpr.compiledExpression == null)
            {
                this.cciExpr.compiledExpression = (Expression)this.cciExpr.EE.ExprCompiler.CompileParseTree(this.cciExpr.ParsedExpr, scope, new Module(), errors);
                if (errors.Count > 0)
                {
                    this.cciExpr.compiledExpression = null;
                }
            }
            if (this.cciExpr.compiledExpression != null)
            {
                StackFrame         currentFrame = new StackFrame();
                IDebugMethodSymbol methodSym    = this.debugContext.context.GetContainer() as CDebugMethodSymbol;
                if (methodSym != null)
                {
                    IDebugFieldSymbol thisSymbol = methodSym.GetThis();
                    if (thisSymbol != null)
                    {
                        currentFrame.thisObject = new Literal(thisSymbol.GetValue(null), ((MethodScope )scope.BaseClass).ThisType);
                    }
                    else
                    {
                        currentFrame.thisObject = null;
                    }
                    currentFrame.parameters[0] = currentFrame.thisObject;
                    IEnumSymbol locals = methodSym.GetLocals();
                    if (locals != null)
                    {
                        for (int i = 0; ; i++)
                        {
                            if (locals.Current == null)
                            {
                                break;
                            }
                            Field localField = new DebugFieldNode(this.debugContext, locals.Current, new Identifier(locals.Current.Name), null, null, i);
                            currentFrame.locals[i] = localField.GetValue(null);
                            locals.MoveNext();
                        }
                    }
                    IEnumSymbol param = methodSym.GetParameters();
                    if (param != null)
                    {
                        for (int i = 1; ; i++)
                        {
                            if (param.Current == null)
                            {
                                break;
                            }
                            Field paramField = new DebugFieldNode(this.debugContext, param.Current, new Identifier(param.Current.Name), null, null, i);
                            currentFrame.parameters[i] = paramField.GetValue(null);
                            param.MoveNext();
                        }
                    }
                }
                if (this.cciExpr.EE.ExprEvaluator == null)
                {
                    this.cciExpr.EE.ExprEvaluator = new Evaluator();
                }
                this.cciExpr.EE.ExprEvaluator.stackFrame = currentFrame;
                Literal resultExpr = this.cciExpr.EE.ExprEvaluator.VisitExpression(this.cciExpr.compiledExpression) as Literal;
                if (resultExpr != null)
                {
                    if (resultExpr.Value is IDebugValue && resultExpr.Type is IDebugInfo) //already wrapped for use by debugger
                    {
                        return(this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugInfo)resultExpr.Type).GetDebugType, (IDebugValue)resultExpr.Value, null));
                    }
                    else if (resultExpr.Value is IDebugValue)
                    {
                        return(this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugValue)resultExpr.Value).RuntimeType(), (IDebugValue)resultExpr.Value, null));
                    }
                    if (resultExpr.Value != null)
                    {
                        return(new ExpressionEvalProperty(this.cciExpr.Expr, resultExpr.Type.FullName, resultExpr.Value.ToString(), resultExpr, this.cciExpr.EE));
                    }
                }
                else
                {
                    return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Error Evaluating Expression.", null, this.cciExpr.EE));
                }
            }
            else if (errors.Count > 0)
            {
                return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, errors[0].GetMessage(), null, this.cciExpr.EE));
            }
            return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Unknown Compiler Error.", null, this.cciExpr.EE));
        }
예제 #35
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CEnumLocalSymbols(IEnumDebugFields fields, IDebugContext context) {
   this.m_Fields = fields;
   this.m_Context = context;
   this.m_Current = null;
   this.m_IsEnumeratingClosureClass = false;
   this.m_DisplayRetunLocal = false;
 }
예제 #36
0
 public DebugEnvironment(IDebugContext context)
 {
     this.context = context;
 }
예제 #37
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugType(IDebugField field, IDebugContext context) {
   this.m_Field = field;
   this.m_Context = context;
 }
예제 #38
0
 public Profiler(IDebugContext debugContext, string name = null) :
     this(debugContext, LogLevel.All, name)
 {
 }
예제 #39
0
 public JwtController(IUserProvider userProvider, IDebugContext debugContext, IConfiguration configuration)
 {
     _userProvider = userProvider;
     _userProvider.DebugContext = debugContext;
     this._configuration = configuration;
 }
예제 #40
0
 private IDebugProperty EvaluateExpression(uint evalFlags, uint timeout, IDebugContext context, String resultType){
   if (this.debugContext == null) this.debugContext = new DebugEnvironment();
   this.debugContext.context = context;  
   BlockScope scope = new DebugBlockScope(this.debugContext);
   ErrorNodeList errors = new ErrorNodeList();
   if (this.cciExpr.compiledExpression == null){
     this.cciExpr.compiledExpression = (Expression)this.cciExpr.EE.ExprCompiler.CompileParseTree(this.cciExpr.ParsedExpr, scope, new Module(), errors);
     if (errors.Count > 0)
       this.cciExpr.compiledExpression = null;
   }
   if (this.cciExpr.compiledExpression != null){
     StackFrame currentFrame = new StackFrame();
     IDebugMethodSymbol methodSym = this.debugContext.context.GetContainer() as CDebugMethodSymbol;
     if (methodSym != null){
       IDebugFieldSymbol thisSymbol = methodSym.GetThis();
       if (thisSymbol != null)
         currentFrame.thisObject = new Literal(thisSymbol.GetValue(null), ((MethodScope ) scope.BaseClass).ThisType);
       else
         currentFrame.thisObject = null;
       currentFrame.parameters[0] = currentFrame.thisObject;
       IEnumSymbol locals = methodSym.GetLocals();
       if (locals != null){
         for (int i=0; ; i++){
           if (locals.Current == null) break;
           Field localField = new DebugFieldNode(this.debugContext, locals.Current, new Identifier(locals.Current.Name), null, null, i);
           currentFrame.locals[i] = localField.GetValue(null);
           locals.MoveNext();
         }
       }
       IEnumSymbol param = methodSym.GetParameters();
       if (param != null){
         for (int i=1; ; i++){
           if (param.Current == null) break;
           Field paramField = new DebugFieldNode(this.debugContext, param.Current, new Identifier(param.Current.Name), null, null, i);
           currentFrame.parameters[i] = paramField.GetValue(null);
           param.MoveNext();
         }
       }
     }
     if (this.cciExpr.EE.ExprEvaluator == null)
       this.cciExpr.EE.ExprEvaluator = new Evaluator();
     this.cciExpr.EE.ExprEvaluator.stackFrame = currentFrame;
     Literal resultExpr = this.cciExpr.EE.ExprEvaluator.VisitExpression(this.cciExpr.compiledExpression) as Literal;
     if (resultExpr != null){
       if (resultExpr.Value is IDebugValue && resultExpr.Type is IDebugInfo) //already wrapped for use by debugger
         return this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugInfo)resultExpr.Type).GetDebugType, (IDebugValue)resultExpr.Value, null);
       else if(resultExpr.Value is IDebugValue)
         return this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugValue)resultExpr.Value).RuntimeType(), (IDebugValue)resultExpr.Value, null);
       if (resultExpr.Value != null)
         return new ExpressionEvalProperty(this.cciExpr.Expr, resultExpr.Type.FullName, resultExpr.Value.ToString(), resultExpr, this.cciExpr.EE);
     }
     else
       return new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Error Evaluating Expression.", null, this.cciExpr.EE);
   }
   else if (errors.Count > 0){
     return new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, errors[0].GetMessage(), null, this.cciExpr.EE);
   }
   return new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Unknown Compiler Error.", null, this.cciExpr.EE);
 }
예제 #41
0
 public PetsController(IPetProvider petProvider, IDebugContext debugContext)
 {
     _petProvider = petProvider;
     _petProvider.DebugContext = debugContext;
 }
예제 #42
0
 public DebugEnvironment(IDebugContext context){
   this.context = context;
 }
예제 #43
0
 public PetsController(IPetProvider petProvider, IDebugContext debugContext)
 {
     _petProvider = petProvider;
     _petProvider.DebugContext = debugContext;
 }
 public DebugContextWithProvider(IDebugContext debugContext, IDebugContextProvider debugContextProvider)
 {
     m_context         = debugContext;
     m_contextProvider = debugContextProvider;
 }
예제 #45
0
 public ScopeDebugContext(IDebugContext context)
 {
     m_Context = context;
     Service <IDebugContextService> .Current.Push(context);
 }
예제 #46
0
파일: Values.cs 프로젝트: hesam/SketchSharp
 public CDebugArrayValue(IDebugArrayObject pObject, IDebugContext pContext) 
   :base(pObject as IDebugObject, pContext){
   this.m_ArrayObject = pObject;
 }
예제 #47
0
 public CDebugArrayValue(IDebugArrayObject pObject, IDebugContext pContext)
     : base(pObject as IDebugObject, pContext)
 {
     this.m_ArrayObject = pObject;
 }
예제 #48
0
파일: Values.cs 프로젝트: hesam/SketchSharp
 public CDebugValue(IDebugObject pObject, IDebugContext pContext){
   this.m_Object = pObject;
   this.m_Context = pContext;
   this.m_RuntimeType = null;
 }
예제 #49
0
 public CEnumDebugValues(IEnumDebugObjects pObjects, IDebugContext pContext)
 {
     this.m_Objects = pObjects;
     this.m_Context = pContext;
     this.m_Current = null;
 }
예제 #50
0
파일: Symbol.cs 프로젝트: hesam/SketchSharp
 public  CDebugPrimitiveType(IDebugField field, IDebugContext context) : base(field, context) { 
 }
예제 #51
0
 /// <summary>
 /// Handle the given trigger.
 /// </summary>
 /// <param name="triggerType">The type of trigger to evaluate.</param>
 /// <param name="eventArgs">The event arguments to handle.</param>
 /// <param name="context">The debug context to execute the action on.</param>
 public void HandleEvent(DebugTrigger triggerType, DebuggerEventArgs eventArgs, IDebugContext context)
 {
     if (_trigger == triggerType)
     {
         foreach (string command in _debugScript)
         {
             try
             {
                 context.RunCommand(command);
             }
             catch (DebugMonitorException)
             {
             }
         }
     }
 }
예제 #52
0
 public PoliciesController(IPolicyProvider policyProvider, IDebugContext debugContext)
 {
     _policyProvider = policyProvider;
     _policyProvider.DebugContext = debugContext;
 }
예제 #53
0
 /// <summary>
 /// Handle a trigger event.
 /// </summary>
 /// <param name="triggerType">The type of trigger to handle.</param>
 /// <param name="eventArgs">The trigger event arguments.</param>
 /// <param name="context">The debug context to perform.</param>
 /// <returns>True if the trigger should be handled.</returns>
 public void HandleEvent(DebugTrigger triggerType, DebuggerEventArgs eventArgs, IDebugContext context)
 {
     if (triggerType == DebugTrigger.Exception && !((ExceptionEventArgs)eventArgs).FirstChance)
     {
         try
         {
             GenerateExceptionReport(context);
         }
         catch (DebugMonitorException)
         {
         }
     }
 }