mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
build: add unwind tables and frame pointers to debug/test builds
This fixes an issue where stack traces were unreliable on some platforms (namely aarch64-linux in a MacOS VM). I'm unsure if this is a bug in Zig (defaults should be changed?) or what, because this isn't necessary on other platforms, but this works around the issue. I've unconditionally enabled this for all platforms, depending on build mode (debug/test) and not the target. This is because I don't think there is a downside for other platforms but if thats wrong we can fix that quickly. Some binaries have this unconditionally enabled regardless of build mode (e.g. the Unicode tables generator) because having symbols in those cases is always useful. Some unrelated GTK test fix is also included here. I'm not sure why CI didn't catch this (perhaps we only run tests for none-runtime) but all tests pass locally and we can look into that elsewhere.
This commit is contained in:
12
build.zig
12
build.zig
@ -110,9 +110,15 @@ pub fn build(b: *std.Build) !void {
|
|||||||
|
|
||||||
const test_exe = b.addTest(.{
|
const test_exe = b.addTest(.{
|
||||||
.name = "ghostty-test",
|
.name = "ghostty-test",
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.filters = if (test_filter) |v| &.{v} else &.{},
|
||||||
.target = config.target,
|
.root_module = b.createModule(.{
|
||||||
.filter = test_filter,
|
.root_source_file = b.path("src/main.zig"),
|
||||||
|
.target = config.target,
|
||||||
|
.optimize = .Debug,
|
||||||
|
.strip = false,
|
||||||
|
.omit_frame_pointer = false,
|
||||||
|
.unwind_tables = .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,7 @@ test "xdgShortcutFromTrigger" {
|
|||||||
|
|
||||||
try testing.expectEqualStrings("LOGO+q", (try xdgShortcutFromTrigger(&buf, .{
|
try testing.expectEqualStrings("LOGO+q", (try xdgShortcutFromTrigger(&buf, .{
|
||||||
.mods = .{ .super = true },
|
.mods = .{ .super = true },
|
||||||
.key = .{ .translated = .q },
|
.key = .{ .unicode = 'q' },
|
||||||
})).?);
|
})).?);
|
||||||
|
|
||||||
try testing.expectEqualStrings("SHIFT+CTRL+ALT+LOGO+backslash", (try xdgShortcutFromTrigger(&buf, .{
|
try testing.expectEqualStrings("SHIFT+CTRL+ALT+LOGO+backslash", (try xdgShortcutFromTrigger(&buf, .{
|
||||||
|
@ -36,11 +36,13 @@ pub fn init(
|
|||||||
const bin_name = try std.fmt.allocPrint(b.allocator, "bench-{s}", .{name});
|
const bin_name = try std.fmt.allocPrint(b.allocator, "bench-{s}", .{name});
|
||||||
const c_exe = b.addExecutable(.{
|
const c_exe = b.addExecutable(.{
|
||||||
.name = bin_name,
|
.name = bin_name,
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = deps.config.target,
|
.root_source_file = b.path("src/main.zig"),
|
||||||
|
.target = deps.config.target,
|
||||||
|
|
||||||
// We always want our benchmarks to be in release mode.
|
// We always want our benchmarks to be in release mode.
|
||||||
.optimize = .ReleaseFast,
|
.optimize = .ReleaseFast,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
c_exe.linkLibC();
|
c_exe.linkLibC();
|
||||||
|
|
||||||
|
@ -26,8 +26,13 @@ pub fn init(
|
|||||||
inline for (manpages) |manpage| {
|
inline for (manpages) |manpage| {
|
||||||
const generate_markdown = b.addExecutable(.{
|
const generate_markdown = b.addExecutable(.{
|
||||||
.name = "mdgen_" ++ manpage.name ++ "_" ++ manpage.section,
|
.name = "mdgen_" ++ manpage.name ++ "_" ++ manpage.section,
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = b.graph.host,
|
.root_source_file = b.path("src/main.zig"),
|
||||||
|
.target = b.graph.host,
|
||||||
|
.strip = false,
|
||||||
|
.omit_frame_pointer = false,
|
||||||
|
.unwind_tables = .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
deps.help_strings.addImport(generate_markdown);
|
deps.help_strings.addImport(generate_markdown);
|
||||||
|
|
||||||
|
@ -13,10 +13,14 @@ install_step: *std.Build.Step.InstallArtifact,
|
|||||||
pub fn init(b: *std.Build, cfg: *const Config, deps: *const SharedDeps) !Ghostty {
|
pub fn init(b: *std.Build, cfg: *const Config, deps: *const SharedDeps) !Ghostty {
|
||||||
const exe: *std.Build.Step.Compile = b.addExecutable(.{
|
const exe: *std.Build.Step.Compile = b.addExecutable(.{
|
||||||
.name = "ghostty",
|
.name = "ghostty",
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = cfg.target,
|
.root_source_file = b.path("src/main.zig"),
|
||||||
.optimize = cfg.optimize,
|
.target = cfg.target,
|
||||||
.strip = cfg.strip,
|
.optimize = cfg.optimize,
|
||||||
|
.strip = cfg.strip,
|
||||||
|
.omit_frame_pointer = cfg.strip,
|
||||||
|
.unwind_tables = if (cfg.strip) .none else .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
const install_step = b.addInstallArtifact(exe, .{});
|
const install_step = b.addInstallArtifact(exe, .{});
|
||||||
|
|
||||||
|
@ -15,8 +15,13 @@ output: std.Build.LazyPath,
|
|||||||
pub fn init(b: *std.Build) !GhosttyFrameData {
|
pub fn init(b: *std.Build) !GhosttyFrameData {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "framegen",
|
.name = "framegen",
|
||||||
.root_source_file = b.path("src/build/framegen/main.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = b.graph.host,
|
.root_source_file = b.path("src/build/framegen/main.zig"),
|
||||||
|
.target = b.graph.host,
|
||||||
|
.strip = false,
|
||||||
|
.omit_frame_pointer = false,
|
||||||
|
.unwind_tables = .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const run = b.addRunArtifact(exe);
|
const run = b.addRunArtifact(exe);
|
||||||
|
@ -18,8 +18,13 @@ pub fn init(
|
|||||||
{
|
{
|
||||||
const webgen_config = b.addExecutable(.{
|
const webgen_config = b.addExecutable(.{
|
||||||
.name = "webgen_config",
|
.name = "webgen_config",
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = b.graph.host,
|
.root_source_file = b.path("src/main.zig"),
|
||||||
|
.target = b.graph.host,
|
||||||
|
.strip = false,
|
||||||
|
.omit_frame_pointer = false,
|
||||||
|
.unwind_tables = .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
deps.help_strings.addImport(webgen_config);
|
deps.help_strings.addImport(webgen_config);
|
||||||
|
|
||||||
|
@ -12,8 +12,13 @@ output: std.Build.LazyPath,
|
|||||||
pub fn init(b: *std.Build, cfg: *const Config) !HelpStrings {
|
pub fn init(b: *std.Build, cfg: *const Config) !HelpStrings {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "helpgen",
|
.name = "helpgen",
|
||||||
.root_source_file = b.path("src/helpgen.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = b.graph.host,
|
.root_source_file = b.path("src/helpgen.zig"),
|
||||||
|
.target = b.graph.host,
|
||||||
|
.strip = false,
|
||||||
|
.omit_frame_pointer = false,
|
||||||
|
.unwind_tables = .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const help_config = config: {
|
const help_config = config: {
|
||||||
|
@ -12,8 +12,13 @@ output: std.Build.LazyPath,
|
|||||||
pub fn init(b: *std.Build) !UnicodeTables {
|
pub fn init(b: *std.Build) !UnicodeTables {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "unigen",
|
.name = "unigen",
|
||||||
.root_source_file = b.path("src/unicode/props.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = b.graph.host,
|
.root_source_file = b.path("src/unicode/props.zig"),
|
||||||
|
.target = b.graph.host,
|
||||||
|
.strip = false,
|
||||||
|
.omit_frame_pointer = false,
|
||||||
|
.unwind_tables = .sync,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (b.lazyDependency("ziglyph", .{
|
if (b.lazyDependency("ziglyph", .{
|
||||||
|
Reference in New Issue
Block a user