Repository navigation
[cDac] Implement thread state - #130029
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Pull request overview
Restores DacpThreadData::state population in the legacy DAC implementation of ClrDataAccess::GetThreadData, ensuring consumers (e.g., SOS) can once again observe per-thread ThreadState flags instead of the zero-initialized default.
Changes:
- Re-add assignment of
threadData->statefromThread::m_StateinClrDataAccess::GetThreadData.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/debug/daccess/request.cpp | Restores DacpThreadData::state reporting by copying the thread’s m_State into the returned struct. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
|
It looks like this method is implemented in SOSDacImpl.cs (cDAC) and should be updated as well. |
|
Good catch. This says: |
|
@jkotas Any objections here? We already half-wrapped the enum. After adding the suspension related values (which we need for investigations like #128401), and COM related ones (which are also needed, though rarely) I went ahead and finished the enum to not make it swiss cheese. Happy to just wrap the exact ones we need if that's the preference. |
|
We should be only exposing the values that are actually needed by the diagnostic stack. |
Just because of you need the value for some investigation does not mean that it should be exposed by the diagnostic contract. You can always dump the full content of the |
|
I've scaled back to just the exact enum flags we use. |
If it's not exposed by the contract, it won't be produced by SOS or tools like ClrMD. When a dump can contain hundreds or thousands of threads, it's not a fun prospect to spend 20 minutes digging through every Thread instance. SOS's I'm fine with not wrapping the whole enum, but we really do need these to not be something that has to be dug out by hand in the debugger, or (for our automated analysis) require a pdb where we don't need one today. |
Co-authored-by: Jan Kotas <[email protected]>
0cfe1b5 to
0772208
Compare
Co-authored-by: Jan Kotas <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
PR #126592 ("[cDAC] Fix bug in GetThreadData") removed `threadData->state = thread->m_State;` from ClrDataAccess::GetThreadData while reworking dead-thread reporting in a different path. We still use a LOT of the enums in threadstate to debug the runtime. In addition to the few that were previously wrapped: 1. The GC/debug suspension flags are critical to diagnosing hangs. 2. The COM apartment flags aren't used often, but do help us track down com issues (especially hangs due to apartment cross-calls). 3. The thread abort ones are not critical in most cases, but if they were to be present it would be a HUGE clue as to what's wrong wiht the process (someone is using an obsolete feature they shouldn't). Once I wrapped those, I didn't have a good reason to not just finish the enum. --------- Co-authored-by: Jan Kotas <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
PR #126592 ("[cDAC] Fix bug in GetThreadData") removed
threadData->state = thread->m_State;from ClrDataAccess::GetThreadData while reworking dead-thread reporting in a different path. We still use a LOT of the enums in threadstate to debug the runtime. In addition to the few that were previously wrapped:Once I wrapped those, I didn't have a good reason to not just finish the enum.