Repository navigation
Native crash capture - #184
Open
turtledreams wants to merge 4 commits into
Open
turtledreams wants to merge 4 commits into
turtledreams wants to merge 4 commits into
Conversation
Adds the in-process crash handler client of Google Breakpad for Linux and Windows, with the linux-syscall-support header, under vendor/breakpad. scripts/update_breakpad.py fetches both at given commits, copies only the client sources and the headers they include, and writes sources.cmake and the README. Nothing compiles these files yet.
setCrashDumpDirectory() sends every minidump in a directory at start() as an unhandled native crash and deletes the file. enableCrashReporting() with the COUNTLY_USE_BREAKPAD build option installs a Breakpad handler on Windows and Linux that writes the minidump, with the breadcrumbs and app version of the crash moment, and then hands the crash to the handler installed before it.
CI report
Public API changes: Public API, 0 removed or changed, 7 addedAdded: 7. Check that each one is meant to be public. Run Tests: Coverage, Line coverage 86.3%Unit test coverage
Static analysis, No new findingsclang-tidy: 75 findings
First 50 findings
New compared with the base branch: 0No finding that the base branch does not have. For ebfb1ae, updated 2026-11-25 12:36 UTC. Each check's run page has its full log. |
Public API changesAdded: 7. Check that each one is meant to be public. |
Records the new methods and fields in api/countly-sdk-cpp.api. Replaces memcpy, stat, fopen, execl and octal modes in the native crash code and tests, calls the C++ runtime's pure virtual call handler directly in the crash helper, and suppresses the remaining findings on required calls (MultiByteToWideChar, realpath, open in a signal handler, readdir, subprocess) with their reason.
Moves the directory entry type check into the listing loop, so that no build configuration evaluates a condition that is always true.
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.
Adds native crash reporting to the C++ SDK in two steps: sending crash dumps that a crash tool wrote, and an optional built-in crash handler.
What it does
setCrashDumpDirectory(path): atstart(), every*.dmpfile in the directory is sent as an unhandled crash ("_native_cpp": true, the Base64 dump in_error, never cut by the internal limits) and the file is deleted.crashesconsent, the file is deleted without being sent.crtsetting is off, the files stay for a later start.enableCrashReporting()with the CMake optionCOUNTLY_USE_BREAKPAD(off by default; Windows and Linux, refused at configure time on other systems): the SDK installs Breakpad's in-process handler fromstart()untilstop(), while thecrashesconsent is given andcrtis on. The server'sacrsetting turns it on and off.abort()(also pure virtual calls) and, with MSVC, invalid CRT parameters when the app has no handler of its own, because Breakpad's own CRT handlers end the process with exit code 0._logsand the metrics.vendor/breakpadbyscripts/update_breakpad.py(pinned commits in its README) and added to the SBOM. It compiles as a C++17 object library inside the countly library; the SDK itself still builds with C++14.Success criteria
tests/native_crash.cppcrt, the size limit, empty dumps, other files and named instances behave as abovetests/native_crash.cppenableCrashReporting, the consent,acr,crtandstop()tests/native_crash.cpp(Breakpad builds)abort(), uncaught exception, pure virtual call; invalid CRT parameter with MSVC) gives one dump, the earlier handler still runs, the exit status is unchanged, and the next start sends it with the breadcrumbs and app versiontests/native_crash.cppwithtests/native_crash_helper.cpp(Breakpad builds)dump_symssymbolsTests run
COUNTLY_USE_BREAKPAD=ONis refused at configure timeCI change
.github/workflows/tests.ymlgets a Linux flavorbreakpadand a jobbreakpad-windows(windows-2025, MSVC Release). Before, no job built withCOUNTLY_USE_BREAKPAD, so the crash tests in a child process would not run in CI. Cost: two more jobs per run.Static analysis
api/countly-sdk-cpp.apirecords the new public methods and fields (additions only). Findings on calls the code needs are suppressed on their line with the reason:MultiByteToWideChar(UTF-8 paths for the wide Windows APIs),realpath(allocating form, no fixed buffer),readdir(a directory stream local to the call),openin the test helper's signal handler (async-signal-safe), andsubprocessinscripts/update_breakpad.py(fixed git commands, no shell).Compatibility
No breaking change: new methods and a build option that is off by default. Default builds compile none of the vendored code.
Related: Countly/countly-platform#3770 (symbol upload platforms for Windows, Linux and macOS native crashes)