Exemplo n.º 1
0
 int IDebugThread2.GetThreadProperties(
     enum_THREADPROPERTY_FIELDS dwFields,
     THREADPROPERTIES[] ptp)
 {
     Info.Map(MappingToTHREADPROPERTIES, dwFields, out ptp[0]);
     return(VSConstants.S_OK);
 }
Exemplo n.º 2
0
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS fields, THREADPROPERTIES[] ptp)
        {
            DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.GetThreadProperties {0}", fields);
            var info = new THREADPROPERTIES();

            if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_ID))
            {
                info.dwThreadId = (uint)tid;
                info.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }
            if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_NAME))
            {
                info.bstrName  = GetNameAsync().Await(DalvikProcess.VmTimeout);
                info.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }
            if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_STATE))
            {
                info.dwThreadState = (uint)State;
                info.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }
            if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT))
            {
                info.dwSuspendCount = (uint)GetSuspendCountAsync().Await(DalvikProcess.VmTimeout);
                info.dwFields      |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
            }
            if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_PRIORITY))
            {
                info.bstrPriority = "Normal";
                info.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }
            ptp[0] = info;
            return(VSConstants.S_OK);
        }
Exemplo n.º 3
0
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp) {
            ThrowIfDisposed();

            var tp = new THREADPROPERTIES();

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_ID)) {
                tp.dwThreadId = 1;
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_STATE)) {
                tp.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_PRIORITY)) {
                tp.bstrPriority = "Normal";
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_NAME)) {
                tp.bstrName = "Main Thread";
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_LOCATION)) {
                var frame = _stackFrames.Value.LastOrDefault();
                tp.bstrName = frame != null ? frame.CallingFrame?.Call : "<unknown>";
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
            }

            ptp[0] = tp;
            return VSConstants.S_OK;
        }
