diff --git a/.appveyor.yml b/.appveyor.yml index dc3f82d3..375d116e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -30,7 +30,6 @@ install: before_build: - cmd: git submodule update --init --recursive - - scripts\prepare_breakpad.bat # Build config build_script: @@ -48,7 +47,6 @@ build_script: -DCUTTER_PACKAGE_RZ_GHIDRA=ON -DCUTTER_PACKAGE_JSDEC=ON -DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON - -DCUTTER_ENABLE_CRASH_REPORTS=ON -DCMAKE_PREFIX_PATH=%CUTTER_DEPS%\\pyside -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% -G Ninja diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04c93efa..38f9b70f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,8 +120,6 @@ jobs: export CXX="${{matrix.cxx-override}}" fi - source scripts/prepare_breakpad_linux.sh - export PKG_CONFIG_PATH="$CUSTOM_BREAKPAD_PREFIX/lib/pkgconfig:${PKG_CONFIG_PATH:-}" # mkdir build cd build cmake --version @@ -136,7 +134,6 @@ jobs: -DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \ -DCUTTER_ENABLE_PYTHON_BINDINGS=ON \ -DCUTTER_ENABLE_GRAPHVIZ=OFF \ - -DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ -DCUTTER_APPIMAGE_BUILD=ON \ -DCUTTER_ENABLE_PACKAGING=ON \ @@ -191,7 +188,6 @@ jobs: source cutter-deps/env.sh set -euo pipefail export PATH=/usr/local/opt/llvm/bin:$PATH - source scripts/prepare_breakpad_macos.sh mkdir build cd build PACKAGE_NAME=Cutter-${PACKAGE_ID}-macOS-x86_64 @@ -202,7 +198,6 @@ jobs: -DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \ -DCUTTER_ENABLE_PYTHON=ON \ -DCUTTER_ENABLE_PYTHON_BINDINGS=ON \ - -DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ -DCUTTER_ENABLE_PACKAGING=ON \ -DCUTTER_ENABLE_SIGDB=ON \ @@ -213,7 +208,6 @@ jobs: -DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \ -DCUTTER_PACKAGE_RZ_LIBYARA=ON \ -DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \ - -DCMAKE_FRAMEWORK_PATH="$BREAKPAD_FRAMEWORK_DIR" \ -DCPACK_BUNDLE_APPLE_CERT_APP="-" \ .. && \ make -j4; @@ -237,7 +231,6 @@ jobs: set CUTTER_DEPS=%CD%\cutter-deps set PATH=%CD%\cutter-deps\qt\bin;%PATH% call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - call scripts\prepare_breakpad.bat cd mkdir build cd build @@ -255,7 +248,6 @@ jobs: -DCUTTER_PACKAGE_RZ_LIBYARA=ON ^ -DCUTTER_PACKAGE_JSDEC=ON ^ -DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^ - -DCUTTER_ENABLE_CRASH_REPORTS=ON ^ -DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^ -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^ -G Ninja ^ diff --git a/.woodpecker/macos-arm64.yml b/.woodpecker/macos-arm64.yml index 96ce1457..bbff7e68 100644 --- a/.woodpecker/macos-arm64.yml +++ b/.woodpecker/macos-arm64.yml @@ -12,7 +12,6 @@ pipeline: - export PACKAGE_ID=${CI_COMMIT_TAG=git-`date "+%Y-%m-%d"`-${CI_COMMIT_SHA}} - export PACKAGE_NAME=Cutter-$${PACKAGE_ID}-macOS-arm64 - source cutter-deps/env.sh - - source scripts/prepare_breakpad_macos.sh - cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARY="$$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.9.dylib" @@ -20,7 +19,6 @@ pipeline: -DPYTHON_EXECUTABLE="$$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" -DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON - -DCUTTER_ENABLE_CRASH_REPORTS=ON -DCUTTER_USE_BUNDLED_RIZIN=ON -DCUTTER_ENABLE_PACKAGING=ON -DCUTTER_ENABLE_SIGDB=ON @@ -31,7 +29,6 @@ pipeline: -DCUTTER_PACKAGE_RZ_LIBSWIFT=ON -DCUTTER_PACKAGE_RZ_LIBYARA=ON -DCPACK_PACKAGE_FILE_NAME="$$PACKAGE_NAME" - -DCMAKE_FRAMEWORK_PATH="$$BREAKPAD_FRAMEWORK_DIR" -DCPACK_BUNDLE_APPLE_CERT_APP="-" - ninja -C build package: diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c615e56..a62b602a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,6 @@ option(CUTTER_USE_ADDITIONAL_RIZIN_PATHS "Search rizin in additional paths which Disable this option if you are linking against rizin pacakged as proper system library or in a custom path and additional are paths causing problems." ON) option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF) option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF) -option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF) option(CUTTER_APPIMAGE_BUILD "Enable Appimage specific changes. Doesn't cause building of Appimage itself." OFF) tri_option(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING "Use KSyntaxHighlighting" AUTO) tri_option(CUTTER_ENABLE_GRAPHVIZ "Enable use of graphviz for graph layout" AUTO) @@ -136,7 +135,6 @@ if(CUTTER_USE_BUNDLED_RIZIN) endif() message(STATUS "- Python: ${CUTTER_ENABLE_PYTHON}") message(STATUS "- Python Bindings: ${CUTTER_ENABLE_PYTHON_BINDINGS}") -message(STATUS "- Crash Handling: ${CUTTER_ENABLE_CRASH_REPORTS}") message(STATUS "- KSyntaxHighlighting: ${KSYNTAXHIGHLIGHTING_STATUS}") message(STATUS "- Graphviz: ${CUTTER_ENABLE_GRAPHVIZ}") message(STATUS "- Downloads dependencies: ${CUTTER_ENABLE_DEPENDENCY_DOWNLOADS}") diff --git a/cmake/FindBreakpad.cmake b/cmake/FindBreakpad.cmake deleted file mode 100644 index 3cc01ee8..00000000 --- a/cmake/FindBreakpad.cmake +++ /dev/null @@ -1,65 +0,0 @@ -# - Find Breakpad -# -# Breakpad_FOUND - True if Breakpad has been found. -# Breakpad_INCLUDE_DIRS - Breakpad include directory -# Breakpad_LIBRARIES - List of libraries when using Breakpad. - -set(Breakpad_LIBRARIES_VARS "") -if(WIN32) - find_path(Breakpad_INCLUDE_DIRS - client/windows/handler/exception_handler.h - HINTS - "${CMAKE_CURRENT_SOURCE_DIR}/Breakpad/src/src") - - set(Breakpad_LIBRARY_NAMES - exception_handler - crash_generation_client - common - ) - - set(Breakpad_LIBRARIES "") - - foreach(libname ${Breakpad_LIBRARY_NAMES}) - find_library(Breakpad_LIBRARY_${libname} - ${libname} - HINTS - "${CMAKE_CURRENT_SOURCE_DIR}/Breakpad/src/src/client/windows/Release/lib" - REQUIRED) - - list(APPEND Breakpad_LIBRARIES ${Breakpad_LIBRARY_${libname}}) - list(APPEND Breakpad_LIBRARIES_VARS "Breakpad_LIBRARY_${libname}") - endforeach() - - set (Breakpad_LINK_LIBRARIES ${Breakpad_LIBRARIES}) - - set(Breakpad_LIBRARY_DIRS "") -elseif(APPLE) - find_library(Breakpad_LINK_LIBRARIES Breakpad REQUIRED) - set(Breakpad_LIBRARIES ${Breakpad_LINK_LIBRARIES}) - # Assumes Breakpad is packed as Framework - set(Breakpad_INCLUDE_DIRS "${Breakpad_LINK_LIBRARIES}/Headers") -else() - set(Breakpad_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH}) - list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Breakpad/prefix") - - find_package(PkgConfig REQUIRED) - pkg_search_module(Breakpad REQUIRED breakpad-client) - - # reset CMAKE_PREFIX_PATH - set(CMAKE_PREFIX_PATH ${Breakpad_CMAKE_PREFIX_PATH_TEMP}) - mark_as_advanced(Breakpad_CMAKE_PREFIX_PATH_TEMP) -endif() - -# could be simplified in > cmake 3.11 using pkg_search_module IMPORTED_TARGET [GLOBAL] but this would still be required for windows -add_library(Breakpad::client INTERFACE IMPORTED) -set_target_properties(Breakpad::client PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Breakpad_INCLUDE_DIRS}") -set_target_properties(Breakpad::client PROPERTIES - INTERFACE_LINK_LIBRARIES "${Breakpad_LINK_LIBRARIES}") - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Breakpad REQUIRED_VARS Breakpad_LIBRARIES Breakpad_INCLUDE_DIRS ${Breakpad_LIBRARIES_VARS}) - -mark_as_advanced(Breakpad_LIBRARIES_VARS) - diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt index ee962d2e..956fbd18 100644 --- a/dist/CMakeLists.txt +++ b/dist/CMakeLists.txt @@ -77,10 +77,6 @@ if(APPLE) set(CPACK_DMG_VOLUME_NAME "Cutter") set(CPACK_BUNDLE_APPLE_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/macos/Entitlements.plist") set(CPACK_APPLE_BUNDLE_ID "re.rizin.cutter") - if (CUTTER_ENABLE_CRASH_REPORTS) - list(APPEND CPACK_BUNDLE_APPLE_CODESIGN_FILES "/Contents/Frameworks/Breakpad.framework/Versions/Current/Resources/breakpadUtilities.dylib") - endif() - find_program(MACDEPLOYQT_PATH macdeployqt HINTS "${Qt5_DIR}/../../../bin") if(NOT MACDEPLOYQT_PATH) diff --git a/dist/MacOSSetupBundle.cmake.in b/dist/MacOSSetupBundle.cmake.in index ff8bdb35..0259ac41 100644 --- a/dist/MacOSSetupBundle.cmake.in +++ b/dist/MacOSSetupBundle.cmake.in @@ -3,8 +3,6 @@ include(BundleUtilities) set(MACDEPLOYQT_PATH "@MACDEPLOYQT_PATH@") set(INFO_PLIST_PATH "@CPACK_BUNDLE_PLIST@") set(ADJUST_RIZIN_LIBS "@ADJUST_RIZIN_LIBS@") -set(CUTTER_ENABLE_CRASH_REPORTS "@CUTTER_ENABLE_CRASH_REPORTS@") -set(Breakpad_LINK_LIBRARIES "@Breakpad_LINK_LIBRARIES@") set(CUTTER_PACKAGE_DEPENDENCIES "@CUTTER_PACKAGE_DEPENDENCIES@") set(CUTTER_ENABLE_PYTHON "@CUTTER_ENABLE_PYTHON@") @@ -82,9 +80,3 @@ foreach(_lib ${ADJUST_RIZIN_LIBS}) get_filename_component(_name "${_lib}" NAME) file(REMOVE "${BUNDLE_PATH}/Contents/Frameworks/${_name}") endforeach() - -if (CUTTER_ENABLE_CRASH_REPORTS) - message("Copying Breakpad ${Breakpad_LINK_LIBRARIES}") - set(_breakpad_lib "Versions/A/Breakpad") - copy_resolved_framework_into_bundle("${Breakpad_LINK_LIBRARIES}/${_breakpad_lib}" "${FRAMEWORK_DIR}/Breakpad.framework/${_breakpad_lib}") -endif() diff --git a/docs/source/building.rst b/docs/source/building.rst index 5f2d9c0a..95e9cf74 100644 --- a/docs/source/building.rst +++ b/docs/source/building.rst @@ -113,8 +113,7 @@ If you want to use Cutter with another version of Rizin you can set ``-DCUTTER_U .. note:: If you are interested in building Cutter with support for Python plugins, - Syntax Highlighting, Crash Reporting and more, - please look at the full list of `CMake Building Options`_. + Syntax Highlighting and more, please look at the full list of `CMake Building Options`_. After the build process is complete, you should have the ``Cutter`` executable in the **build** dir. @@ -252,7 +251,6 @@ Note that there are some major building options available: Cutter binary release options, not needed for most users and might not work easily outside CI environment: -* ``CUTTER_ENABLE_CRASH_REPORTS`` is used to compile Cutter with crash handling system enabled (Breakpad). * ``CUTTER_ENABLE_DEPENDENCY_DOWNLOADS`` Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by Rizin build. This option is used for preparing Cutter binary release packges. Turned off by default. * ``CUTTER_PACKAGE_DEPENDENCIES`` During install step include the third party dependencies. This option is used for preparing Cutter binary release packges. @@ -271,28 +269,6 @@ Or if one wants to explicitly disable an option: cmake -B build -DCUTTER_ENABLE_PYTHON=OFF --------------- - -Compiling Cutter with Breakpad Support --------------------------------------- - -If you want to build Cutter with crash handling system, you will want to first prepare Breakpad. -For this, simply run one of the scripts (according to your OS) from root Cutter directory: - -.. code:: sh - - source scripts/prepare_breakpad_linux.sh # Linux - source scripts/prepare_breakpad_macos.sh # MacOS - scripts/prepare_breakpad.bat # Windows - -Then if you are building on Linux you want to change ``PKG_CONFIG_PATH`` environment variable -so it contains ``$CUSTOM_BREAKPAD_PREFIX/lib/pkgconfig``. For this simply run - -.. code:: sh - - export PKG_CONFIG_PATH="$CUSTOM_BREAKPAD_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" - - -------------- Troubleshooting diff --git a/docs/source/contributing/code/crash-handling-system.rst b/docs/source/contributing/code/crash-handling-system.rst deleted file mode 100644 index 98004b14..00000000 --- a/docs/source/contributing/code/crash-handling-system.rst +++ /dev/null @@ -1,32 +0,0 @@ -Crash Handling System -===================== - -Cutter uses `Breakpad `__ as a backend -for crash handling. - -Crash Handling System is disabled by default to not interfere with developers while debugging. -To enable this system, set the ``CUTTER_ENABLE_CRASH_REPORTS`` build option. - -Solution Description --------------------- - -There are only 2 source files: - -* ``CrashHandler.h`` -* ``CrashHandler.cpp`` - -And the API is very simple: One function, ``initCrashHandler()``, enables the Crash Handling System if -``CUTTER_ENABLE_CRASH_REPORTS`` is true, otherwise it does nothing. - -As soon as a signal is raised, ``crashHandler(int signum)`` is called with the signal's code as an argument. -This function first writes a crash dump to the operating system's temporary directory to catch core and -memory state as it was at the moment of the crash. - -Then the crash dialog is shown: - -.. image :: /images/crash-dialog.png - -If the user chooses to create a crash dump, the prepared dump is moved to the directory specified by the user. -And then the success dialog is shown: - -.. image :: /images/success-dump-dialog.png diff --git a/docs/source/images/crash-dialog.png b/docs/source/images/crash-dialog.png deleted file mode 100644 index a3e50eb2..00000000 Binary files a/docs/source/images/crash-dialog.png and /dev/null differ diff --git a/docs/source/images/success-dump-dialog.png b/docs/source/images/success-dump-dialog.png deleted file mode 100644 index 94144c85..00000000 Binary files a/docs/source/images/success-dump-dialog.png and /dev/null differ diff --git a/scripts/breakpad_client.gyp b/scripts/breakpad_client.gyp deleted file mode 100644 index de079c8b..00000000 --- a/scripts/breakpad_client.gyp +++ /dev/null @@ -1,34 +0,0 @@ -{ - 'includes': [ - '../../build/common.gypi' - ], - 'targets': [ - { - 'target_name': 'build_all', - 'type': 'none', - 'dependencies': [ - './crash_generation/crash_generation.gyp:*', - './handler/exception_handler.gyp:*', - './sender/crash_report_sender.gyp:*', - ] - }, - { - 'target_name': 'common', - 'type': 'static_library', - 'include_dirs': [ - '<(DEPTH)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(DEPTH)', - ] - }, - 'sources': [ - '<(DEPTH)/common/windows/guid_string.cc', - '<(DEPTH)/common/windows/guid_string.h', - '<(DEPTH)/common/windows/http_upload.h', - '<(DEPTH)/common/windows/string_utils.cc', - ] - } - ] -} diff --git a/scripts/breakpad_extract_symbols_appimage.py b/scripts/breakpad_extract_symbols_appimage.py deleted file mode 100644 index edf2f7d3..00000000 --- a/scripts/breakpad_extract_symbols_appimage.py +++ /dev/null @@ -1,55 +0,0 @@ - -import sys -import os -import subprocess -import re -import atexit - -if len(sys.argv) != 3: - print(f"usage: {sys.argv[0]} [Cutter.AppImage] [symbols dir]") - exit(1) - -root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) - -def store_syms(syms, syms_dir): - m = re.match(b"MODULE ([^ ]+) ([^ ]+) ([^ ]+) (.+)\n.*", syms) - if m is None: - print("Invalid dump_syms output") - return - - (modos, modarch, modhash, modname) = m.groups() - modname = modname.decode("utf-8") - modhash = modhash.decode("utf-8") - symdir = os.path.join(syms_dir, modname, modhash) - symfile = f"{modname}.sym" - os.makedirs(symdir) - symfile_path = os.path.join(symdir, symfile) - with open(symfile_path, "wb") as f: - f.write(syms) - - print(symfile_path) - -def dump_syms(binary, syms_dir): - dump_syms_exec = os.path.join(root, "breakpad/src/tools/linux/dump_syms/dump_syms") - syms = subprocess.run([dump_syms_exec, binary], capture_output=True).stdout - store_syms(syms, syms_dir) - -appimage = sys.argv[1] -syms_dst = sys.argv[2] - -# stdbuf workaround is needed before https://github.com/AppImage/AppImageKit/commit/e827baa719f5444aeef7202fe1f71c97d4200dde -appimage_p = subprocess.Popen(["stdbuf", "-oL", appimage, "--appimage-mount"], stdout=subprocess.PIPE) -def kill_appimage(): - appimage_p.kill() -atexit.register(kill_appimage) -mount_dir = appimage_p.stdout.readline().strip().decode("utf-8") - -binaries = [ os.path.join(mount_dir, "usr/bin/cutter") ] -for f in os.scandir(os.path.join(mount_dir, "usr/lib")): - if f.is_dir() or f.is_symlink(): - continue - binaries.append(f.path) - -for b in binaries: - dump_syms(b, syms_dst) - diff --git a/scripts/breakpad_macos.patch b/scripts/breakpad_macos.patch deleted file mode 100644 index b446e4f5..00000000 --- a/scripts/breakpad_macos.patch +++ /dev/null @@ -1,1377 +0,0 @@ -From e2797a7f1853a22a7c7b57dcb3e642f9325a5a88 Mon Sep 17 00:00:00 2001 -From: Ville Suoranta -Date: Thu, 15 Nov 2018 13:56:01 -0500 -Subject: [PATCH] Update Breakpad.xib minimum target to OSX10.11 - -Bug: https://bugs.chromium.org/p/google-breakpad/issues/detail?id=778 -Change-Id: I32a36e47d0aab92e5ac40e7fbaa3c5caaaff2318 ---- - -diff --git a/src/client/mac/sender/Breakpad.xib b/src/client/mac/sender/Breakpad.xib -index 7966f89..1ecd27e 100644 ---- a/src/client/mac/sender/Breakpad.xib -+++ b/src/client/mac/sender/Breakpad.xib -@@ -1,1140 +1,224 @@ - -- -- -- 1050 -- 10F569 -- 762 -- 1038.29 -- 461.00 -- -- YES -- -- YES -- -- -- YES -- -- -- -- YES -- -- -- -- YES -- -- -- YES -- -- -- -- YES -- -- Reporter -- -- -- FirstResponder -- -- -- NSApplication -- -- -- 1 -- 2 -- {{72, 251}, {490, 489}} -- 536871936 -- -- NSWindow -- -- {1.79769e+308, 1.79769e+308} -- {72, 5} -- -- -- 264 -- -- YES -- -- -- 272 -- -- YES -- -- -- 256 -- -- YES -- -- -- 290 -- {{17, 36}, {456, 70}} -- -- YES -- -- 67239424 -- 272760832 -- Providing your email address is optional and will allow us contact you in case we need more details. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed arcu urna, pulvinar sit amet, tincidunt ac, fermentum ut, ligula. Quisque mi. Duis lectus. Vestibulum velit. Morbi turpis. Nunc at diam consectetur turpis volutpat tristique. Donec quis diam. Suspendisse scelerisque. -- -- LucidaGrande -- 11 -- 3100 -- -- -- -- 6 -- System -- controlColor -- -- 3 -- MC42NjY2NjY2NjY3AA -- -- -- -- 6 -- System -- controlTextColor -- -- 3 -- MAA -- -- -- -- -- -- -- 290 -- {{87, 9}, {195, 19}} -- -- YES -- -- -1804468671 -- 272761856 -- -- -- optional -- -- YES -- -- 6 -- System -- textBackgroundColor -- -- 3 -- MQA -- -- -- -- 6 -- System -- textColor -- -- -- -- -- -- -- 292 -- {{17, 11}, {65, 14}} -- -- YES -- -- 68288064 -- 71435264 -- EmailLabel: -- -- -- -- -- -- -- -- -- 289 -- {{456, 10}, {16, 17}} -- -- YES -- -- -2080244224 -- 0 -- Privacy Policy -- -- LucidaGrande -- 13 -- 1044 -- -- -- -2040250113 -- 36 -- -- NSImage -- goArrow -- -- -- -- 400 -- 75 -- -- -- -- -- 289 -- {{355, 11}, {100, 14}} -- -- YES -- -- 68288064 -- 4326400 -- PrivacyPolicyLabel -- -- -- -- -- -- -- -- {490, 114} -- -- -- -- {{0, 51}, {490, 114}} -- -- {0, 0} -- -- 67239424 -- 0 -- Title -- -- LucidaGrande -- 11 -- 16 -- -- -- -- 3 -- MCAwLjgwMDAwMDAxAA -- -- -- -- 0 -- 3 -- 0 -- NO -- -- -- -- 289 -- {{330, 12}, {146, 32}} -- -- YES -- -- 67239424 -- 134217728 -- SendReportLabel -- -- -- -2038284033 -- 129 -- -- -- DQ -- 200 -- 25 -- -- -- -- -- 289 -- {{214, 12}, {116, 32}} -- -- YES -- -- 67239424 -- 134217728 -- CancelLabel -- -- -- -2038284033 -- 129 -- -- -- Gw -- 200 -- 25 -- -- -- -- -- 256 -- -- YES -- -- -- 256 -- -- YES -- -- -- 266 -- {{17, 83}, {456, 154}} -- -- YES -- -- 67239424 -- 272760832 -- VGhlIHN5c3RlbSBhbmQgb3RoZXIgYXBwbGljYXRpb25zIGhhdmUgbm90IGJlZW4gYWZmZWN0ZWQuIEEg --cmVwb3J0IGhhcyBiZWVuIGNyZWF0ZWQgdGhhdCB5b3UgY2FuIHNlbmQgdG8gPFJlYWxseSBMb25nIENv --bXBhbnkgTmFtZT4gdG8gaGVscCBpZGVudGlmeSB0aGUgcHJvYmxlbS4gTG9yZW0gaXBzdW0gZG9sb3Ig --c2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gU2VkIGFyY3UgdXJuYSwgcHVsdmlu --YXIgc2l0IGFtZXQsIHRpbmNpZHVudCBhYywgZmVybWVudHVtIHV0LCBsaWd1bGEuIFF1aXNxdWUgbWku --IER1aXMgbGVjdHVzLiBWZXN0aWJ1bHVtIHZlbGl0LiBNb3JiaSB0dXJwaXMuIE51bmMgYXQgZGlhbSBj --b25zZWN0ZXR1ciB0dXJwaXMgdm9sdXRwYXQgdHJpc3RpcXVlLiBEb25lYyBxdWlzIGRpYW0uIFN1c3Bl --bmRpc3NlIHNjZWxlcmlzcXVlLiBRdWlzcXVlIHB1bHZpbmFyIG1pIGlkIHB1cnVzLiBFdGlhbSB2aXRh --ZSB0dXJwaXMgdml0YWUgbmVxdWUgcG9ydGEgY29uZ3VlLgoKUGxlYXNlIGhlbHAgdXMgZml4IHRoZSBw --cm9ibGVtIGJ5IGRlc2NyaWJpbmcgd2hhdCBoYXBwZW5lZCBiZWZvcmUgdGhlIGNyYXNoLiBMb3JlbSBp --cHN1bSBkb2xvciBzaXQgYW1ldCwgY29uc2VjdGV0dXIgYWRpcGlzY2luZyBlbGl0LiBTZWQgYXJjdSB1 --cm5hLCBwdWx2aW5hciBzaXQgYW1ldCwgdGluY2lkdW50IGFjLCBmZXJtZW50dW0gdXQsIGxpZ3VsYS4g --UXVpc3F1ZSBtaS4gRHVpcyBsZWN0dXMuA -- -- -- -- -- -- -- -- -- 274 -- {{20, 14}, {450, 61}} -- -- YES -- -- 341966337 -- 272760832 -- Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 -- -- -- YES -- -- -- -- -- -- -- 256 -- -- YES -- -- -- 256 -- -- YES -- -- -- 266 -- {{85, 10}, {381, 54}} -- -- YES -- -- 67239424 -- 272629760 -- The application <Really Long App Name Here> has quit unexpectedly. -- -- LucidaGrande-Bold -- 14 -- 16 -- -- -- -- -- -- -- -- -- 268 -- -- YES -- -- YES -- Apple PDF pasteboard type -- Apple PICT pasteboard type -- Apple PNG pasteboard type -- NSFilenamesPboardType -- NeXT Encapsulated PostScript v1.2 pasteboard type -- NeXT TIFF v4.0 pasteboard type -- -- -- {{16, 0}, {64, 64}} -- -- YES -- -- 130560 -- 33554432 -- -- NSImage -- NSApplicationIcon -- -- 0 -- 0 -- 0 -- NO -- -- YES -- -- -- {482, 70} -- -- -- -- {{4, 245}, {482, 70}} -- -- {0, 0} -- -- 67239424 -- 0 -- Title -- -- -- -- 3 -- MCAwLjgwMDAwMDAxAA -- -- -- -- 0 -- 3 -- 0 -- NO -- -- -- {490, 325} -- -- -- -- {{0, 160}, {490, 325}} -- -- {0, 0} -- -- 67239424 -- 0 -- Title -- -- -- -- 3 -- MCAwLjgwMDAwMDAxAA -- -- -- -- 0 -- 3 -- 0 -- NO -- -- -- -- 268 -- {{17, 20}, {163, 14}} -- -- YES -- -- 68288064 -- 272630784 -- xx seconds. -- -- -- -- -- -- -- -- {490, 489} -- -- {{0, 0}, {2560, 1578}} -- {72, 27} -- {1.79769e+308, 1.79769e+308} -- -- -- YES -- -- -- -- -- YES -- -- -- sendReport: -- -- -- -- 45 -- -- -- -- cancel: -- -- -- -- 46 -- -- -- -- showPrivacyPolicy: -- -- -- -- 53 -- -- -- -- value: emailValue -- -- -- -- -- -- value: emailValue -- value -- emailValue -- -- NSNullPlaceholder -- optional -- -- 2 -- -- -- 90 -- -- -- -- initialFirstResponder -- -- -- -- 91 -- -- -- -- value: commentsValue -- -- -- -- -- -- value: commentsValue -- value -- commentsValue -- -- NSNullPlaceholder -- optional comments -- -- 2 -- -- -- 124 -- -- -- -- nextKeyView -- -- -- -- 125 -- -- -- -- nextKeyView -- -- -- -- 126 -- -- -- -- nextKeyView -- -- -- -- 127 -- -- -- -- delegate -- -- -- -- 128 -- -- -- -- alertWindow_ -- -- -- -- 142 -- -- -- -- preEmailBox_ -- -- -- -- 150 -- -- -- -- headerBox_ -- -- -- -- 151 -- -- -- -- emailSectionBox_ -- -- -- -- 152 -- -- -- -- privacyLinkLabel_ -- -- -- -- 153 -- -- -- -- commentMessage_ -- -- -- -- 154 -- -- -- -- dialogTitle_ -- -- -- -- 155 -- -- -- -- emailLabel_ -- -- -- -- 156 -- -- -- -- cancelButton_ -- -- -- -- 158 -- -- -- -- sendButton_ -- -- -- -- 159 -- -- -- -- emailEntryField_ -- -- -- -- 161 -- -- -- -- privacyLinkArrow_ -- -- -- -- 162 -- -- -- -- emailMessage_ -- -- -- -- 163 -- -- -- -- commentsEntryField_ -- -- -- -- 176 -- -- -- -- value: countdownMessage -- -- -- -- -- -- value: countdownMessage -- value -- countdownMessage -- 2 -- -- -- 194 -- -- -- -- countdownLabel_ -- -- -- -- 208 -- -- -- -- -- YES -- -- 0 -- -- -- -- -- -- -2 -- -- -- File's Owner -- -- -- -1 -- -- -- First Responder -- -- -- -3 -- -- -- Application -- -- -- 1 -- -- -- YES -- -- -- -- Window -- -- -- 2 -- -- -- YES -- -- -- -- -- -- -- -- -- -- 12 -- -- -- YES -- -- -- -- -- -- 14 -- -- -- YES -- -- -- -- -- -- 132 -- -- -- YES -- -- -- -- -- -- -- -- -- -- 145 -- -- -- YES -- -- -- -- -- -- -- -- 189 -- -- -- YES -- -- -- -- -- -- 191 -- -- -- Shared User Defaults Controller -- -- -- 210 -- -- -- -- -- 211 -- -- -- -- -- 221 -- -- -- -- -- 58 -- -- -- YES -- -- -- -- -- -- 215 -- -- -- -- -- 18 -- -- -- YES -- -- -- -- -- -- 212 -- -- -- -- -- 20 -- -- -- YES -- -- -- -- -- -- 213 -- -- -- -- -- 48 -- -- -- YES -- -- -- -- -- -- 214 -- -- -- -- -- 66 -- -- -- YES -- -- -- -- -- -- 216 -- -- -- -- -- 8 -- -- -- YES -- -- -- -- -- -- 217 -- -- -- -- -- 116 -- -- -- YES -- -- -- -- -- -- 218 -- -- -- -- -- 147 -- -- -- YES -- -- -- -- -- -- -- 3 -- -- -- YES -- -- -- -- -- -- 219 -- -- -- -- -- 6 -- -- -- YES -- -- -- -- -- -- 220 -- -- -- -- -- -- -- YES -- -- YES -- -3.ImportedFromIB2 -- 1.IBEditorWindowLastContentRect -- 1.IBWindowTemplateEditedContentRect -- 1.ImportedFromIB2 -- 1.windowTemplate.hasMinSize -- 1.windowTemplate.minSize -- 116.CustomClassName -- 116.ImportedFromIB2 -- 12.ImportedFromIB2 -- 132.ImportedFromIB2 -- 14.ImportedFromIB2 -- 145.ImportedFromIB2 -- 147.ImportedFromIB2 -- 18.CustomClassName -- 18.ImportedFromIB2 -- 189.ImportedFromIB2 -- 191.ImportedFromIB2 -- 2.ImportedFromIB2 -- 20.ImportedFromIB2 -- 3.ImportedFromIB2 -- 48.ImportedFromIB2 -- 58.ImportedFromIB2 -- 6.ImportedFromIB2 -- 66.ImportedFromIB2 -- 8.ImportedFromIB2 -- -- -- YES -- -- {{0, 656}, {490, 489}} -- {{0, 656}, {490, 489}} -- -- -- {72, 5} -- LengthLimitingTextField -- -- -- -- -- -- -- LengthLimitingTextField -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- YES -- -- -- YES -- -- -- -- -- YES -- -- -- YES -- -- -- -- 221 -- -- -- -- YES -- -- LengthLimitingTextField -- NSTextField -- -- IBUserSource -- -- -- -- -- Reporter -- NSObject -- -- YES -- -- YES -- cancel: -- sendReport: -- showPrivacyPolicy: -- -- -- YES -- id -- id -- id -- -- -- -- YES -- -- YES -- alertWindow_ -- cancelButton_ -- commentMessage_ -- commentsEntryField_ -- countdownLabel_ -- dialogTitle_ -- emailEntryField_ -- emailLabel_ -- emailMessage_ -- emailSectionBox_ -- headerBox_ -- preEmailBox_ -- privacyLinkArrow_ -- privacyLinkLabel_ -- sendButton_ -- -- -- YES -- NSWindow -- NSButton -- NSTextField -- LengthLimitingTextField -- NSTextField -- NSTextField -- LengthLimitingTextField -- NSTextField -- NSTextField -- NSBox -- NSBox -- NSBox -- NSView -- NSTextField -- NSButton -- -- -- -- IBUserSource -- -- -- -- -- -- 0 -- IBCocoaFramework -- -- com.apple.InterfaceBuilder.CocoaPlugin.macosx -- -- -- -- com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 -- -- -- YES -- ../Breakpad.xcodeproj -- 3 -- -- YES -- -- YES -- NSApplicationIcon -- goArrow -- -- -- YES -- {128, 128} -- {128, 128} -- -- -- -- -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ Providing your email address is optional and will allow us contact you in case we need more details. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed arcu urna, pulvinar sit amet, tincidunt ac, fermentum ut, ligula. Quisque mi. Duis lectus. Vestibulum velit. Morbi turpis. Nunc at diam consectetur turpis volutpat tristique. Donec quis diam. Suspendisse scelerisque. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ optional -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ The system and other applications have not been affected. A report has been created that you can send to <Really Long Company Name> to help identify the problem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed arcu urna, pulvinar sit amet, tincidunt ac, fermentum ut, ligula. Quisque mi. Duis lectus. Vestibulum velit. Morbi turpis. Nunc at diam consectetur turpis volutpat tristique. Donec quis diam. Suspendisse scelerisque. Quisque pulvinar mi id purus. Etiam vitae turpis vitae neque porta congue. -+ -+Please help us fix the problem by describing what happened before the crash. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed arcu urna, pulvinar sit amet, tincidunt ac, fermentum ut, ligula. Quisque mi. Duis lectus. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 1 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 2 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 3 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 Line 4 -+ -+ -+ -+ -+ -+ -+ optional comments -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ diff --git a/scripts/prepare_breakpad.bat b/scripts/prepare_breakpad.bat deleted file mode 100644 index fa4fca45..00000000 --- a/scripts/prepare_breakpad.bat +++ /dev/null @@ -1,33 +0,0 @@ -@ECHO OFF -SET ROOT_DIR=%CD% - -powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget https://storage.googleapis.com/chrome-infra/depot_tools.zip -OutFile depot_tools.zip " -7z -bd x %ROOT_DIR%\depot_tools.zip -odepot_tools -powershell -Command "depot_tools\update_depot_tools" -SET BUFF_PATH=%PATH% -SET DEPOT_TOOLS=%ROOT_DIR%\depot_tools -set PATH=%DEPOT_TOOLS%;%BUFF_PATH% - -mkdir %ROOT_DIR%\src\breakpad -CD %ROOT_DIR%\src\breakpad -powershell -Command "fetch breakpad" -powershell -Command "gclient sync" -CD %ROOT_DIR%\src\breakpad\src -powershell -Command "git reset --hard 756daa536ad819eff80172aaab262fb71d1e89fd" - -CD %ROOT_DIR%\src\breakpad\src\src\client\windows -DEL %CD%\breakpad_client.gyp -DEL %CD%\breakpad_client.sln -DEL %CD%\common.vcxproj -DEL %CD%\common.vcxproj.filters -DEL %CD%\build_all.vcxproj -COPY %ROOT_DIR%\scripts\breakpad_client.gyp %CD% - -CD %ROOT_DIR%\src\breakpad\src\src -SET GYP_MSVS_VERSION=2017 -powershell -Command "tools\gyp\gyp.bat --no-circular-check client\windows\breakpad_client.gyp -Dwin_release_RuntimeLibrary=2 -Dwin_debug_RuntimeLibrary=2 -Dplatform=%ARCH% -Dconfiguration=release" -devenv client\windows\breakpad_client.sln /upgrade - -set PATH=%BUFF_PATH% -msbuild /m %CD%\client\windows\breakpad_client.sln /p:Configuration=release /p:Platform=%ARCH% || exit /b 1 -CD %ROOT_DIR% diff --git a/scripts/prepare_breakpad_linux.sh b/scripts/prepare_breakpad_linux.sh deleted file mode 100755 index d0dd82b6..00000000 --- a/scripts/prepare_breakpad_linux.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -euo pipefail - -git clone https://github.com/google/breakpad.git -cd breakpad -git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss -CFLAGS=-w CXXFLAGS=-w ./configure --disable-tools --prefix=`pwd`/prefix && make -j4 && make install || exit 1 - -export CUSTOM_BREAKPAD_PREFIX="`pwd`/prefix" -cd .. diff --git a/scripts/prepare_breakpad_macos.sh b/scripts/prepare_breakpad_macos.sh deleted file mode 100755 index 9c1e2683..00000000 --- a/scripts/prepare_breakpad_macos.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -euo pipefail - -SCRIPTPATH=$(realpath "$(dirname "${BASH_SOURCE[0]}")") - -DIR="$SCRIPTPATH/.." -cd "$DIR" -BREAKPAD_FRAMEWORK_DIR="$DIR/breakpad/framework" -BREAKPAD_DUMP_SYMS_DIR="$DIR/breakpad/bin" -git clone https://github.com/google/breakpad.git -mkdir $BREAKPAD_FRAMEWORK_DIR -mkdir $BREAKPAD_DUMP_SYMS_DIR -cd breakpad -git checkout 4d550cceca107f36c4bc1ea1126b7d32cc50f424 -git apply "$SCRIPTPATH/breakpad_macos.patch" -cd src/client/mac/ && xcodebuild -sdk macosx MACOSX_DEPLOYMENT_TARGET=10.14 -cp -R build/Release/Breakpad.framework "$BREAKPAD_FRAMEWORK_DIR" - -cd $DIR/breakpad -cp -R src/. framework/Breakpad.framework/Headers - -export BREAKPAD_FRAMEWORK_DIR=$BREAKPAD_FRAMEWORK_DIR -cd $DIR diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3c2c97d..f340ee6e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -262,7 +262,6 @@ set(HEADER_FILES common/RunScriptTask.h common/Json.h dialogs/EditMethodDialog.h - common/CrashHandler.h dialogs/TypesInteractionDialog.h widgets/SdbWidget.h plugins/PluginManager.h @@ -393,10 +392,6 @@ if (CUTTER_ENABLE_PYTHON) list(APPEND HEADER_FILES common/QtResImporter.h common/PythonManager.h common/PythonAPI.h) endif() -if(CUTTER_ENABLE_CRASH_REPORTS) - list(APPEND SOURCES common/CrashHandler.cpp) -endif() - if(CUTTER_ENABLE_PYTHON_BINDINGS) set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bindings") set(BINDINGS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/bindings") @@ -471,19 +466,6 @@ if (TARGET Graphviz::GVC) target_compile_definitions(Cutter PRIVATE CUTTER_ENABLE_GRAPHVIZ) endif() -if(CUTTER_ENABLE_CRASH_REPORTS) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(Cutter PRIVATE Threads::Threads) - - add_definitions(-DCUTTER_ENABLE_CRASH_REPORTS) - if (NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ") - endif() - find_package(Breakpad REQUIRED) - target_link_libraries(Cutter PRIVATE Breakpad::client) -endif() - target_link_libraries(Cutter PUBLIC ${QT_PREFIX}::Core ${QT_PREFIX}::Widgets ${QT_PREFIX}::Gui PRIVATE ${QT_PREFIX}::Svg ${QT_PREFIX}::Network) if (CUTTER_QT6) target_link_libraries(Cutter PUBLIC Qt6::Core5Compat Qt6::SvgWidgets) diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index 9d4d4dff..6f0612b4 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -1,5 +1,4 @@ #include "common/PythonManager.h" -#include "common/CrashHandler.h" #include "CutterApplication.h" #include "plugins/PluginManager.h" #include "CutterConfig.h" diff --git a/src/Main.cpp b/src/Main.cpp index 9c45f5e3..8650b94e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3,7 +3,6 @@ #include "core/MainWindow.h" #include "common/UpdateWorker.h" #include "CutterConfig.h" -#include "common/CrashHandler.h" #include "common/SettingsUpgrade.h" #include @@ -55,17 +54,6 @@ static void connectToConsole() int main(int argc, char *argv[]) { -#ifdef CUTTER_ENABLE_CRASH_REPORTS - if (argc >= 3 && QString::fromLocal8Bit(argv[1]) == "--start-crash-handler") { - QApplication app(argc, argv); - QString dumpLocation = QString::fromLocal8Bit(argv[2]); - showCrashDialog(dumpLocation); - return 0; - } - - initCrashHandler(); -#endif - #ifdef Q_OS_WIN connectToConsole(); #endif diff --git a/src/common/CrashHandler.cpp b/src/common/CrashHandler.cpp deleted file mode 100644 index 4c6e56b8..00000000 --- a/src/common/CrashHandler.cpp +++ /dev/null @@ -1,163 +0,0 @@ -#include "CrashHandler.h" -#include "BugReporting.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#if defined(Q_OS_LINUX) -# include "client/linux/handler/exception_handler.h" -#elif defined(Q_OS_WIN32) -# include "client/windows/handler/exception_handler.h" -#elif defined(Q_OS_MACOS) -# include "client/mac/handler/exception_handler.h" -#endif // Q_OS - -static google_breakpad::ExceptionHandler *exceptionHandler = nullptr; - -static void finishCrashHandler() -{ - delete exceptionHandler; -} - -#ifdef Q_OS_WIN32 -// Called if crash dump was successfully created -// Saves path to file -bool callback(const wchar_t *_dump_dir, const wchar_t *_minidump_id, void *context, - EXCEPTION_POINTERS *exinfo, MDRawAssertionInfo *assertion, bool success) -{ - const QDir dir = QString::fromWCharArray(_dump_dir); - const QString id = QString::fromWCharArray(_minidump_id); - QProcess::startDetached(QCoreApplication::applicationFilePath(), - { "--start-crash-handler", dir.filePath(id + ".dmp") }); - _exit(1); - return true; -} -#elif defined(Q_OS_LINUX) -// Called if crash dump was successfully created -// Saves path to file -bool callback(const google_breakpad::MinidumpDescriptor &md, void *context, bool b) -{ - QProcess::startDetached(QCoreApplication::applicationFilePath(), - { "--start-crash-handler", md.path() }); - _exit(1); - return true; -} -#elif defined(Q_OS_MACOS) -// Called if crash dump was successfully created -// Saves path to file -bool callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) -{ - const QDir dir = QString::fromUtf8(dump_dir); - const QString id = QString::fromUtf8(minidump_id); - QProcess::startDetached(QCoreApplication::applicationFilePath(), - { "--start-crash-handler", dir.filePath(id + ".dmp") }); - _exit(1); - return true; -} -#endif // Q_OS - -void initCrashHandler() -{ - if (exceptionHandler) { - return; - } - // Here will be placed crash dump at the first place - // and then moved if needed - -#if defined(Q_OS_LINUX) - static std::string tmpLocation = - QStandardPaths::writableLocation(QStandardPaths::TempLocation).toStdString(); - exceptionHandler = new google_breakpad::ExceptionHandler( - google_breakpad::MinidumpDescriptor(tmpLocation), nullptr, callback, nullptr, true, -1); -#elif defined(Q_OS_MACOS) - static std::string tmpLocation = - QStandardPaths::writableLocation(QStandardPaths::TempLocation).toStdString(); - exceptionHandler = new google_breakpad::ExceptionHandler(tmpLocation, nullptr, callback, - nullptr, true, nullptr); -#else - static std::wstring tmpLocation = - QStandardPaths::writableLocation(QStandardPaths::TempLocation).toStdWString(); - exceptionHandler = - new google_breakpad::ExceptionHandler(tmpLocation, nullptr, callback, nullptr, - google_breakpad::ExceptionHandler::HANDLER_ALL); -#endif - atexit(finishCrashHandler); -} - -void showCrashDialog(const QString &dumpFile) -{ - QMessageBox mb; - mb.setWindowTitle(QObject::tr("Crash")); - mb.setText(QObject::tr("Cutter received a signal it can't handle and will close.
" - "Would you like to create a crash dump for a bug report?")); - mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - mb.button(QMessageBox::Yes)->setText(QObject::tr("Create a Crash Dump")); - mb.button(QMessageBox::No)->setText(QObject::tr("Quit")); - mb.setDefaultButton(QMessageBox::Yes); - - bool ok = false; - int ret = mb.exec(); - if (ret == QMessageBox::Yes) { - QString dumpSaveFileName; - int placementFailCounter = 0; - do { - placementFailCounter++; - if (placementFailCounter == 4) { - break; - } - dumpSaveFileName = QFileDialog::getSaveFileName( - nullptr, QObject::tr("Choose a directory to save the crash dump in"), - QStandardPaths::writableLocation(QStandardPaths::HomeLocation) - + QDir::separator() + "Cutter_crash_dump_" - + QDate::currentDate().toString("dd.MM.yy") + "_" - + QTime::currentTime().toString("HH.mm.ss") + ".dmp", - QObject::tr("Minidump (*.dmp)")); - - if (dumpSaveFileName.isEmpty()) { - return; - } - if (QFile::rename(dumpFile, dumpSaveFileName)) { - ok = true; - break; - } - QMessageBox::critical(nullptr, QObject::tr("Save Crash Dump"), - QObject::tr("Failed to write to %1.
" - "Please make sure you have access to that directory " - "and try again.") - .arg(QFileInfo(dumpSaveFileName).dir().path())); - } while (true); - - if (ok) { - QMessageBox info; - info.setWindowTitle(QObject::tr("Success")); - info.setText(QObject::tr("Crash dump was successfully created.") - .arg(QFileInfo(dumpSaveFileName).dir().path())); - info.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - - info.button(QMessageBox::Yes)->setText(QObject::tr("Open an Issue")); - info.button(QMessageBox::No)->setText(QObject::tr("Quit")); - info.setDefaultButton(QMessageBox::Yes); - - int ret = info.exec(); - if (ret == QMessageBox::Yes) { - openIssue(); - } - } else { - QMessageBox::critical(nullptr, QObject::tr("Error"), - QObject::tr("Error occurred during crash dump creation.")); - } - } else { - QFile f(dumpFile); - f.remove(); - } -} diff --git a/src/common/CrashHandler.h b/src/common/CrashHandler.h deleted file mode 100644 index 77ef6bf2..00000000 --- a/src/common/CrashHandler.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef CRASH_HANDLER_H -#define CRASH_HANDLER_H - -#include - -/** - * @fn void initCrashHandler() - * - * If CUTTER_ENABLE_CRASH_REPORTS is true, initializes - * crash handling and reporting, otherwise does nothing. - */ -void initCrashHandler(); - -void showCrashDialog(const QString &dumpFile); - -#endif // CRASH_HANDLER_H