pkg/sentry: build in unwinder

This commit is contained in:
Mitchell Hashimoto
2024-08-27 20:36:07 -07:00
parent 1f2d4faa84
commit d66178718c
3 changed files with 20 additions and 2 deletions

View File

@ -32,6 +32,21 @@ pub fn build(b: *std.Build) !void {
var flags = std.ArrayList([]const u8).init(b.allocator);
defer flags.deinit();
try flags.appendSlice(&.{});
if (target.result.os.tag == .windows) {
try flags.appendSlice(&.{
"-DSENTRY_WITH_UNWINDER_DBGHELP",
});
} else {
try flags.appendSlice(&.{
"-DSENTRY_WITH_UNWINDER_LIBBACKTRACE",
});
}
switch (backend) {
.crashpad => try flags.append("-DSENTRY_BACKEND_CRASHPAD"),
.breakpad => try flags.append("-DSENTRY_BACKEND_BREAKPAD"),
.inproc => try flags.append("-DSENTRY_BACKEND_INPROC"),
.none => {},
}
lib.addCSourceFiles(.{
.root = upstream.path(""),
@ -50,7 +65,7 @@ pub fn build(b: *std.Build) !void {
});
}
// Symbolizer
// Symbolizer + Unwinder
if (target.result.os.tag == .windows) {
lib.addCSourceFiles(.{
.root = upstream.path(""),
@ -69,6 +84,7 @@ pub fn build(b: *std.Build) !void {
"src/sentry_unix_pageallocator.c",
"src/path/sentry_path_unix.c",
"src/symbolizer/sentry_symbolizer_unix.c",
"src/unwinder/sentry_unwinder_libbacktrace.c",
},
.flags = flags.items,
});

View File

@ -1333,6 +1333,8 @@ pub fn keyCallback(
self: *Surface,
event: input.KeyEvent,
) !InputEffect {
// To test crash reporting
if (true) @panic("OH NO");
// log.debug("text keyCallback event={}", .{event});
// Setup our inspector event if we have an inspector.

View File

@ -82,7 +82,7 @@ pub const Transport = struct {
/// Implementation of send but we can use Zig errors.
fn sendInternal(envelope: *sentry.Envelope) !void {
// If our envelope doesn't have an event then we don't do anything.
if (envelope.event() == null) return;
// TODO: figure out how to not encode empty envelopes.
var arena = std.heap.ArenaAllocator.init(state.alloc);
defer arena.deinit();