Skip to content

Commit 7d001be

Browse files
authored
Merge branch 'master' into jpnurmi/feat/last-crash
2 parents 94ddc4d + 4e4881c commit 7d001be

61 files changed

Lines changed: 3758 additions & 357 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/docker/alpine/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
ARG BASE=alpine:latest
33
FROM ${BASE}
44

5-
RUN apk update
6-
RUN apk add \
5+
RUN apk add --no-cache \
76
bash \
87
build-base \
98
cargo \
@@ -17,6 +16,9 @@ RUN apk add \
1716
lsb-release-minimal \
1817
mitmproxy \
1918
moreutils \
19+
nodejs \
20+
npm \
21+
openssl-dev \
2022
perl \
2123
powershell \
2224
python3 \

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
pip install --upgrade --requirement tests/requirements.txt
5353
pytest --verbose --benchmark_out=benchmark.json tests/benchmark.py
5454
55-
- uses: benchmark-action/github-action-benchmark@a60cea5bc7b49e15c1f58f411161f99e0df48372 # pin@v1.22.0
55+
- uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # pin@v1.22.1
5656
if: ${{ github.event_name == 'push' }}
5757
with:
5858
name: ${{ runner.os }}

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
submodules: 'recursive'
3131

3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # pin@v4.35.3
33+
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # pin@v4.35.4
3434
with:
3535
languages: ${{ matrix.language }}
3636

@@ -64,4 +64,4 @@ jobs:
6464
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build build --parallel
6565
6666
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # pin@v4.35.3
67+
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # pin@v4.35.4

