/// <summary> /// Enumerate all the native threads in the dump /// </summary> /// <returns>an enumerate of DumpThread objects</returns> public IEnumerable <DumpThread> EnumerateThreads() { IMinidumpThreadList list = GetThreadList(); uint num = list.Count(); for (uint i = 0; i < num; i++) { MINIDUMP_THREAD rawThread = list.GetElement(i); yield return(new DumpThread(this, rawThread)); } }
/// <summary> /// Get the thread for the given thread Id. /// </summary> /// <param name="threadId">thread Id to lookup.</param> /// <returns> /// a DumpThread object representing a thread in the dump whose thread id matches /// the requested id. /// </returns> public DumpThread GetThread(int threadId) { EnsureValid(); MINIDUMP_THREAD raw = GetRawThread(threadId); if (raw == null) { return(null); } return(new DumpThread(this, raw)); }
// Internal helper to get the raw Minidump thread object. // Throws if thread is not found. private MINIDUMP_THREAD GetRawThread(int threadId) { IMinidumpThreadList list = GetThreadList(); uint num = list.Count(); for (uint i = 0; i < num; i++) { MINIDUMP_THREAD thread = list.GetElement(i); if (threadId == thread.ThreadId) { return(thread); } } return(null); }
/// <summary> /// Constructor for DumpThread /// </summary> /// <param name="owner">owning DumpReader object</param> /// <param name="raw">unmanaged structure in dump describing the thread</param> internal DumpThread(DumpReader owner, MINIDUMP_THREAD raw) { _raw = raw; _owner = owner; }