Windows Minidump 관리를 용이하게 하기 위해서 Google Crashpad와 Sentry, 그리고 Jenkins를 함께 이용한다.
CrashPad 활성화
#include <filesystem>
#pragma warning(push)
#pragma warning(disable:4819)
#pragma warning(disable:4100)
#include "client/crashpad_client.h"
#include "client/settings.h"
#include "client/crash_report_database.h"
#pragma warning(pop)
#define DUMP_FOLDER L"minidump"
bool start_crashpad() {
const wstring directory_name(DUMP_FOLDER);
std::filesystem::create_directory(directory_name);
// Cache directory that will store crashpad information and minidumps
base::FilePath database(DUMP_FOLDER);
// Path to the out-of-process handler executable
#ifdef _DEBUG
base::FilePath handler(L".\\\\crashpad\\\\Debug_x64\\\\MDd\\\\crashpad_handler.exe");
#else
base::FilePath handler(L".\\\\crashpad\\\\Release_x64\\\\MD\\\\crashpad_handler.exe");
#endif
// URL used to submit minidumps to
std::string url("<https://xxxxxxx.ingest.sentry.io/api/xxxxxxx/minidump/?sentry_key=0000000000000000000>");
// Optional annotations passed via --annotations to the handler
std::map<string, string> annotations;
// Optional arguments to pass to the handler
std::vector<string> arguments;
arguments.push_back("--no-rate-limit");
crashpad::CrashpadClient client;
bool success = client.StartHandler(
handler,
database,
database,
url,
annotations,
arguments,
/* restartable */ true,
/* asynchronous_start */ false
);
return success;
}
위의 설정을 하게 되면 DUMP_FOLDER 안에 아래 그림과 같은 구조로 폴더가 생성되며 오류가 났을 때 reports 폴더 안에 Dump파일이 생성된다.
Application Monitoring and Error Tracking Software
Dump 관리 프로그램
사용방법
const base::FilePath database(DUMP_FOLDER);
const std::unique_ptr<crashpad::CrashReportDatabase> db = crashpad::CrashReportDatabase::Initialize(database);
if (db != nullptr && db->GetSettings() != nullptr) {
db->GetSettings()->SetUploadsEnabled(true);
}
빌드 PC에 Sentry Cli 설치
Scoop Install
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
irm get.scoop.sh | iex
scoop를 이용한 Sentry Cli 설치
scoop install sentry-cli
빌드 PC에서 Sentry-cli를 이용하여 로그인
sentry-cli login
jenkins에 windows command Excute 등록
sentry-cli releases new -o cylee -p minidump %SVN_REVISION%
sentry-cli upload-dif -o cylee -p minidump %JENKINS_HOME%\\test_client.exe %JENKINS_HOME%\\test_client.pdb
sentry-cli upload-dif -o cylee --project minidump --include-sources %WORKSPACE%
sentry-cli releases deploys %SVN_REVISION% new -e alpha
Sentry에 PDB / EXE 직접 업로드
sentry-cli upload-dif -o cylee -p minidump test_client.exe test_client.pdb