[Diagnostics] InProc CrashReporter Generics Support#128936
Draft
mdh1418 wants to merge 1 commit into
Draft
Conversation
Capture each generic frame's instantiation on-device and emit it as a <classArgs;methodArgs> suffix on the managed frame line (and an additive generic_args field in the JSON). The instantiation is a runtime construct not encoded in the token/PDB, so it is recoverable only on-device; emitting it into the console report keeps the log self-sufficient. Value-type args resolve exactly (they map to distinct generated native code); reference-type args collapse to System.__Canon under shared generics. The walker builds the string into the existing fixed scratch buffer via BuildGenericArgs / AppendTypeHandleName / AppendUtf8 using only no-allocation, signal-safe metadata APIs, with bounds-guarded writes, a recursion depth cap, and a '?' sentinel for malformed shapes. A const char* genericArgs is threaded through the frame-callback typedef and the report sinks. This is the standalone variant of the generics change, applied directly on the verbose reporter so it can ship independently of the compaction work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the CoreCLR in-proc crash reporting pipeline to capture and emit a managed frame’s runtime generic instantiation arguments, threading a preformatted "<classArgs;methodArgs>" suffix from the VM stack walker through the existing frame callback and into both the console output and the JSON crash report (generic_args).
Changes:
- Add generic instantiation string building in the VM-side crash report stack walker and pass it through
InProcCrashReportFrameCallback. - Extend the crash reporter’s console and JSON sinks to include the per-frame generic instantiation payload.
- Add a new scratch buffer slot (
genericArgs) to avoid allocations and keep work bounded in the crash/signal context.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/vm/crashreportstackwalker.cpp | Builds per-frame generic instantiation text in a fixed scratch buffer and passes it to the frame callback. |
| src/coreclr/debug/crashreport/inproccrashreporter.h | Extends the frame callback signature with a const char* genericArgs parameter and documents its format/semantics. |
| src/coreclr/debug/crashreport/inproccrashreporter.cpp | Plumbs genericArgs into JSON (generic_args) and appends it to the console-managed frame line. |
Comment on lines
+148
to
+153
| if (th.IsArray()) | ||
| { | ||
| AppendTypeHandleName(buffer, bufferSize, index, th.GetArrayElementTypeHandle(), depth + 1); | ||
| AppendUtf8(buffer, bufferSize, index, "[]"); | ||
| return; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Emit generic instantiation arguments in the in-proc crash report
A generic method's instantiation (the actual type arguments, e.g. List.Add) is a runtime construct — it is not encoded in the MethodDef token or recoverable from the PDB off-device. So even with a perfect offline symbolicator, a crash report that carries only the token can never reconstruct which instantiation was on the stack. Capturing the instantiation has to happen on-device, at crash time.
This change captures each generic frame's instantiation in the crash handler and emits it both on the managed frame line and as an additive generic_args JSON field, keeping the report self-sufficient.
Safety
Validation