mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
feat: add breakpad crash support
This commit is contained in:
parent
5aee6e4627
commit
c969418497
4
.github/scripts/windows-publish.ps1
vendored
4
.github/scripts/windows-publish.ps1
vendored
|
@ -31,6 +31,10 @@ function Main() {
|
|||
# 拷贝exe
|
||||
Copy-Item release\$targetName $archiveName\
|
||||
Write-Host "copy item finished..."
|
||||
|
||||
#拷贝pdb
|
||||
Copy-Item release\*.pdb $archiveName\
|
||||
Write-Host "copy pdb finished..."
|
||||
# 拷贝依赖
|
||||
windeployqt --qmldir . --plugindir $archiveName\plugins --compiler-runtime $archiveName\$targetName
|
||||
# 删除不必要的文件
|
||||
|
|
15
.github/workflows/windows-6.x-xapian.yml
vendored
15
.github/workflows/windows-6.x-xapian.yml
vendored
|
@ -82,6 +82,19 @@ jobs:
|
|||
echo "$previousTag">version.txt
|
||||
cat version.txt
|
||||
|
||||
- name: vcpkg install
|
||||
shell: powershell
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/microsoft/vcpkg.git
|
||||
.\vcpkg\bootstrap-vcpkg.bat
|
||||
# .\vcpkg\vcpkg.exe install ffmpeg[core,avcodec,avformat,mp3lame,opus,speex,swresample,vorbis,fdk-aac,gpl] --triplet=x64-windows-release
|
||||
.\vcpkg\vcpkg.exe install breakpad --triplet=x64-windows-release
|
||||
- name: copy vcpkg packages into winlibs
|
||||
shell: bash
|
||||
run: |
|
||||
cp -R vcpkg/packages/breakpad_x64-windows-release/* thirdparty/breakpad
|
||||
ls -al thirdparty/breakpad
|
||||
|
||||
# # msvc编译
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
# with:
|
||||
|
@ -90,7 +103,7 @@ jobs:
|
|||
id: build
|
||||
shell: cmd
|
||||
run: |
|
||||
qmake "CONFIG+=zim_support" CONFIG+=release CONFIG+=use_xapian CONFIG+=use_iconv
|
||||
qmake "CONFIG+=zim_support" CONFIG+=release CONFIG+=use_xapian CONFIG+=use_iconv CONFIG+=use_breakpad
|
||||
nmake
|
||||
|
||||
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
|
||||
|
|
|
@ -79,6 +79,22 @@ CONFIG( use_xapian ) {
|
|||
LIBS+= -lxapian
|
||||
}
|
||||
|
||||
CONFIG( use_breakpad ) {
|
||||
DEFINES += USE_BREAKPAD
|
||||
|
||||
win32: LIBS += -L$$PWD/thirdparty/breakpad/lib/ -llibbreakpad -llibbreakpad_client
|
||||
else:unix: LIBS += -L$$PWD/thirdparty/breakpad/lib/ -llibbreakpa
|
||||
|
||||
INCLUDEPATH += $$PWD/thirdparty/breakpad/include
|
||||
DEPENDPATH += $$PWD/thirdparty/breakpad/include
|
||||
|
||||
CONFIG( release, debug|release ) {
|
||||
# create debug symbols for release builds
|
||||
CONFIG*=force_debug_info
|
||||
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -O2
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG( use_iconv ) {
|
||||
DEFINES += USE_ICONV
|
||||
unix:!mac{
|
||||
|
|
39
src/main.cc
39
src/main.cc
|
@ -30,6 +30,24 @@
|
|||
|
||||
#include "gddebug.hh"
|
||||
|
||||
#if defined(USE_BREAKPAD)
|
||||
#include "client/windows/handler/exception_handler.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_BREAKPAD)
|
||||
bool callback(const wchar_t* dump_path, const wchar_t* id,
|
||||
void* context, EXCEPTION_POINTERS* exinfo,
|
||||
MDRawAssertionInfo* assertion,
|
||||
bool succeeded) {
|
||||
if (succeeded) {
|
||||
qDebug() << "Create dump file success";
|
||||
} else {
|
||||
qDebug() << "Create dump file failed";
|
||||
}
|
||||
return succeeded;
|
||||
}
|
||||
#endif
|
||||
|
||||
void gdMessageHandler( QtMsgType type, const QMessageLogContext &context, const QString &mess )
|
||||
{
|
||||
Q_UNUSED( context );
|
||||
|
@ -228,8 +246,7 @@ int main( int argc, char ** argv )
|
|||
char ARG_DISABLE_WEB_SECURITY[] = "--disable-web-security";
|
||||
int newArgc = argc + 1 + 1;
|
||||
char ** newArgv = new char *[ newArgc ];
|
||||
for( int i = 0; i < argc; i++ )
|
||||
{
|
||||
for ( int i = 0; i < argc; i++ ) {
|
||||
newArgv[ i ] = argv[ i ];
|
||||
}
|
||||
newArgv[ argc ] = ARG_DISABLE_WEB_SECURITY;
|
||||
|
@ -238,11 +255,27 @@ int main( int argc, char ** argv )
|
|||
QHotkeyApplication app( "GoldenDict", newArgc, newArgv );
|
||||
|
||||
app.setApplicationName( "GoldenDict" );
|
||||
app.setOrganizationDomain( "https://github.com/xiaoyifang/goldendict" );
|
||||
app.setOrganizationDomain( "https://github.com/xiaoyifang/goldendict-ng" );
|
||||
#ifndef Q_OS_MAC
|
||||
app.setWindowIcon( QIcon( ":/icons/programicon.png" ) );
|
||||
#endif
|
||||
|
||||
#if defined(USE_BREAKPAD)
|
||||
QString appDirPath = QCoreApplication::applicationDirPath() + "/crash";
|
||||
|
||||
QDir dir;
|
||||
if (!dir.exists(appDirPath)) {
|
||||
bool res = dir.mkpath(appDirPath);
|
||||
qDebug() << "New mkdir " << appDirPath << " " << res;
|
||||
}
|
||||
|
||||
google_breakpad::ExceptionHandler eh(
|
||||
appDirPath.toStdWString(), NULL, callback, NULL,
|
||||
google_breakpad::ExceptionHandler::HANDLER_ALL);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
GDOptions gdcl{};
|
||||
|
||||
if ( argc > 1 ) {
|
||||
|
|
2
thirdparty/breakpad/Readme.md
vendored
Normal file
2
thirdparty/breakpad/Readme.md
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
This is is a placeholder for breakpad.
|
||||
the lib and include files will be copied here with vcpkg.
|
Loading…
Reference in a new issue