.github/workflows/console-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ jobs:
6565
REF: ${{ github.ref }}
6666
run: |
6767
if [[ "$EVENT_NAME" == "push" && "$REF" == refs/heads/release/* ]]; then
68-
echo "mode=FULL_TEST" >> "$GITHUB_OUTPUT"
68+
echo "mode=BUILD_ONLY" >> "$GITHUB_OUTPUT"
6969
elif [[ "$EVENT_NAME" == "push" && "$REF" == "refs/heads/master" ]]; then
70-
echo "mode=UNIT_TEST" >> "$GITHUB_OUTPUT"
70+
echo "mode=BUILD_ONLY" >> "$GITHUB_OUTPUT"
7171
else
7272
echo "mode=BUILD_ONLY" >> "$GITHUB_OUTPUT"
7373
fi

.github/workflows/docker.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
matrix:
1818
version:
1919
- '3.21'
20+
- '3.23'
2021

2122
permissions:
2223
contents: read
@@ -34,9 +35,15 @@ jobs:
3435
username: ${{ github.actor }}
3536
password: ${{ secrets.GITHUB_TOKEN }}
3637

37-
- name: Build ${{ env.IMAGE_NAME }}
38-
run: docker build --build-arg BASE=alpine:${{ matrix.version }} -t ${{ env.IMAGE_NAME }} .
39-
working-directory: .github/docker/alpine
38+
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
4039

41-
- name: Push ${{ env.IMAGE_NAME }}
42-
run: docker push ${{ env.IMAGE_NAME }}
40+
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
41+
42+
- uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
43+
with:
44+
push: true
45+
platforms: linux/amd64,linux/arm64
46+
tags: ${{ env.IMAGE_NAME }}
47+
context: .github/docker/alpine
48+
build-args: |
49+
BASE=alpine:${{ matrix.version }}

CHANGELOG.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,32 @@
44

55
**Features**:
66

7+
- Add `sentry_get_last_crash` to allow fetching `event_id` from last crash. ([#1711](https://github.com/getsentry/sentry-native/pull/1711))
8+
9+
## 0.14.2
10+
11+
**Fixes**:
12+
13+
- Protect CMAKE_SYSTEM_VERSION to avoid empty values when cross-building. ([#1720](https://github.com/getsentry/sentry-native/pull/1720))
14+
15+
## 0.14.1
16+
17+
**Features**:
18+
19+
- Add [strict trace continuation](https://develop.sentry.dev/sdk/foundations/trace-propagation/#strict-trace-continuation) via `sentry_options_set_strict_trace_continuation`. ([#1663](https://github.com/getsentry/sentry-native/pull/1663))
720
- Auto-populate `event.user.id` with a persistent per-installation UUID when no explicit user ID is set. ([#1661](https://github.com/getsentry/sentry-native/pull/1661))
821
- Add cache keep modes, including `SENTRY_CACHE_KEEP_ALWAYS` to cache envelopes regardless of upload result. ([#1707](https://github.com/getsentry/sentry-native/pull/1707))
922
- Crashpad: add error log for oversized envelopes (HTTP 413 Content Too Large). ([#1706](https://github.com/getsentry/sentry-native/pull/1706), [crashpad#155](https://github.com/getsentry/crashpad/pull/155))
1023
- Crashpad: support modifying attachments after `sentry_init` on macOS. ([#1705](https://github.com/getsentry/sentry-native/pull/1705), [crashpad#153](https://github.com/getsentry/crashpad/pull/153))
1124
- Add `cache_dir` envelope header for external crash reporters. ([#1698](https://github.com/getsentry/sentry-native/pull/1698))
12-
- Add `sentry_get_last_crash` to allow fetching `event_id` from last crash. ([#1711](https://github.com/getsentry/sentry-native/pull/1711))
25+
- Add `sentry_attachment_set_type` and `SENTRY_ATTACHMENT_TYPE_*` macros for standard Sentry attachment types. ([#1700](https://github.com/getsentry/sentry-native/pull/1700))
26+
- Deprecate `sentry_options_add_view_hierarchy*` in favor of `sentry_attach_file*` with `sentry_attachment_set_type`.
1327

1428
**Fixes**:
1529

1630
- Native/Breakpad/Windows: fixed capturing abort(). ([#1708](https://github.com/getsentry/sentry-native/pull/1708))
31+
- Native/Windows: capture fast-fail and stack buffer overrun crashes via WER. ([#1710](https://github.com/getsentry/sentry-native/pull/1710))
32+
- Preserve cached minidump refs. ([#1715](https://github.com/getsentry/sentry-native/pull/1715))
1733

1834
## 0.14.0
1935

@@ -22,6 +38,20 @@
2238
- Metrics are enabled by default. This behavior first appeared in `0.13.5` and is now documented as part of the `0.14.0` behavior. Applications that do not want to send metrics must explicitly opt out with `sentry_options_set_enable_metrics(options, false)`. ([#1609](https://github.com/getsentry/sentry-native/pull/1609))
2339
- Structured logs are enabled by default. This behavior first appeared in `0.13.9` and is now documented as part of the `0.14.0` behavior. Applications that do not want to capture structured logs must explicitly opt out with `sentry_options_set_enable_logs(options, false)`. ([#1673](https://github.com/getsentry/sentry-native/pull/1673))
2440

41+
**Fixes**:
42+
43+
- Native/Linux: correct `MD_LINUX_MAPS` stream type (was tagged as `MD_LINUX_AUXV`). ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
44+
- Native/Linux: drop non-ELF mappings (e.g. `/dev/shm/*`, `(deleted)` files) from the minidump module list. ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
45+
- Native/Linux: merge non-contiguous mappings of the same shared library into a single module, and use the offset==0 mapping as `base_of_image`. Fixes duplicate `ld-linux` entries that confused some debuggers (notably Windows LLDB) reading Linux ARM64 minidumps. ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
46+
- Native/Linux: log when `uname()` is blocked (sandbox/seccomp) and fall back to `/proc/sys/kernel/osrelease` for the OS version. ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
47+
- Native/Linux: emit `LinuxAuxv`, `LinuxCpuInfo`, `LinuxLsbRelease`, `LinuxCmdLine`, `LinuxEnviron`, and `LinuxDsoDebug` streams alongside the existing set, matching what Breakpad writes. LLDB needs `LinuxAuxv` and `LinuxDsoDebug` to identify the dynamic loader and enumerate loaded shared libraries; without them, opening a minidump in LLDB on Linux would only recover one frame per thread. ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
48+
- Native/Linux: replay each thread's stack memory descriptor into `MemoryListStream`. Previously stack bytes were only referenced from the per-thread record, so debuggers that look up memory by virtual address (LLDB) could not read the stack and unwinding stopped at frame 0 even when `eh_frame` was available. ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
49+
- Native/macOS: replay each thread's stack memory descriptor into `MemoryListStream` so LLDB can read stack contents (same fix as Linux above). ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
50+
51+
**Features**:
52+
53+
- Native (Linux, macOS): SMART minidump mode now also captures memory referenced by the registers and stack contents of every captured thread, matching the semantics of `MiniDumpWithIndirectlyReferencedMemory` on Windows (already in effect for the native Windows backend). For each pointer that resolves into a writable heap region, ~1 KiB is captured around it; total budget capped at 4 MiB per dump. Heap-allocated structs reachable from the crashing call stack can now be inspected in LLDB / VS Code. ([#1694](https://github.com/getsentry/sentry-native/pull/1694))
54+
2555
## 0.13.9
2656

2757
**Features**:

CMakeLists.txt

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,29 @@ else()
198198
message(FATAL_ERROR "SENTRY_TRANSPORT must be one of: ${_SUPPORTED_TRANSPORTS}")
199199
endif()
200200

201+
if(WIN32 AND NOT XBOX)
202+
set(SENTRY_DEFAULT_SCREENSHOT "windows")
203+
set(_SUPPORTED_SCREENSHOTS "windows, none, or custom")
204+
else()
205+
set(SENTRY_DEFAULT_SCREENSHOT "none")
206+
set(_SUPPORTED_SCREENSHOTS "none or custom")
207+
endif()
208+
209+
set(SENTRY_SCREENSHOT ${SENTRY_DEFAULT_SCREENSHOT} CACHE STRING
210+
"The screenshot implementation that sentry uses, can be one of: ${_SUPPORTED_SCREENSHOTS}.")
211+
212+
if(SENTRY_SCREENSHOT STREQUAL "windows")
213+
if(NOT WIN32 OR XBOX)
214+
message(FATAL_ERROR "The windows screenshot implementation is only supported on Windows.")
215+
endif()
216+
set(SENTRY_SCREENSHOT_WINDOWS TRUE)
217+
elseif(SENTRY_SCREENSHOT STREQUAL "custom")
218+
set(SENTRY_SCREENSHOT_CUSTOM TRUE)
219+
elseif(SENTRY_SCREENSHOT STREQUAL "none")
220+
set(SENTRY_SCREENSHOT_NONE TRUE)
221+
else()
222+
message(FATAL_ERROR "SENTRY_SCREENSHOT must be one of: ${_SUPPORTED_SCREENSHOTS}")
223+
endif()
201224

202225
if(SENTRY_BUILD_TESTS OR SENTRY_BUILD_EXAMPLES)
203226
enable_testing()
@@ -601,8 +624,8 @@ elseif(WIN32)
601624
# WaitOnAddress/WakeByAddressSingle require Windows 8+
602625
# (Synchronization.lib). Older targets fall back to sleep-poll.
603626
if(NOT (MSVC AND CMAKE_GENERATOR_TOOLSET MATCHES "_xp$")
604-
AND (${CMAKE_SYSTEM_VERSION} MATCHES "^10"
605-
OR ${CMAKE_SYSTEM_VERSION} MATCHES "^6\\.[23]"))
627+
AND ("${CMAKE_SYSTEM_VERSION}" MATCHES "^10"
628+
OR "${CMAKE_SYSTEM_VERSION}" MATCHES "^6\\.[23]"))
606629
list(APPEND _SENTRY_PLATFORM_LIBS "synchronization")
607630
endif()
608631
endif()
@@ -767,6 +790,25 @@ elseif(SENTRY_BACKEND_NATIVE)
767790
# Native backend sources and configuration are in src/CMakeLists.txt
768791
# The native backend requires C11 for atomics (set in src/CMakeLists.txt)
769792

793+
if(WIN32 AND NOT XBOX)
794+
add_library(sentry-wer SHARED
795+
src/backends/native/sentry_wer.c
796+
src/backends/native/sentry_wer.def
797+
)
798+
target_include_directories(sentry-wer PRIVATE
799+
${PROJECT_SOURCE_DIR}/include
800+
${PROJECT_SOURCE_DIR}/src
801+
${PROJECT_SOURCE_DIR}/src/backends/native
802+
)
803+
target_link_libraries(sentry-wer PRIVATE wer)
804+
set_property(TARGET sentry-wer PROPERTY PREFIX "") # ensure MINGW doesn't prefix "lib" to dll name
805+
set_property(TARGET sentry-wer PROPERTY DEBUG_POSTFIX "") # prevent CMAKE_DEBUG_POSTFIX from being applied
806+
if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC)
807+
set_property(TARGET sentry-wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
808+
endif()
809+
sentry_add_version_resource(sentry-wer "Native WER Module")
810+
endif()
811+
770812
# Build sentry-crash executable for native backend
771813
# Get all sources that were added to sentry target
772814
get_target_property(SENTRY_SOURCES sentry SOURCES)
@@ -837,11 +879,25 @@ elseif(SENTRY_BACKEND_NATIVE)
837879

838880
# Make sentry library depend on crash daemon so it's always built together
839881
add_dependencies(sentry sentry-crash)
882+
if(WIN32 AND NOT XBOX)
883+
add_dependencies(sentry sentry-wer)
884+
endif()
840885

841886
# Install daemon
842887
install(TARGETS sentry-crash
843888
RUNTIME DESTINATION bin
844889
)
890+
if(WIN32 AND NOT XBOX)
891+
install(TARGETS sentry-wer
892+
RUNTIME DESTINATION bin
893+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
894+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
895+
)
896+
if(MSVC)
897+
sentry_install(FILES $<TARGET_PDB_FILE:sentry-wer>
898+
DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
899+
endif()
900+
endif()
845901

846902
if(DEFINED SENTRY_FOLDER)
847903
# Native backend doesn't have separate targets to organize
@@ -928,6 +984,7 @@ if(SENTRY_BUILD_EXAMPLES)
928984

929985
# to test handling SEH by-passing exceptions we need to enable the control flow guard
930986
target_compile_options(sentry_example PRIVATE $<BUILD_INTERFACE:/guard:cf>)
987+
target_link_options(sentry_example PRIVATE $<BUILD_INTERFACE:/GUARD:CF>)
931988
else()
932989
# Disable all optimizations for the `sentry_example` in gcc/clang. This allows us to keep crash triggers simple.
933990
# The effects besides reproducible code-gen across compiler versions, will be negligible for build- and runtime.

examples/example.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,14 @@ main(int argc, char **argv)
600600
sentry_options_set_traces_sample_rate(options, 1.0);
601601
}
602602

603+
if (has_arg(argc, argv, "org-id")) {
604+
sentry_options_set_org_id(options, "123456");
605+
}
606+
607+
if (has_arg(argc, argv, "strict-trace-continuation")) {
608+
sentry_options_set_strict_trace_continuation(options, 1);
609+
}
610+
603611
if (has_arg(argc, argv, "child-spans")) {
604612
sentry_options_set_max_spans(options, 5);
605613
}
@@ -683,12 +691,6 @@ main(int argc, char **argv)
683691
sentry_options_set_crashpad_wait_for_upload(options, true);
684692
}
685693

686-
if (has_arg(argc, argv, "attach-view-hierarchy")) {
687-
// assuming the example / test is run directly from the cmake build
688-
// directory
689-
sentry_options_add_view_hierarchy(options, "./view-hierarchy.json");
690-
}
691-
692694
if (has_arg(argc, argv, "test-logger")) {
693695
// Set up the test logger for integration tests
694696
sentry_options_set_logger(options, test_logger_callback, NULL);
@@ -862,6 +864,14 @@ main(int argc, char **argv)
862864
= sentry_attach_bytes("\xc0\xff\xee", 3, "bytes.bin");
863865
sentry_attachment_set_content_type(bytes, "application/octet-stream");
864866
}
867+
if (has_arg(argc, argv, "attach-view-hierarchy")) {
868+
// assuming the example / test is run directly from the cmake build
869+
// directory
870+
sentry_attachment_t *view_hierarchy
871+
= sentry_attach_file("./view-hierarchy.json");
872+
sentry_attachment_set_type(
873+
view_hierarchy, SENTRY_ATTACHMENT_TYPE_VIEW_HIERARCHY);
874+
}
865875

866876
if (sentry_options_get_enable_logs(options)) {
867877
if (has_arg(argc, argv, "capture-log")) {
@@ -1168,6 +1178,20 @@ main(int argc, char **argv)
11681178
sentry_transaction_context_update_from_header(
11691179
tx_ctx, "sentry-trace", trace_header);
11701180
}
1181+
if (has_arg(argc, argv, "incoming-trace")) {
1182+
sentry_transaction_context_update_from_header(tx_ctx,
1183+
"sentry-trace",
1184+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bbbbbbbbbbbbbbbb-1");
1185+
}
1186+
if (has_arg(argc, argv, "incoming-baggage")) {
1187+
sentry_transaction_context_update_from_header(tx_ctx, "baggage",
1188+
"sentry-org_id=123456,sentry-environment=upstream,"
1189+
"sentry-release=upstream-app%401.0");
1190+
}
1191+
if (has_arg(argc, argv, "incoming-baggage-mismatch")) {
1192+
sentry_transaction_context_update_from_header(tx_ctx, "baggage",
1193+
"sentry-org_id=99999,sentry-environment=upstream");
1194+
}
11711195

11721196
sentry_transaction_t *tx
11731197
= sentry_transaction_start(tx_ctx, custom_sampling_ctx);

0 commit comments

Comments
 (0)