[Diagnostics] Add InProc CrashReport Logging#128105
Open
mdh1418 wants to merge 17 commits into
Open
Conversation
… namespace Moves the async-signal-safe integer formatting helpers and buffer-size constants out of SignalSafeJsonWriter into a shared SignalSafeFormat namespace. The helpers are JSON-agnostic and are needed by both the JSON writer and later compact console output without introducing a sibling dependency. This is intended as a behavior-preserving refactor: JSON writer call sites continue to use the same bounded fixed-buffer formatting logic, just through the shared helper namespace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds SignalSafeConsoleWriter, a bounded line-oriented sink that writes DOTNET_CRASH entries through __android_log_write on Android and newline-terminated stderr lines elsewhere. CreateReport now emits a compact tombstone-style header/footer alongside the existing JSON report path. The JSON header/footer emission is split into helpers, and DbgMiniDumpName becomes optional: when no JSON path is configured, the JSON writer uses a no-op sink while the compact log still runs. PROCGetSignalNameAscii exposes the existing signal-name table in the narrow form used by the compact log. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds shared frame-sink plumbing so each walked frame can feed both the JSON writer and the compact console writer. The compact log now emits per-thread headers, managed exception info, managed frame lines with IL offset/token, native frame lines with module offsets, and a marker when no managed frames were reported. Both normal thread enumeration and the synthesized crash-thread fallback use the same console block helpers, keeping per-thread compact-log structure in one place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dule-index references Adds ModuleTable, a 64-entry fixed-capacity table keyed by MVID for one crash report. Compact-log frames can refer to modules by short [N] indices, and the footer emits a modules block that maps each index back to the module filename and MVID. If a managed frame's module cannot be stored because the table is full or the GUID is missing, the frame renders the module name inline as (in <name>) instead of using a lossy placeholder. JSON output is unchanged; module indices are only a compact-log representation detail. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds DOTNET_CrashReportFrameLimitPerThread, parsed as base 10 with default 32, to cap the number of frames written per thread to the compact log. Setting the value to 0 disables the limit. Frames past the cap are still emitted to the JSON report. The compact log skips only the console frame line, tracks how many frames were omitted for the current thread, and emits an "... +N more frames" summary in the thread footer. 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 CoreCLR’s in-process crash reporting path to emit a compact, signal-safe crash log for mobile scenarios while preserving JSON file output when DOTNET_DbgMiniDumpName is configured.
Changes:
- Adds shared signal-safe formatting helpers and a line-oriented compact console/logcat writer.
- Refactors in-proc crash report emission into JSON header/footer and compact log sections.
- Adds frame limiting and module-table support for compact per-thread stack output.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/coreclr/vm/crashreportstackwalker.cpp |
Allows crash reporting without a dump path and wires frame-limit configuration. |
src/coreclr/pal/src/thread/process.cpp |
Adds ASCII POSIX signal-name helper. |
src/coreclr/pal/src/include/pal/process.h |
Declares the signal-name helper for crash reporting. |
src/coreclr/inc/clrconfigvalues.h |
Adds CrashReportFrameLimitPerThread configuration. |
src/coreclr/debug/crashreport/signalsafejsonwriter.h |
Removes formatter declarations now moved to shared helper. |
src/coreclr/debug/crashreport/signalsafejsonwriter.cpp |
Uses shared signal-safe formatting helpers. |
src/coreclr/debug/crashreport/signalsafeformat.h |
Adds shared bounded integer formatting declarations. |
src/coreclr/debug/crashreport/signalsafeformat.cpp |
Implements shared bounded integer formatting. |
src/coreclr/debug/crashreport/signalsafeconsolewriter.h |
Adds compact line-oriented crash log writer interface. |
src/coreclr/debug/crashreport/signalsafeconsolewriter.cpp |
Implements Android logcat / stderr compact crash log output. |
src/coreclr/debug/crashreport/inproccrashreporter.h |
Adds compact output helpers and frame-limit state. |
src/coreclr/debug/crashreport/inproccrashreporter.cpp |
Emits compact crash logs alongside JSON reporting. |
src/coreclr/debug/crashreport/CMakeLists.txt |
Includes new crash-report helper source files. |
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 13, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
lateralusX
reviewed
May 19, 2026
Move compact log line completion into EndLine, allocate crash report scratch state at initialization, group frame callback module fields, clean up stack-overflow capture plumbing, log initialization allocation failures, and scope Apple-specific reporter code to iOS/tvOS/MacCatalyst. Also make init-time storage publication race-safe, share the Android crash-report log tag through the reporter header, and remove the redundant module-table reset plus the single-use stack-overflow frame-formatting helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Read frame-limit configuration through the late Android getenv path, keep architecture naming defined for every compiled target, guard compact module-table references with resolvable module identity, synchronize stack-overflow snapshot publication reads, and keep GUID formatting on the async-signal-safe formatter path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lateralusX
reviewed
May 20, 2026
lateralusX
reviewed
May 20, 2026
lateralusX
reviewed
May 20, 2026
lateralusX
reviewed
May 20, 2026
lateralusX
reviewed
May 20, 2026
Rename the signal-safe formatter files, use compact module indexes in crash report output, and route initialization failure logging through portable platform logging. Move crash reporter state onto the init-time allocated reporter and minimize persistent scratch buffers by reusing temporary scratch storage where lifetimes do not overlap. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Read interlocked-published crash reporter and stack-walker singletons through VolatileLoad so crash-path callers observe fully initialized state. 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.
This adds a compact text view of the in-proc crash report for mobile, while preserving the existing JSON crash report file output when
DOTNET_DbgMiniDumpNameis configured.The compact output is intentionally tombstone-style: it prints process/signal metadata, per-thread frame stacks, a module table, and a footer. It omits data that platform crash reports already provide well, such as registers, memory-near dumps, and memory maps.
On Android, the compact report is emitted to logcat under a dedicated
DOTNET_CRASHtag for easy filtering. On iOS, the same compact report is emitted through the existing stderr/minipal log path.Details
DOTNET_CRASH, while non-Android targets write newline-delimited compact report lines through the existing error log path.DOTNET_CrashReportFrameLimitPerThread; default is 32 frames per thread, and0disables the compact-log cap.iOS,tvOS, andMacCatalyst), including Appleucontext_tregister extraction.Android Emulator Validation
Validated on Android x64 emulator with the same crash scenarios as #126916, comparing the console output with the json file.
FailFast: compact output and JSON emitted; top frames matched.abort: compact output and JSON emitted; top frames matched.SIGSEGV: compact output and JSON emitted; top frames matched.pthread_once: compact output and JSON emitted; top frames matched.iOS simulator validation
Validated compact console crash-report emission on
iossimulator-arm64All scenarios emitted both:
.crashreport.json.NET Crash Report v1.0.0console report in the app lognullref,sigsegv,abort,failfast,unhandled,interleaved,stackoverflowFor every scenario, the console report included the compact header, signal, per-thread blocks, managed frames, and a
modules:table. Console thread counts matched the corresponding JSON crash report.