Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
8f36d45
Initial implementation
mujacica Oct 28, 2025
4ba6211
Update build structure and daemon
mujacica Oct 29, 2025
a930a41
Updates for Windows support
mujacica Oct 29, 2025
71e9e69
Fix logging
mujacica Oct 29, 2025
46a16bf
Fix MacOs builds
mujacica Oct 29, 2025
296892d
Fix Warnings
mujacica Oct 29, 2025
7ea0bd5
Test fixes
mujacica Oct 29, 2025
a345a0e
Fix linux builds
mujacica Oct 29, 2025
2f578a7
Fix linux/mac modules
mujacica Oct 29, 2025
25853ee
Fix concurency
mujacica Oct 29, 2025
b3be5d2
Fix build errors
mujacica Oct 29, 2025
dd7445c
Formatting
mujacica Oct 29, 2025
709fccf
Fix 32bit builds
mujacica Oct 29, 2025
bcb3c73
Fix format
mujacica Oct 29, 2025
a0fd270
Fix some issues
mujacica Oct 29, 2025
e247fab
Native tests need http/transport
mujacica Oct 29, 2025
efafc14
Fix CMake
mujacica Oct 29, 2025
497ac98
Fix build
mujacica Oct 29, 2025
f3428c6
Fix errors
mujacica Oct 30, 2025
4b0a064
Fix format
mujacica Oct 30, 2025
3c75eda
Fix style
mujacica Oct 30, 2025
e28cb12
Fix some of the issues
mujacica Oct 30, 2025
acdf436
Fix format
mujacica Oct 30, 2025
16250d1
Moooore fixes
mujacica Oct 30, 2025
77045f0
Debug CI
mujacica Oct 30, 2025
02b631f
More debug
mujacica Oct 30, 2025
8940639
More debug
mujacica Oct 30, 2025
8720bf8
More debug
mujacica Oct 30, 2025
ced1e81
And more
mujacica Oct 30, 2025
06c0dfb
More fixes
mujacica Oct 30, 2025
a16f18f
Linux fixes
mujacica Oct 30, 2025
a85ffe9
Fix i386 builds
mujacica Oct 30, 2025
c8e1163
More fixes
mujacica Oct 30, 2025
1f4ea55
Fix more tests
mujacica Oct 30, 2025
bd768dc
More fixes
mujacica Oct 30, 2025
32c6369
Fix native backend daemon discovery and resource leaks
mujacica Jan 15, 2026
b0be4cb
fix: use signal-safe memory operations in crash handler for TSAN/ASAN…
mujacica Jan 15, 2026
e5c79d3
Fix TSAN test failures and unused function warnings
mujacica Jan 15, 2026
b871293
Fix TSAN robustness for native crash HTTP tests
mujacica Jan 15, 2026
dff1b58
Fix native test failures under kcov and sanitizers
mujacica Jan 15, 2026
d51548a
Add run_crash helper to handle kcov exit code quirk
mujacica Jan 15, 2026
4dfeca8
Fix Windows ClangCL build and improve signal handler robustness
mujacica Jan 15, 2026
13f734e
Fix format
mujacica Jan 15, 2026
7622382
Fix Windows ARM64 and macOS ASAN CI failures
mujacica Jan 15, 2026
22ee98c
Fix tests
mujacica Jan 15, 2026
f0b219a
Fix Windows/ASAN CI failures and add crash reporting mode API
mujacica Jan 15, 2026
fa29b41
Fix Windows/ASAN CI failures and add crash reporting mode API
mujacica Jan 15, 2026
902a142
Fix attachment handling in native crash daemon with native stacktrace…
mujacica Jan 15, 2026
8969890
Fix attachment handling in native crash daemon with native stacktrace…
mujacica Jan 15, 2026
381f820
Fix CI failures: Windows ClangCL build and resource leaks
mujacica Jan 15, 2026
4eb8d96
Fix macOS minidump resource leaks and uninitialized state
mujacica Jan 15, 2026
0f03bf2
Skip native backend tests on macOS ASAN
mujacica Jan 15, 2026
48b3b31
Add E2E tests and fix thread duplication in native-with-minidump mode
mujacica Jan 15, 2026
77362c0
Add debug symbol upload to E2E workflow for symbolication
mujacica Jan 15, 2026
239f424
Fix debug_meta to use crashed process modules instead of daemon modules
mujacica Jan 15, 2026
c3dd4d5
Add missing sys/uio.h header and fix code style
mujacica Jan 15, 2026
812c8d3
Fix Python formatting in E2E tests
mujacica Jan 15, 2026
81796f9
Reduce thread count assertion from >= 3 to >= 1
mujacica Jan 15, 2026
15554f3
Add Linux module capture from /proc/maps for debug_meta
mujacica Jan 15, 2026
9172fd6
Remove debug symbol upload from E2E workflow
mujacica Jan 15, 2026
7390b6b
Fix unused parameter warning on Windows
mujacica Jan 15, 2026
419969b
Fix ELF debug_id byte swapping for Linux module capture
mujacica Jan 15, 2026
e38dc39
Add Linux thread enumeration from /proc/task for native mode
mujacica Jan 15, 2026
1453412
Fix code style
mujacica Jan 15, 2026
81a757d
Enable structured logs in E2E crash tests
mujacica Jan 15, 2026
2f04d18
Fix Linux module capture and ARM64 stack unwinding
mujacica Jan 15, 2026
a930aa3
Fix Windows 32-bit compile warnings for uint64_t to size_t conversion
mujacica Jan 16, 2026
cc28f7f
Increase E2E test polling to 100 attempts with 6 second intervals
mujacica Jan 16, 2026
9754b5c
Add PE code_id for Windows modules in native crash events
mujacica Jan 16, 2026
fcf219e
Improve Windows stack capture for frame pointer unwinding
mujacica Jan 16, 2026
db868f6
Use StackWalk64 for Windows stack unwinding in native backend
mujacica Jan 16, 2026
7725cef
Fix Windows build: add forward declaration for walk_stack_with_dbghelp
mujacica Jan 16, 2026
d6c1e6d
Add module enrichment to stack frames and build stacktraces for all t…
mujacica Jan 16, 2026
5e6da70
Fix empty frames and use per-thread context for Linux
mujacica Jan 16, 2026
1390ab7
Fix unused variable warning on Windows ClangCL build
mujacica Jan 16, 2026
19f22bd
Fix Linux module size calculation to span all memory mappings
mujacica Jan 16, 2026
d0eacbd
Fix GUID alignment issue when reading PDB debug info on Windows
mujacica Jan 16, 2026
28b1ffb
Add diagnostic logging for Windows vs Linux debug_meta investigation
mujacica Jan 16, 2026
7291034
Add diagnostic logging for Windows vs Linux debug_meta investigation
mujacica Jan 16, 2026
81bfa19
Add debug_file and fix code_id format for Windows native backend
mujacica Jan 16, 2026
291f8c3
Add debug_file and fix code_id format for Windows native backend
mujacica Jan 17, 2026
6ec42f0
More windows fixes + PR fixes
mujacica Jan 19, 2026
d0ddc98
Fix minidump writer issues from PR review
mujacica Jan 20, 2026
b94ad9a
Fix minidump writer issues from PR review (part 2)
mujacica Jan 20, 2026
3c93f3a
Fix shared memory corruption and ELF parsing infinite loop
mujacica Jan 20, 2026
c938d12
Add arch field for Windows PE modules and device context
mujacica Feb 5, 2026
701f88a
Refactor duplicated sanitizer detection preprocessor logic
mujacica Feb 5, 2026
21bf471
Fix tests/comments/changelog
mujacica Feb 5, 2026
8f24654
Fix native stacktrace format to match minidump events
mujacica Feb 5, 2026
28e2204
Fix PR review comments: E2E workflow and macOS thread_get_state
mujacica Feb 5, 2026
9360f5c
Fix PR review comments: E2E workflow and macOS thread_get_state
mujacica Feb 5, 2026
e09c793
Refactor minidump writers and fix PR review comments
mujacica Feb 5, 2026
a48f5de
Fix Bugbot issues: overflow check, unused struct and constant
mujacica Feb 5, 2026
6210908
Fix duplicate stacktrace in threads for envelope-only mode
mujacica Feb 5, 2026
c07cb2f
Ensure code_id uses uppercase hex digits
mujacica Feb 5, 2026
52522c9
Fix integer overflow in ELF section header size calculation
mujacica Feb 5, 2026
b39975b
Fix async-signal-unsafe functions in crash signal handler
mujacica Feb 5, 2026
40fe6e7
Fix Windows exception code sent as negative number
mujacica Feb 5, 2026
e343530
Fix UTF-8 to UTF-16LE conversion for non-ASCII characters
mujacica Feb 5, 2026
f9d5e25
Add Windows thread deduplication in native crash events
mujacica Feb 5, 2026
3f38ed0
Capture Windows thread contexts for proper stack walking
mujacica Feb 5, 2026
eaae7df
Add defensive thread deduplication at event-building level
mujacica Feb 5, 2026
d75958d
Remove redundant memset in Linux IPC initialization
mujacica Feb 5, 2026
1080f8b
Remove workaround deduplication and add diagnostic logging
mujacica Feb 5, 2026
3511d9d
Fix unchecked lseek return values and formatting issues
mujacica Feb 5, 2026
ec910bc
Add diagnostic logging for thread duplication investigation
mujacica Feb 5, 2026
f94a9a1
Add thread duplication detection and daemon log printing to E2E tests
mujacica Feb 5, 2026
e01adfe
Fix format
mujacica Feb 5, 2026
f4f5bc2
Add detailed thread debugging to E2E tests
mujacica Feb 5, 2026
070953c
Fix PR comment
mujacica Feb 5, 2026
e75452b
Speed up linux tests
mujacica Feb 5, 2026
34022b6
Fix register usages
mujacica Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: E2E Integration Tests