Exemplo n.º 4
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            try
            {
                THREADPROPERTIES props = new THREADPROPERTIES();

                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = _debuggedThread.TargetId;
                    props.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName  = _debuggedThread.Name;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = GetCurrentLocation(true);
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                    if (props.bstrLocation == null)
                    {
                        // Thread deletion events may be delayed, in which case the thread object may still be present in the cache
                        // but the engine is unable to retrieve new data for it. So handle failure to get info for a dead thread.
                        props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_DEAD;
                        props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                        props.bstrLocation  = ResourceStrings.ThreadExited;
                    }
                }

                ptp[0] = props;
                return(Constants.S_OK);
            }
            catch (MIException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 5
0
        int IDebugThread100.GetThreadProperties100(uint dwFields, THREADPROPERTIES100[] props)
        {
            int hRes = VSConstants.S_OK;

            // Invoke GetThreadProperties to get the VS7/8/9 properties
            THREADPROPERTIES[]         props90    = new THREADPROPERTIES[1];
            enum_THREADPROPERTY_FIELDS dwFields90 = (enum_THREADPROPERTY_FIELDS)(dwFields & 0x3f);

            hRes = ((IDebugThread2)this).GetThreadProperties(dwFields90, props90);
            props[0].bstrLocation   = props90[0].bstrLocation;
            props[0].bstrName       = props90[0].bstrName;
            props[0].bstrPriority   = props90[0].bstrPriority;
            props[0].dwFields       = (uint)props90[0].dwFields;
            props[0].dwSuspendCount = props90[0].dwSuspendCount;
            props[0].dwThreadId     = props90[0].dwThreadId;
            props[0].dwThreadState  = props90[0].dwThreadState;

            // Populate the new fields
            if (hRes == VSConstants.S_OK && dwFields != (uint)dwFields90)
            {
                if ((dwFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_DISPLAY_NAME) != 0)
                {
                    // Thread display name is being requested
                    props[0].bstrDisplayName = debuggedThread.Name;
                    props[0].dwFields       |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_DISPLAY_NAME;

                    // Give this display name a higher priority than the default (0)
                    // so that it will actually be displayed
                    props[0].DisplayNamePriority = 10;
                    props[0].dwFields           |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_DISPLAY_NAME_PRIORITY;
                }

                if ((dwFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_CATEGORY) != 0)
                {
                    // Thread category is being requested
                    props[0].dwThreadCategory = 0;
                    props[0].dwFields        |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_CATEGORY;
                }

                if ((dwFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_AFFINITY) != 0)
                {
                    // Thread cpu affinity is being requested
                    props[0].AffinityMask = 0;
                    props[0].dwFields    |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_AFFINITY;
                }

                if ((dwFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_PRIORITY_ID) != 0)
                {
                    // Thread display name is being requested
                    props[0].priorityId = 0;
                    props[0].dwFields  |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_PRIORITY_ID;
                }
            }

            return(hRes);
        }
Exemplo n.º 6
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray)
        {
            try
            {
                THREADPROPERTIES props = new THREADPROPERTIES();

                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = (uint)_id;
                    props.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName  = _name;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = _location;
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return(VisualStudioExtensionConstants.S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                NLogService.Logger.Error(e);
                return(VisualStudioExtensionConstants.S_FALSE);
            }
        }
Exemplo n.º 7
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray)
        {
            try
            {
                THREADPROPERTIES props = new THREADPROPERTIES();

                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = (uint)debuggedThread.Id;
                    props.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName  = ThreadNameString;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = GetCurrentLocation(true);
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return(VSConstants.S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 8
0
        // Retreives requested information about this thread.
        // fields specifies what information should be included in the output THREADPROPERTIES.
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS fields,
                                       THREADPROPERTIES[] threadProperties)
        {
            var properties = new THREADPROPERTIES();

            if ((enum_THREADPROPERTY_FIELDS.TPF_ID & fields) != 0)
            {
                properties.dwThreadId = _id;
                properties.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }

            if ((enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT & fields) != 0)
            {
                // TODO: add info to properties
                properties.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
            }

            if ((enum_THREADPROPERTY_FIELDS.TPF_STATE & fields) != 0)
            {
                // TODO: add info to properties
                properties.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            if ((enum_THREADPROPERTY_FIELDS.TPF_PRIORITY & fields) != 0)
            {
                // TODO: add info to properties
                properties.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }

            if ((enum_THREADPROPERTY_FIELDS.TPF_NAME & fields) != 0)
            {
                properties.bstrName  = _name;
                properties.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if ((enum_THREADPROPERTY_FIELDS.TPF_LOCATION & fields) != 0)
            {
                var frame = _remoteThread.GetFrameAtIndex(0);
                if (frame != null)
                {
                    properties.bstrLocation = frame.GetFunctionName();
                    properties.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }
            }

            threadProperties[0] = properties;
            return(VSConstants.S_OK);
        }
Exemplo n.º 9
0
        /// <summary>
        ///     Gets properties that describe a thread..
        /// </summary>
        /// <param name="dwFields">The fields.</param>
        /// <param name="propertiesArray">The properties array.</param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray)
        {
            try
            {
                var props = new THREADPROPERTIES();

                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = (uint)_debuggedThread.Id;
                    props.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName  = ThreadNameString;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = GetCurrentLocation();
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return(S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 10
0
 // Token: 0x0600010A RID: 266 RVA: 0x00005064 File Offset: 0x00003264
 public int GetThreadProperties(enum_THREADPROPERTY_FIELDS fields, THREADPROPERTIES[] tp)
 {
     tp[0].dwFields = 0;
     if ((fields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
     {
         tp[0].dwThreadId = (uint)this.ID;
         tp[0].dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
     }
     if ((fields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
     {
         tp[0].dwThreadState = (this.IsAlive ? 2U : 4U);
         tp[0].dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
     }
     if (!this.IsAlive)
     {
         return(0);
     }
     if ((fields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
     {
         tp[0].bstrName  = this.GetThreadInfo().Name;
         tp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
     }
     if ((fields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
     {
         tp[0].bstrPriority = "Normal";
         tp[0].dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
     }
     if ((fields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
     {
         try
         {
             StackFrame frame = this.GetFrame();
             if (frame != null)
             {
                 tp[0].bstrLocation = frame.Frame.ToString();
                 tp[0].dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
             }
         }
         catch
         {
         }
     }
     return(0);
 }
Exemplo n.º 11
0
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            DebugHelper.TraceEnteringMethod();

            ptp[0].dwThreadId = (uint)ThreadMirror.ThreadId;
            ptp[0].dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;

            ptp[0].bstrName  = ThreadMirror.Name;
            ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;

            //try
            //{
            //    if (_engine.IsSuspended)
            //    {
            //        var priorityValue = ThreadMirror.InvokeMethod(ThreadMirror, _threadPriorityGetMethodMirror, Enumerable.Empty<Value>().ToList()) as EnumMirror;
            //        _threadPriorityLastValue = priorityValue.StringValue;
            //    }
            //}
            //catch
            //{

            //}

            //if (_engine.DebuggedProcess.IsRunning)
            //{
            //    ptp[0].bstrPriority = ThreadMirror.IsThreadPoolThread ? "ThreadPoolThread" : "No ThreadPoolThread"; //_threadPriorityLastValue;
            //    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;

            //    ptp[0].dwThreadState = (uint)ThreadMirror.ThreadState;
            //    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;

            //    StackFrame stackFrame = ThreadMirror.GetFrames().FirstOrDefault();
            //    if (stackFrame != null)
            //    {
            //        _lastLocation = $"{stackFrame.FileName}!{stackFrame.Location.Method.Name} Line {stackFrame.Location.LineNumber}";
            //    }

            //    ptp[0].bstrLocation = _lastLocation;
            //    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
            //}

            return(VSConstants.S_OK);
        }
Exemplo n.º 12
0
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                ptp[0].dwThreadId = 0;
                ptp[0].dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                ptp[0].bstrName  = Constants.ThreadName;
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                ptp[0].dwThreadState = (int)enum_THREADSTATE.THREADSTATE_STOPPED;
                ptp[0].dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            return(VSConstants.S_OK);
        }
Exemplo n.º 13
0
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            ThrowIfDisposed();

            var tp = new THREADPROPERTIES();

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_ID))
            {
                tp.dwThreadId = 1;
                tp.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_STATE))
            {
                tp.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                tp.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_PRIORITY))
            {
                tp.bstrPriority = "Normal";
                tp.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_NAME))
            {
                tp.bstrName  = "Main Thread";
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if (dwFields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_LOCATION))
            {
                var frame = _stackFrames.Value.LastOrDefault();
                tp.bstrName  = frame != null ? frame.CallingFrame?.Call : "<unknown>";
                tp.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
            }

            ptp[0] = tp;
            return(VSConstants.S_OK);
        }
Exemplo n.º 14
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray)
        {
            THREADPROPERTIES props = new THREADPROPERTIES();

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                props.dwThreadId = _vsTid;
                props.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
            {
                // sample debug engine doesn't support suspending threads
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
            {
                props.bstrPriority = Strings.DebugThreadNormalPriority;
                props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                props.bstrName  = Name;
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
            {
                props.bstrLocation = GetCurrentLocation(true);
                props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
            }

            propertiesArray[0] = props;
            return(VSConstants.S_OK);
        }
Exemplo n.º 15
0
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            Debug.WriteLine("AD7ProgramNode: Entering GetThreadProperties");
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                ptp[0].dwThreadId = 0;
                ptp[0].dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                ptp[0].bstrName  = "Thread";
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                ptp[0].dwThreadState = (int)enum_THREADSTATE.THREADSTATE_STOPPED;
                ptp[0].dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            return(VSConstants.S_OK);
        }
Exemplo n.º 16
0
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            Log.Debug("Thread: GetThreadProperties");

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                ptp[0].dwThreadId = 0;
                ptp[0].dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                ptp[0].bstrName  = "Thread";
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                ptp[0].dwThreadState = (int)enum_THREADSTATE.THREADSTATE_STOPPED;
                ptp[0].dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            return(VSConstants.S_OK);
        }
Exemplo n.º 17
0
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            if (ptp == null)
                throw new ArgumentNullException("ptp");
            if (ptp.Length == 0)
                throw new ArgumentException();

            ptp[0].dwFields = 0;

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                if (ErrorHandler.Succeeded(GetThreadId(out ptp[0].dwThreadId)))
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
            {
                if (TryGetLocation(out ptp[0].bstrLocation))
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                if (ErrorHandler.Succeeded(GetName(out ptp[0].bstrName)))
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
            {
                if (ErrorHandler.Succeeded(GetThreadPriority(out ptp[0].bstrPriority)))
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }

#if !HIDE_THREADS
            ThreadStatus status = _thread.GetStatus();
            int suspendCount = status != ThreadStatus.Zombie ? _thread.GetSuspendCount() : 0;

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;

                enum_THREADSTATE vsthreadState = 0;
                if (suspendCount > 1)
                    vsthreadState = enum_THREADSTATE.THREADSTATE_FROZEN;
                else if (status == ThreadStatus.Zombie)
                    vsthreadState = enum_THREADSTATE.THREADSTATE_DEAD;
                else if (status == ThreadStatus.Sleeping || status == ThreadStatus.Wait || status == ThreadStatus.Monitor)
                    vsthreadState = enum_THREADSTATE.THREADSTATE_STOPPED;
                else if (status == ThreadStatus.NotStarted)
                    vsthreadState = enum_THREADSTATE.THREADSTATE_FRESH;
                else
                    vsthreadState = enum_THREADSTATE.THREADSTATE_RUNNING;

                ptp[0].dwThreadState = (uint)vsthreadState;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
            {
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                ptp[0].dwSuspendCount = (uint)suspendCount;
            }
#endif

            return VSConstants.S_OK;
        }
Exemplo n.º 18
0
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            try
            {
                //                THREADPROPERTIES props = new THREADPROPERTIES();
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    try
                    {
                        ptp[0].dwThreadId = Convert.ToUInt32(this._id);
                    }
                    catch
                    {
                        ptp[0].dwThreadId = 0;
                    }
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    //                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    if (this._state == "running")
                        ptp[0].dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    else
                        ptp[0].dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_STOPPED;
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    ptp[0].bstrPriority = "Normal";
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    ptp[0].bstrName = _threadDisplayName;
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    ptp[0].bstrLocation = "";
                    if (__stackFrames != null)
                    {
                        foreach (AD7StackFrame frame in __stackFrames)
                        {
                            if (frame.m_functionName != "")
                            {
                                ptp[0].bstrLocation = frame.m_functionName;
                                break;
                            }
                        }
                    }
                    if (ptp[0].bstrLocation == "")
                        ptp[0].bstrLocation = "[External Code]";

                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return Constants.S_OK;
            }
            catch (ComponentException e)
            {
                return e.HResult;
            }
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }
        }
Exemplo n.º 19
0
 /// <summary>
 /// Gets the properties that describe this thread.
 /// </summary>
 /// <param name="dwFields">A combination of flags from the THREADPROPERTY_FIELDS enumeration that determines which fields of ptp are to be filled in.</param>
 /// <param name="ptp">A THREADPROPERTIES structure that that is filled in with the properties of the thread.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 /// <remarks>The information returned from this method is typically shown in the Threads debug window.</remarks>
 public virtual int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
 {
     Logger.Debug(string.Empty);
     return(VSConstants.E_NOTIMPL);
 }
    int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
    {
      Debug.WriteLine("AD7ProgramNode: Entering GetThreadProperties");
      if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
      {
        ptp[0].dwThreadId = 0;
        ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
      }

      if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
      {
        ptp[0].bstrName = "Thread";
        ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
      }

      if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
      {
        ptp[0].dwThreadState = (int)enum_THREADSTATE.THREADSTATE_STOPPED;
        ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
      }

      return VSConstants.S_OK;
    }
Exemplo n.º 21
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray)
        {
            try
            {
                THREADPROPERTIES props = new THREADPROPERTIES();

                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = (uint)m_debuggedThread.Id;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName = ThreadNameString;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = GetCurrentLocation(true);
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return Constants.S_OK;
            }
            catch (ComponentException e)
            {
                return e.HResult;
            }
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }
        }
Exemplo n.º 22
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray)
        {
            try
            {
                THREADPROPERTIES props;
                if (propertiesArray.Length > 0)
                {
                    props = propertiesArray[0];
                }
                else
                {
                    props = new THREADPROPERTIES();
                }


                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = (uint)Id;
                    props.dwFields  |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    props.dwSuspendCount = (uint)SuspendCount;
                    props.dwFields      |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields     |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName  = name;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = GetCurrentLocation();// "SquirrelThread::GetCurrentLocation!!(alberto fix me)"; //GetCurrentLocation(true);
                    props.dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                if (propertiesArray.Length > 0)
                {
                    propertiesArray[0] = props;
                }
                return(EngineConstants.S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HRESULT);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 23
0
 public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
 {
     return VSConstants.S_OK;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Gets the properties that describe this thread.
 /// </summary>
 /// <param name="dwFields">A combination of flags from the THREADPROPERTY_FIELDS enumeration that determines which fields of ptp are to be filled in.</param>
 /// <param name="ptp">A THREADPROPERTIES structure that that is filled in with the properties of the thread.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 /// <remarks>The information returned from this method is typically shown in the Threads debug window.</remarks>
 public virtual int GetThreadProperties( enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp )
 {
     Logger.Debug( string.Empty );
     return VSConstants.E_NOTIMPL;
 }
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            if (ptp == null)
            {
                throw new ArgumentNullException("ptp");
            }
            if (ptp.Length == 0)
            {
                throw new ArgumentException();
            }

            ptp[0].dwFields = 0;

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                if (ErrorHandler.Succeeded(GetThreadId(out ptp[0].dwThreadId)))
                {
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
            {
                if (TryGetLocation(out ptp[0].bstrLocation))
                {
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                if (ErrorHandler.Succeeded(GetName(out ptp[0].bstrName)))
                {
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
            {
                if (ErrorHandler.Succeeded(GetThreadPriority(out ptp[0].bstrPriority)))
                {
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
            }

#if !HIDE_THREADS
            ThreadStatus status       = _thread.GetStatus();
            int          suspendCount = status != ThreadStatus.Zombie ? _thread.GetSuspendCount() : 0;

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;

                enum_THREADSTATE vsthreadState = 0;
                if (suspendCount > 1)
                {
                    vsthreadState = enum_THREADSTATE.THREADSTATE_FROZEN;
                }
                else if (status == ThreadStatus.Zombie)
                {
                    vsthreadState = enum_THREADSTATE.THREADSTATE_DEAD;
                }
                else if (status == ThreadStatus.Sleeping || status == ThreadStatus.Wait || status == ThreadStatus.Monitor)
                {
                    vsthreadState = enum_THREADSTATE.THREADSTATE_STOPPED;
                }
                else if (status == ThreadStatus.NotStarted)
                {
                    vsthreadState = enum_THREADSTATE.THREADSTATE_FRESH;
                }
                else
                {
                    vsthreadState = enum_THREADSTATE.THREADSTATE_RUNNING;
                }

                ptp[0].dwThreadState = (uint)vsthreadState;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
            {
                ptp[0].dwFields      |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                ptp[0].dwSuspendCount = (uint)suspendCount;
            }
#endif

            return(VSConstants.S_OK);
        }
Exemplo n.º 26
0
        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            Log.Debug("Thread: GetThreadProperties");

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
            {
                ptp[0].dwThreadId = 0;
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;    
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
            {
                ptp[0].bstrName = "Thread";
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
            {
                ptp[0].dwThreadState = (int)enum_THREADSTATE.THREADSTATE_STOPPED;
                ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }

            return VSConstants.S_OK;
        }
Exemplo n.º 27
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int GetThreadProperties100(uint requestedFields, THREADPROPERTIES100 [] propertiesArray)
        {
            //
            // Gets properties that describe a thread.
            //

            LoggingUtils.PrintFunction();

            try
            {
                //
                // 9.0 (2008) thread properties.
                //

                THREADPROPERTIES [] threadProperties9 = new THREADPROPERTIES [1];

                enum_THREADPROPERTY_FIELDS requestedFields90 = (enum_THREADPROPERTY_FIELDS)0x3f;// (requestedFields & 0x3f);

                LoggingUtils.RequireOk(GetThreadProperties(requestedFields90, threadProperties9));

                propertiesArray [0].bstrLocation = threadProperties9 [0].bstrLocation;

                propertiesArray [0].bstrName = threadProperties9 [0].bstrName;

                propertiesArray [0].bstrPriority = threadProperties9 [0].bstrPriority;

                propertiesArray [0].dwSuspendCount = threadProperties9 [0].dwSuspendCount;

                propertiesArray [0].dwThreadId = threadProperties9 [0].dwThreadId;

                propertiesArray [0].dwThreadState = threadProperties9 [0].dwThreadState;

                propertiesArray [0].dwFields |= (uint)threadProperties9 [0].dwFields;

                //
                // 10.0 (2010) thread properties.
                //

                if ((requestedFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_DISPLAY_NAME) != 0)
                {
                    propertiesArray [0].bstrDisplayName = m_threadDisplayName;

                    propertiesArray [0].dwFields |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_DISPLAY_NAME;

                    propertiesArray [0].DisplayNamePriority = (uint)enum_DISPLAY_NAME_PRIORITY100.DISPLAY_NAM_PRI_DEFAULT_100;

                    propertiesArray [0].dwFields |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_DISPLAY_NAME_PRIORITY;
                }

                if ((requestedFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_CATEGORY) != 0)
                {
                    if (m_threadId == 1)
                    {
                        propertiesArray [0].dwThreadCategory = (uint)enum_THREADCATEGORY.THREADCATEGORY_Main;
                    }
                    else
                    {
                        propertiesArray [0].dwThreadCategory = (uint)enum_THREADCATEGORY.THREADCATEGORY_Worker;
                    }

                    propertiesArray [0].dwFields |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_CATEGORY;
                }

                if ((requestedFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_AFFINITY) != 0)
                {
                    propertiesArray [0].AffinityMask = 0;

                    propertiesArray [0].dwFields |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_AFFINITY;
                }

                if ((requestedFields & (uint)enum_THREADPROPERTY_FIELDS100.TPF100_PRIORITY_ID) != 0)
                {
                    propertiesArray [0].priorityId = 0;

                    propertiesArray [0].dwFields |= (uint)enum_THREADPROPERTY_FIELDS100.TPF100_PRIORITY_ID;
                }

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                return(Constants.E_FAIL);
            }
        }
Exemplo n.º 28
0
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            try
            {
                THREADPROPERTIES props = new THREADPROPERTIES();

                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    props.dwThreadId = _debuggedThread.TargetId;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // sample debug engine doesn't support suspending threads
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    props.bstrPriority = "Normal";
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    props.bstrName = _debuggedThread.Name;
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    props.bstrLocation = GetCurrentLocation(true);
                    props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                    if (props.bstrLocation == null)
                    {
                        // Thread deletion events may be delayed, in which case the thread object may still be present in the cache
                        // but the engine is unable to retrieve new data for it. So handle failure to get info for a dead thread.
                        props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_DEAD;
                        props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                        props.bstrLocation = ResourceStrings.ThreadExited;
                    }
                }

                ptp[0] = props;
                return Constants.S_OK;
            }
            catch (MIException e)
            {
                return e.HResult;
            }
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }
        }
        // Gets properties that describe a thread.
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] propertiesArray) {
            THREADPROPERTIES props = new THREADPROPERTIES();

            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0) {
                props.dwThreadId = (uint)_debuggedThread.Id;
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0) {
                // sample debug engine doesn't support suspending threads
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0) {
                props.dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0) {
                props.bstrPriority = "Normal";
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0) {
                props.bstrName = _debuggedThread.Name;
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
            }
            if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0) {
                props.bstrLocation = GetCurrentLocation(true);
                props.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
            }

            propertiesArray[0] = props;
            return VSConstants.S_OK;
        }
Exemplo n.º 30
0
        /// <summary>
        /// Gets the properties that describe this thread. (http://msdn.microsoft.com/en-ca/library/bb145602.aspx)
        /// </summary>
        /// <param name="dwFields"> A combination of flags from the THREADPROPERTY_FIELDS enumeration that determines which fields of
        /// ptp are to be filled in. </param>
        /// <param name="ptp"> A THREADPROPERTIES structure that that is filled in with the properties of the thread. </param>
        /// <returns> If successful, returns S_OK; otherwise, returns an error code. </returns>
        int IDebugThread2.GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
        {
            try
            {
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    try
                    {
                        ptp[0].dwThreadId = Convert.ToUInt32(this._id);
                    }
                    catch
                    {
                        ptp[0].dwThreadId = 0;
                    }
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    // VSNDK debug engine doesn't support suspending threads
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    if (this._state == "running")
                    {
                        ptp[0].dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    }
                    else
                    {
                        ptp[0].dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_STOPPED;
                    }
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    ptp[0].bstrPriority = "Normal";
                    ptp[0].dwFields    |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    ptp[0].bstrName  = _threadDisplayName;
                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }
                if ((dwFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    ptp[0].bstrLocation = "";
                    if (__stackFrames != null)
                    {
                        foreach (AD7StackFrame frame in __stackFrames)
                        {
                            if (frame.m_functionName != "")
                            {
                                ptp[0].bstrLocation = frame.m_functionName;
                                break;
                            }
                        }
                    }
                    if (ptp[0].bstrLocation == "")
                    {
                        ptp[0].bstrLocation = "[External Code]";
                    }

                    ptp[0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return(Constants.S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemplo n.º 31
0
 public int GetThreadProperties(enum_THREADPROPERTY_FIELDS dwFields, THREADPROPERTIES[] ptp)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 32
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int GetThreadProperties(enum_THREADPROPERTY_FIELDS requestedFields, THREADPROPERTIES [] propertiesArray)
        {
            //
            // Gets properties that describe a thread.
            //

            LoggingUtils.PrintFunction();

            try
            {
                if ((requestedFields & enum_THREADPROPERTY_FIELDS.TPF_ID) != 0)
                {
                    propertiesArray [0].dwThreadId = m_threadId;

                    propertiesArray [0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
                }

                if ((requestedFields & enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT) != 0)
                {
                    propertiesArray [0].dwSuspendCount = m_threadSuspendCount;

                    propertiesArray [0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
                }

                if ((requestedFields & enum_THREADPROPERTY_FIELDS.TPF_STATE) != 0)
                {
                    if (m_threadRunning)
                    {
                        propertiesArray [0].dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_RUNNING;
                    }
                    else
                    {
                        propertiesArray [0].dwThreadState = (uint)enum_THREADSTATE.THREADSTATE_STOPPED;
                    }

                    propertiesArray [0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
                }

                if ((requestedFields & enum_THREADPROPERTY_FIELDS.TPF_PRIORITY) != 0)
                {
                    propertiesArray [0].bstrPriority = "<unknown priority>";

                    propertiesArray [0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
                }

                if ((requestedFields & enum_THREADPROPERTY_FIELDS.TPF_NAME) != 0)
                {
                    propertiesArray [0].bstrName = m_threadName;

                    propertiesArray [0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
                }

                if ((requestedFields & enum_THREADPROPERTY_FIELDS.TPF_LOCATION) != 0)
                {
                    //
                    // The thread location (usually the topmost stack frame), typically expressed as the name of the method where execution is currently halted.
                    //

                    propertiesArray [0].bstrLocation = "[External Code]";

                    StackTrace(1); // single level depth

                    if (m_threadStackFrames.Count > 0)
                    {
                        DebuggeeStackFrame stackFrame = m_threadStackFrames [0];

                        FRAMEINFO frameInfo = new FRAMEINFO();

                        LoggingUtils.RequireOk(stackFrame.SetFrameInfo(enum_FRAMEINFO_FLAGS.FIF_FUNCNAME, 0, ref frameInfo));

                        if (!string.IsNullOrEmpty(frameInfo.m_bstrFuncName))
                        {
                            propertiesArray [0].bstrLocation = frameInfo.m_bstrFuncName;
                        }
                    }

                    propertiesArray [0].dwFields |= enum_THREADPROPERTY_FIELDS.TPF_LOCATION;
                }

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                return(Constants.E_FAIL);
            }
        }
Exemplo n.º 33
0
 public int GetThreadProperties(enum_THREADPROPERTY_FIELDS fields, THREADPROPERTIES[] ptp)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.GetThreadProperties {0}", fields);
     var info = new THREADPROPERTIES();
     if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_ID))
     {
         info.dwThreadId = (uint) tid;
         info.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_ID;
     }
     if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_NAME))
     {
         info.bstrName = GetNameAsync().Await(DalvikProcess.VmTimeout);
         info.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_NAME;
     }
     if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_STATE))
     {
         info.dwThreadState = (uint) State;
         info.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_STATE;
     }
     if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT))
     {
         info.dwSuspendCount = (uint)GetSuspendCountAsync().Await(DalvikProcess.VmTimeout);
         info.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_SUSPENDCOUNT;
     }
     if (fields.HasFlag(enum_THREADPROPERTY_FIELDS.TPF_PRIORITY))
     {
         info.bstrPriority = "Normal";
         info.dwFields |= enum_THREADPROPERTY_FIELDS.TPF_PRIORITY;
     }
     ptp[0] = info;
     return VSConstants.S_OK;
 }