Exemplo n.º 1
0
        public ClrStackWalk CreateStackWalk(uint id, uint flags)
        {
            InitDelegate(ref _getTask, VTable->GetTaskByOSThreadID);

            int hr = _getTask(Self, id, out IntPtr pUnkTask);

            if (hr != S_OK)
            {
                return(null);
            }

            using (ClrDataTask dataTask = new ClrDataTask(_library, pUnkTask))
            {
                // There's a bug in certain runtimes where we will fail to release data deep in the runtime
                // when a C++ exception occurs while constructing a ClrDataStackWalk.  This is a workaround
                // for the largest of the leaks caused by this issue.
                //     https://github.com/Microsoft/clrmd/issues/47
                int count    = AddRef();
                var res      = dataTask.CreateStackWalk(_library, flags);
                int released = Release();
                if (released == count && res == null)
                {
                    Release();
                }
                return(res);
            }
        }
Exemplo n.º 2
0
        public ClrStackWalk CreateStackWalk(uint id, uint flags)
        {
            InitDelegate(ref _getTask, VTable->GetTaskByOSThreadID);

            int hr = _getTask(Self, id, out IntPtr pUnkTask);

            if (hr != S_OK)
            {
                return(null);
            }

            using (ClrDataTask dataTask = new ClrDataTask(_library, pUnkTask))
                return(dataTask.CreateStackWalk(_library, flags));
        }