on:
push:
branches:
- master
- "release/**"
pull_request:

concurrency:
group: e2e-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
e2e-test:
name: E2E Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y cmake libcurl4-openssl-dev

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install test dependencies
run: pip install -r tests/requirements.txt

- name: Add hosts entry (Linux/macOS)
if: runner.os != 'Windows'
run: sudo sh -c 'echo "127.0.0.1 sentry.native.test" >> /etc/hosts'

- name: Add hosts entry (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Add-Content C:\Windows\System32\drivers\etc\hosts "127.0.0.1 sentry.native.test"

- name: Run E2E tests
env:
SENTRY_E2E_DSN: ${{ secrets.SENTRY_E2E_DSN }}
SENTRY_E2E_AUTH_TOKEN: ${{ secrets.SENTRY_E2E_AUTH_TOKEN }}
SENTRY_E2E_ORG: ${{ secrets.SENTRY_E2E_ORG }}
SENTRY_E2E_PROJECT: ${{ secrets.SENTRY_E2E_PROJECT }}
run: pytest --capture=no --verbose tests/test_e2e_sentry.py
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Features**:

- Add support for metrics. It is currently experimental, and one can enable it by setting `sentry_options_set_enable_metrics`. When enabled, you can record a metric using `sentry_metrics_count()`, `sentry_metrics_gauge()`, or `sentry_metrics_distribution()`. Metrics can be filtered by setting the `before_send_metric` hook. ([#1498](https://github.com/getsentry/sentry-native/pull/1498))
- Add new `native` crash handling backend as an alternative to `crashpad`, `breakpad`, and `inproc`. This backend uses an out-of-process daemon that monitors the application for crashes, generates minidumps, and sends crash reports to Sentry. It supports Linux, macOS, and Windows, and is fully compatible with TSAN and ASAN sanitizers. ([#1433](https://github.com/getsentry/sentry-native/pull/1433))

## 0.12.5

Expand Down
105 changes: 103 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ else()
cmake_policy(SET CMP0077 NEW)
endif()

# Allow target_link_libraries() in subdirectories
if(POLICY CMP0079)
cmake_policy(SET CMP0079 NEW)
endif()

# Allow downstream SDKs to override the SDK version at CMake configuration time
set(SENTRY_SDK_VERSION "" CACHE STRING "Override the SDK version (supports full semver format with build metadata)")

Expand Down Expand Up @@ -219,9 +224,12 @@ else()
set(SENTRY_DEFAULT_BACKEND "inproc")
endif()

# Native backend is available on all platforms as an alternative
# It's lightweight (~5K LOC) and supports all platforms

if(NOT DEFINED SENTRY_BACKEND)
set(SENTRY_BACKEND ${SENTRY_DEFAULT_BACKEND} CACHE STRING
"The sentry backend responsible for reporting crashes, can be either 'none', 'inproc', 'breakpad' or 'crashpad'.")
"The sentry backend responsible for reporting crashes, can be either 'none', 'inproc', 'breakpad', 'crashpad', or 'native'.")
endif()

if(SENTRY_BACKEND STREQUAL "crashpad")
Expand All @@ -230,14 +238,16 @@ elseif(SENTRY_BACKEND STREQUAL "inproc")
set(SENTRY_BACKEND_INPROC TRUE)
elseif(SENTRY_BACKEND STREQUAL "breakpad")
set(SENTRY_BACKEND_BREAKPAD TRUE)
elseif(SENTRY_BACKEND STREQUAL "native")
set(SENTRY_BACKEND_NATIVE TRUE)
elseif(SENTRY_BACKEND STREQUAL "none")
set(SENTRY_BACKEND_NONE TRUE)
elseif(SENTRY_BACKEND STREQUAL "custom")
message(DEBUG
"SENTRY_BACKEND set to 'custom' - a custom backend source must be added to the compilation unit by the downstream SDK.")
else()
message(FATAL_ERROR
"SENTRY_BACKEND must be one of 'crashpad', 'inproc', 'breakpad' or 'none'.
"SENTRY_BACKEND must be one of 'crashpad', 'inproc', 'breakpad', 'native', or 'none'.
Downstream SDKs may choose to provide their own by specifying 'custom'.")
endif()

Expand Down Expand Up @@ -729,6 +739,97 @@ elseif(SENTRY_BACKEND_BREAKPAD)
endif()
elseif(SENTRY_BACKEND_INPROC)
target_compile_definitions(sentry PRIVATE SENTRY_WITH_INPROC_BACKEND)
elseif(SENTRY_BACKEND_NATIVE)
target_compile_definitions(sentry PRIVATE SENTRY_WITH_NATIVE_BACKEND)

# Native backend sources and configuration are in src/CMakeLists.txt
# The native backend requires C11 for atomics (set in src/CMakeLists.txt)

# Build sentry-crash executable for native backend
# Get all sources that were added to sentry target
get_target_property(SENTRY_SOURCES sentry SOURCES)

# Create daemon executable with same sources plus daemon-specific files
add_executable(sentry-crash
${SENTRY_SOURCES}
src/backends/native/sentry_crash_daemon.c
src/backends/native/sentry_crash_ipc.c
src/backends/native/sentry_crash_context.h
)

# Define standalone mode and copy compile definitions from sentry
target_compile_definitions(sentry-crash PRIVATE
SENTRY_CRASH_DAEMON_STANDALONE
SENTRY_BUILD_STATIC
SENTRY_HANDLER_STACK_SIZE=${SENTRY_HANDLER_STACK_SIZE}
)

# Windows-specific compile definitions
if(WIN32)
target_compile_definitions(sentry-crash PRIVATE
SENTRY_THREAD_STACK_GUARANTEE_FACTOR=${SENTRY_THREAD_STACK_GUARANTEE_FACTOR}
)
endif()

# Copy include directories from sentry target
target_include_directories(sentry-crash PRIVATE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/backends/native
)

# Link same libraries as sentry
if(WIN32)
target_link_libraries(sentry-crash PRIVATE dbghelp shlwapi version)
elseif(LINUX OR ANDROID)
target_link_libraries(sentry-crash PRIVATE pthread rt dl)
elseif(APPLE)
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
find_library(SECURITY_LIBRARY Security REQUIRED)
target_link_libraries(sentry-crash PRIVATE
${COREFOUNDATION_LIBRARY}
${SECURITY_LIBRARY}
)
endif()

# Transport-specific libraries
if(SENTRY_TRANSPORT_CURL)
target_link_libraries(sentry-crash PRIVATE CURL::libcurl)
endif()

if(SENTRY_TRANSPORT_WINHTTP)
target_link_libraries(sentry-crash PRIVATE winhttp)
endif()


# Compression library
if(SENTRY_TRANSPORT_COMPRESSION)
target_link_libraries(sentry-crash PRIVATE ZLIB::ZLIB)
endif()

# Unwinder libraries (must match sentry target)
if(SENTRY_WITH_LIBUNWINDSTACK)
target_link_libraries(sentry-crash PRIVATE unwindstack)
endif()

if(SENTRY_WITH_LIBUNWIND)
target_include_directories(sentry-crash PRIVATE ${LIBUNWIND_INCLUDE_DIR})
target_link_libraries(sentry-crash PRIVATE ${LIBUNWIND_LIBRARIES})
endif()

# Make sentry library depend on crash daemon so it's always built together
add_dependencies(sentry sentry-crash)

# Install daemon
install(TARGETS sentry-crash
RUNTIME DESTINATION bin
)

if(DEFINED SENTRY_FOLDER)
# Native backend doesn't have separate targets to organize
endif()

message(STATUS "Sentry crash daemon executable: enabled")
endif()

option(SENTRY_INTEGRATION_QT "Build Qt integration")
Expand Down
57 changes: 57 additions & 0 deletions examples/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ has_arg(int argc, char **argv, const char *arg)
return false;
}

static const char *
get_arg_value(int argc, char **argv, const char *arg)
{
for (int i = 1; i < argc - 1; i++) {
if (strcmp(argv[i], arg) == 0) {
return argv[i + 1];
}
}
return NULL;
}

#if defined(SENTRY_PLATFORM_WINDOWS) && !defined(__MINGW32__) \
&& !defined(__MINGW64__)

Expand Down Expand Up @@ -298,10 +309,25 @@ static void *invalid_mem = (void *)0xFFFFFFFFFFFFFF9B; // -100 for memset
static void *invalid_mem = (void *)1;
#endif

// Detect Address Sanitizer (works for both GCC and Clang)
#if defined(__SANITIZE_ADDRESS__)
# define SENTRY_ASAN_ACTIVE 1
#elif defined(__has_feature)
# if __has_feature(address_sanitizer)
# define SENTRY_ASAN_ACTIVE 1
# endif
#endif

static void
trigger_crash()
{
#ifdef SENTRY_ASAN_ACTIVE
// Under ASAN, raise signal directly to bypass ASAN's memory interception.
// ASAN intercepts memset and would abort before our signal handler runs.
raise(SIGSEGV);
#else
memset((char *)invalid_mem, 1, 100);
#endif
}

static void
Expand Down Expand Up @@ -588,6 +614,29 @@ main(int argc, char **argv)
options, discarding_before_send_metric_callback, NULL);
}

if (has_arg(argc, argv, "crash-mode")) {
const char *mode = get_arg_value(argc, argv, "crash-mode");
if (mode != NULL) {
if (strcmp(mode, "minidump") == 0) {
sentry_options_set_crash_reporting_mode(
options, SENTRY_CRASH_REPORTING_MODE_MINIDUMP);
} else if (strcmp(mode, "native") == 0) {
sentry_options_set_crash_reporting_mode(
options, SENTRY_CRASH_REPORTING_MODE_NATIVE);
} else if (strcmp(mode, "native-with-minidump") == 0) {
sentry_options_set_crash_reporting_mode(
options, SENTRY_CRASH_REPORTING_MODE_NATIVE_WITH_MINIDUMP);
}
}
}

// E2E test mode: generate unique test ID for event correlation
char e2e_test_id[37] = { 0 };
if (has_arg(argc, argv, "e2e-test")) {
sentry_uuid_t test_uuid = sentry_uuid_new_v4();
sentry_uuid_as_string(&test_uuid, e2e_test_id);
}

if (0 != sentry_init(options)) {
return EXIT_FAILURE;
}
Expand All @@ -613,6 +662,14 @@ main(int argc, char **argv)
sentry_value_new_string("my_global_value"), NULL));
}

// E2E test mode: set tags and output test ID for event correlation
if (e2e_test_id[0] != '\0') {
sentry_set_tag("test.id", e2e_test_id);
sentry_set_tag("test.suite", "e2e");
printf("TEST_ID:%s\n", e2e_test_id);
fflush(stdout);
}

if (has_arg(argc, argv, "log-attributes")) {
sentry_value_t attributes = sentry_value_new_object();
sentry_value_t attr = sentry_value_new_attribute(
Expand Down
Loading
Loading