Inproc crashreport logging#3
Draft
mdh1418 wants to merge 5 commits intoinproc_crashreport_iosfrom
Draft
Conversation
…CRASH tag Adds SignalSafeConsoleWriter, a bounded async-signal-safe sibling to SignalSafeJsonWriter that emits one logical line at a time to a platform-specific console: __android_log_write under tag `DOTNET_CRASH` on Android (so consumers can filter crash reports out of an otherwise noisy logcat with `adb logcat *:S DOTNET_CRASH:F`) and minipal_log_write_error to stderr elsewhere. Promotes the wide-char signal name table out of pal/src/thread/process.cpp's file-static GetSignalName into PROCGetSignalName declared in pal/src/include/pal/process.h, so the crashreport TU can reuse the same mapping that PROCLogManagedCallstackForSignal uses (single source of truth for the ASCII signal-name table). Hooks the new writer into InProcCrashReporter::CreateReport: emits a fixed header (separator, .NET Crash Report version, Build, ABI, Cmdline, pid, signal) before the JSON open and a closing separator after the JSON close. Per-thread frame data lands in commit 2; modules table in commit 3. The compact log version literal is hoisted to a single CRASHREPORT_PROTOCOL_VERSION constant shared with the existing JSON `protocol_version` field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a unified frame-emission path that fans every walked managed frame out to both crash-report sinks: the JSON file (existing behavior) and the new SignalSafeConsoleWriter compact log. FrameSinks groups the writer + console-writer + per-thread frame counter into a single context that ThreadEnumerationContext (and the synthesized crash thread fallback) hands to the new FrameSinkCallback bridge. The previous JsonFrameCallback now delegates to a freshly extracted WriteFrameToJson so the JSON layout is unchanged. WriteFrameToConsole formats one frame as ` #NN Class.Method + 0xILOFFSET (token=0xTOKEN)` for managed frames and ` #NN 0xIP (module + 0xOFFSET)` for native frames (mirrors AOSP debuggerd/tombstone). ThreadEnumerationContext now also opens each thread's compact-log block (`--- thread 0xTID --- `, with `(crashed)` suffix on the crash thread) and emits the per-thread `managed exception:` line where the EE callback hands us the type/HRESULT. `EnumerateThreads` no longer takes `crashingTid` separately; it lives on the context alongside the per-thread frame counter so FrameSinkCallback can index frames consistently. EmitSynthesizedCrashThread mirrors the same compact-log block when the EE enumerator is unavailable or never observed the crashing thread, and falls back to `(no managed frames)` when no frames land in the block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…index references
Adds ModuleTable, a 32-slot fixed-capacity intern table keyed by MVID. Each unique module observed during a single CreateReport gets a small `[N]` index; frames in the compact log are rendered as ` #NN [M] Class.Method + 0xILOFFSET (token=0xTOKEN)` instead of repeating the (often verbose) module filename + GUID on every frame line.
A `modules:` block at the end of the report — emitted by EmitConsoleModulesAndFooter just before the closing separator — maps each `[N]` back to `Name {Mvid}` so triagers can correlate a frame to its full module identity exactly once per report. Modules beyond the cap render as `[?]` and are silently dropped from the modules block. Single `s_moduleTable` instance: CreateReport's existing `s_generating` InterlockedCompareExchange one-shot guard hard-prevents re-entry, so the table never accumulates state across reports.
JSON layout is unchanged; the index is a compact-log-only artifact.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a configurable per-thread frame cap to the compact-log output, gated on the new `DOTNET_CrashReportFrameLimitPerThread` env var (default 32, base-10 parse, plumbed through `InProcCrashReporterSettings.frameLimitPerThread`). Frames past the cap are still recorded in the JSON file (the authoritative post-mortem store); the compact log replaces them with ` ... +N more frames` so a deeply recursive or infinite-loop crash thread doesn't drown the logcat tag. FrameSinks gains `currentThreadDroppedCount` and `frameLimitPerThread`; FrameSinkCallback short-circuits the WriteFrameToConsole call once the cap is reached and bumps the dropped counter. ThreadEnumerationContext::FinishCurrentThreadCompactBlock and EmitSynthesizedCrashThread emit the `+N more frames` line when any frames were dropped, otherwise the existing `(no managed frames)` indicator is used. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g-only mode Enables the in-proc crash reporter to run for callers that only want the compact platform-log output (DOTNET_CRASH on Android, stderr elsewhere) and don't need the JSON file: `DOTNET_EnableCrashReport=1` alone now activates the reporter, with the JSON file written only when `DOTNET_DbgMiniDumpName` is also supplied. CreateReport now treats `m_reportPath` empty as a runtime signal to skip `open()` and route the JSON formatter through CrashReportHelpers::DiscardOutputCallback (a no-op sink). All other emission code paths run unchanged so the formatter's bookkeeping stays consistent in both modes; only the file-cleanup tail (close/unlink + trailing newline write) is gated on `jsonEnabled`. The console header/footer pair is unconditional. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
No description provided.