mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Remove Breakpad Crash Reporting
Crash dumps generated with breakpad were not made use of to an extent that would justify the extra maintenance overhead that it comes with. As Windows builds have recently been broken by it, now is a good time to retire it.
This commit is contained in:
parent
c5f6cc0c3f
commit
4e0e0000e1
@ -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
|
||||
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -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 ^
|
||||
|
@ -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:
|
||||
|
@ -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}")
|
||||
|
@ -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)
|
||||
|
4
dist/CMakeLists.txt
vendored
4
dist/CMakeLists.txt
vendored
@ -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)
|
||||
|
8
dist/MacOSSetupBundle.cmake.in
vendored
8
dist/MacOSSetupBundle.cmake.in
vendored
@ -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()
|
||||
|
@ -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
|
||||
|
@ -1,32 +0,0 @@
|
||||
Crash Handling System
|
||||
=====================
|
||||
|
||||
Cutter uses `Breakpad <https://github.com/google/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
|
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
@ -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',
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -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)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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%
|
@ -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 ..
|
@ -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
|
@ -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)
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "common/PythonManager.h"
|
||||
#include "common/CrashHandler.h"
|
||||
#include "CutterApplication.h"
|
||||
#include "plugins/PluginManager.h"
|
||||
#include "CutterConfig.h"
|
||||
|
12
src/Main.cpp
12
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 <QJsonObject>
|
||||
@ -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
|
||||
|
@ -1,163 +0,0 @@
|
||||
#include "CrashHandler.h"
|
||||
#include "BugReporting.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <QTime>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QProcess>
|
||||
|
||||
#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.<br/>"
|
||||
"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.<br/>"
|
||||
"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("<a href=\"%1\">Crash dump</a> 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();
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#ifndef CRASH_HANDLER_H
|
||||
#define CRASH_HANDLER_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
/**
|
||||
* @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
|
Loading…
Reference in New Issue
Block a user