Skip to content

Commit

Permalink
sentry-breakpad: implement feedback + MSVC support
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Jun 6, 2021
1 parent 7f6d449 commit 48418da
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions recipes/sentry-breakpad/all/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif()

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 11)

add_subdirectory(source_subfolder/external)
11 changes: 8 additions & 3 deletions recipes/sentry-breakpad/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class SentryBreakpadConan(ConanFile):
name = "sentry-breakpad"
description = "A set of client and server components which implement a crash-reporting system."
description = "Client component that implements a crash-reporting system."
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/getsentry/breakpad"
license = "Apache-2.0"
Expand All @@ -28,12 +28,17 @@ class SentryBreakpadConan(ConanFile):
def _source_subfolder(self):
return "source_subfolder"

@property
def _build_subfolder(self):
return "build_subfolder"

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def requirements(self):
self.requires("linux-syscall-support/cci.20200813")
if self.settings.os in ("FreeBSD", "Linux"):
self.requires("linux-syscall-support/cci.20200813")

def validate(self):
if self.settings.compiler.cppstd:
Expand All @@ -46,7 +51,7 @@ def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.configure()
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

def _patch_sources(self):
Expand Down
35 changes: 34 additions & 1 deletion recipes/sentry-breakpad/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
#include "client/linux/handler/exception_handler.h"
#ifdef _WIN32
# include "client/windows/handler/exception_handler.h"
#else
# include "client/linux/handler/exception_handler.h"
#endif

#include <iostream>

using namespace google_breakpad;

namespace {

#ifdef _WIN32

bool filter_callback(void *context, EXCEPTION_POINTERS *exinfo,
MDRawAssertionInfo* assertion) {
// If a FilterCallback returns true, Breakpad will continue processing
return true;
}

bool callback(const wchar_t* dump_path,
const wchar_t* minidump_id,
void* context,
EXCEPTION_POINTERS* exinfo,
MDRawAssertionInfo* assertion,
bool succeeded) {
// succeeded indicates whether a minidump file was successfully written.
return succeeded;
}
#else
bool callback(const MinidumpDescriptor &descriptor,
void *context,
bool succeeded) {
Expand All @@ -14,12 +36,22 @@ bool callback(const MinidumpDescriptor &descriptor,
// the exception handler's constructor.
return succeeded;
}
#endif

}

int main(int argc, char *argv[]) {
std::cout << "Breakpad test_package\n";

#ifdef _WIN32
ExceptionHandler eh(
/* dump_path */ L".",
filter_callback,
callback,
/* context */ nullptr,
ExceptionHandler::HANDLER_ALL
);
#else
MinidumpDescriptor descriptor("path/to/cache");
ExceptionHandler eh(
descriptor,
Expand All @@ -29,6 +61,7 @@ int main(int argc, char *argv[]) {
/* install handler */ true,
/* server FD */ -1
);
#endif

// run your program here
return 0;
Expand Down

0 comments on commit 48418da

Please sign in to comment.