From 990137bab06b6bff4f305520e5487b9d6ac1aefa Mon Sep 17 00:00:00 2001 From: alves Date: Wed, 3 Dec 2025 12:05:46 +0800 Subject: [PATCH 1/5] feature add cli upload pdb to sentry server --- .github/workflows/sentry_cli.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sentry_cli.yml b/.github/workflows/sentry_cli.yml index 976ca96f78..217624d84e 100644 --- a/.github/workflows/sentry_cli.yml +++ b/.github/workflows/sentry_cli.yml @@ -40,13 +40,22 @@ jobs: shell: pwsh env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_LOG_LEVEL: debug run: | - $pdbArchive = Get-ChildItem -Path ./symbols -Filter "*.7z" -File | Select-Object -First 1 - if ($pdbArchive) { - Write-Host "Uploading PDB archive: $($pdbArchive.FullName)" - sentry-cli.exe --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" "$($pdbArchive.FullName)" 2>&1 | Out-Host + $pdbFiles = Get-ChildItem -Path ./symbols -Filter "*.pdb" -File -Recurse + if ($pdbFiles.Count -gt 0) { + Write-Host "Found $($pdbFiles.Count) PDB file(s) to upload:" + $pdbFiles | ForEach-Object { Write-Host " - $($_.FullName)" } + Write-Host "" + Write-Host "Starting Sentry upload with debug logging..." + sentry-cli.exe --log-level=debug --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" ./symbols 2>&1 | Out-Host + if ($LASTEXITCODE -ne 0) { + Write-Host "::error::Sentry upload failed with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } } else { - Write-Host "No PDB archive found in symbols folder" + Write-Host "::error::No PDB files found in symbols folder" + Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" } exit 1 } From e874089831f23a35d3735f5a2ee8cce2f79ba90a Mon Sep 17 00:00:00 2001 From: alves Date: Wed, 3 Dec 2025 12:13:28 +0800 Subject: [PATCH 2/5] feature add flag for control sentry to use --- CMakeLists.txt | 52 +++++++++++++++++++++++++++++++-------------- deps/CMakeLists.txt | 2 +- src/CMakeLists.txt | 6 +++++- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2d90d2521..13642a8cb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,14 @@ option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1) option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1) option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0) option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0) + +# Sentry crash reporting - enabled only on Windows by default +if (WIN32) + set(SLIC3R_SENTRY_DEFAULT ON) +else() + set(SLIC3R_SENTRY_DEFAULT OFF) +endif() +option(SLIC3R_SENTRY "Enable Sentry crash reporting SDK" ${SLIC3R_SENTRY_DEFAULT}) # If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable. CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0) @@ -534,7 +542,9 @@ find_package(TBB REQUIRED) find_package(OpenSSL REQUIRED) find_package(CURL REQUIRED) -find_package(Sentry REQUIRED) +if (SLIC3R_SENTRY) + find_package(Sentry REQUIRED) +endif() find_package(Freetype REQUIRED) @@ -544,19 +554,21 @@ target_link_libraries(libcurl INTERFACE CURL::libcurl) find_package(ZLIB REQUIRED) target_link_libraries(libcurl INTERFACE ZLIB::ZLIB) -add_library(sentry INTERFACE) -target_link_libraries(sentry INTERFACE sentry::sentry) +if (SLIC3R_SENTRY) + add_library(sentry INTERFACE) + target_link_libraries(sentry INTERFACE sentry::sentry) -# Add sentry library directory and link sentry.lib explicitly for Windows -if (WIN32 AND CMAKE_PREFIX_PATH) - # Try to find sentry.lib in the install prefix - file(GLOB _sentry_lib "${CMAKE_PREFIX_PATH}/lib/sentry.lib") - if (_sentry_lib) - target_link_directories(sentry INTERFACE "${CMAKE_PREFIX_PATH}/lib") - target_link_libraries(sentry INTERFACE "sentry.lib") - message(STATUS "Found sentry.lib at: ${CMAKE_PREFIX_PATH}/lib") - else() - message(WARNING "sentry.lib not found in ${CMAKE_PREFIX_PATH}/lib. Sentry SDK may not have been built yet.") + # Add sentry library directory and link sentry.lib explicitly for Windows + if (WIN32 AND CMAKE_PREFIX_PATH) + # Try to find sentry.lib in the install prefix + file(GLOB _sentry_lib "${CMAKE_PREFIX_PATH}/lib/sentry.lib") + if (_sentry_lib) + target_link_directories(sentry INTERFACE "${CMAKE_PREFIX_PATH}/lib") + target_link_libraries(sentry INTERFACE "sentry.lib") + message(STATUS "Found sentry.lib at: ${CMAKE_PREFIX_PATH}/lib") + else() + message(WARNING "sentry.lib not found in ${CMAKE_PREFIX_PATH}/lib. Sentry SDK may not have been built yet.") + endif() endif() endif() @@ -745,7 +757,7 @@ function(Snapmaker_Orca_copy_dlls target config postfix output_dlls) DESTINATION ${_out_dir}) # Copy Sentry and Crashpad artifacts if they were built by deps - if (EXISTS "${CMAKE_PREFIX_PATH}/bin/sentry.dll") + if (SLIC3R_SENTRY AND EXISTS "${CMAKE_PREFIX_PATH}/bin/sentry.dll") file(COPY "${CMAKE_PREFIX_PATH}/bin/sentry.dll" "${CMAKE_PREFIX_PATH}/bin/crashpad_handler.exe" DESTINATION ${_out_dir} @@ -814,12 +826,20 @@ function(Snapmaker_Orca_copy_dlls target config postfix output_dlls) ${_out_dir}/TKXSBase.dll ${_out_dir}/freetype.dll - ${_out_dir}/sentry.dll - ${_out_dir}/crashpad_handler.exe PARENT_SCOPE ) + # Add Sentry DLLs to the output list if Sentry is enabled + if (SLIC3R_SENTRY) + set(${output_dlls} + ${${output_dlls}} + ${_out_dir}/sentry.dll + ${_out_dir}/crashpad_handler.exe + PARENT_SCOPE + ) + endif() + endfunction() diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 89e22ee5e4..126da82e8c 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -315,7 +315,7 @@ if (NOT OPENSSL_FOUND OR NOT CURL_FOUND) endif () set(SENTRY_PKG "") -if (NOT SENTRY_FOUND) +if (SLIC3R_SENTRY AND NOT SENTRY_FOUND) include(Sentry/Sentry.cmake) set(SENTRY_PKG dep_Sentry) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7525f6cf45..a4463c9749 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -183,7 +183,11 @@ if (WIN32) target_compile_definitions(Snapmaker_Orca_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE) add_dependencies(Snapmaker_Orca_app_gui Snapmaker_Orca) set_target_properties(Snapmaker_Orca_app_gui PROPERTIES OUTPUT_NAME "snapmaker-orca") - target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry) + if (SLIC3R_SENTRY) + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly sentry::sentry) + else() + target_link_libraries(Snapmaker_Orca_app_gui PRIVATE boost_headeronly) + endif() endif () # Link the resources dir to where Slic3r GUI expects it From 2a9926503ac7b96d0ff55229ea3d9011b45cb039 Mon Sep 17 00:00:00 2001 From: alves Date: Wed, 3 Dec 2025 14:26:41 +0800 Subject: [PATCH 3/5] fix flag not effect on src/makefile --- deps/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 126da82e8c..de9fae0bc5 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -62,6 +62,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") option(DEP_WX_GTK3 "Build wxWidgets against GTK3" OFF) endif() +# Sentry crash reporting - enabled only on Windows by default +if (WIN32) + set(SLIC3R_SENTRY_DEFAULT ON) +else() + set(SLIC3R_SENTRY_DEFAULT OFF) +endif() +option(SLIC3R_SENTRY "Enable Sentry crash reporting SDK" ${SLIC3R_SENTRY_DEFAULT}) + set(IS_CROSS_COMPILE FALSE) if (APPLE) From 127259f4268b1ec43d87ec88ff13419005715cce Mon Sep 17 00:00:00 2001 From: alves Date: Thu, 4 Dec 2025 10:46:30 +0800 Subject: [PATCH 4/5] feature unzip for dmp file to upload sentry server --- .github/workflows/sentry_cli.yml | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sentry_cli.yml b/.github/workflows/sentry_cli.yml index 217624d84e..0693fab2a0 100644 --- a/.github/workflows/sentry_cli.yml +++ b/.github/workflows/sentry_cli.yml @@ -35,6 +35,26 @@ jobs: name: ${{ inputs.pdb-artifact-name }} path: ./symbols + - name: "[Windows] Extract PDB archive" + if: inputs.os == 'windows-latest' + shell: pwsh + run: | + $archive = Get-ChildItem -Path ./symbols -Filter "*.7z" -File | Select-Object -First 1 + if ($archive) { + Write-Host "Found archive: $($archive.FullName)" + Write-Host "Extracting to ./symbols/extracted ..." + 7z x "$($archive.FullName)" -o"./symbols/extracted" -y + if ($LASTEXITCODE -ne 0) { + Write-Host "::error::Failed to extract archive with exit code $LASTEXITCODE" + exit $LASTEXITCODE + } + Write-Host "Extraction complete. Contents:" + Get-ChildItem -Path ./symbols/extracted -Recurse | ForEach-Object { Write-Host " $($_.FullName)" } + } else { + Write-Host "No .7z archive found, assuming PDB files are already extracted" + Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" } + } + - name: "[Windows] Upload PDB to Sentry (sentry-cli)" if: inputs.os == 'windows-latest' shell: pwsh @@ -42,19 +62,25 @@ jobs: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_LOG_LEVEL: debug run: | - $pdbFiles = Get-ChildItem -Path ./symbols -Filter "*.pdb" -File -Recurse + # Determine upload path - prefer extracted folder if it exists + $uploadPath = "./symbols" + if (Test-Path "./symbols/extracted") { + $uploadPath = "./symbols/extracted" + } + + $pdbFiles = Get-ChildItem -Path $uploadPath -Filter "*.pdb" -File -Recurse if ($pdbFiles.Count -gt 0) { - Write-Host "Found $($pdbFiles.Count) PDB file(s) to upload:" + Write-Host "Found $($pdbFiles.Count) PDB file(s) to upload from $uploadPath :" $pdbFiles | ForEach-Object { Write-Host " - $($_.FullName)" } Write-Host "" Write-Host "Starting Sentry upload with debug logging..." - sentry-cli.exe --log-level=debug --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" ./symbols 2>&1 | Out-Host + sentry-cli.exe --log-level=debug --auth-token $env:SENTRY_AUTH_TOKEN upload-dif --org "${{ secrets.SENTRY_ORG }}" --project "${{ secrets.SENTRY_PROJECT }}" $uploadPath 2>&1 | Out-Host if ($LASTEXITCODE -ne 0) { Write-Host "::error::Sentry upload failed with exit code $LASTEXITCODE" exit $LASTEXITCODE } } else { - Write-Host "::error::No PDB files found in symbols folder" + Write-Host "::error::No PDB files found in $uploadPath" Get-ChildItem -Path ./symbols -Recurse | ForEach-Object { Write-Host " Found: $($_.FullName)" } exit 1 } From d781c29d3afb712c9816f4823a1cd66bcfdedf9b Mon Sep 17 00:00:00 2001 From: alves Date: Thu, 4 Dec 2025 14:36:24 +0800 Subject: [PATCH 5/5] feature remove test code --- src/slic3r/GUI/Preferences.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index e6accab238..9f6da051dd 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1021,11 +1021,6 @@ PreferencesDialog::PreferencesDialog(wxWindow *parent, wxWindowID id, const wxSt : DPIDialog(parent, id, _L("Preferences"), pos, size, style) { SetBackgroundColour(*wxWHITE); - - wxPanel* pPanel = new wxPanel(nullptr); - delete pPanel; - delete pPanel; - create(); wxGetApp().UpdateDlgDarkUI(this); Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& event) {