mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-12 21:52:57 +01:00
add stack traces to mzte-nv errors
This commit is contained in:
parent
f74f7b0fd4
commit
2fa42e1507
4 changed files with 38 additions and 28 deletions
|
@ -24,7 +24,10 @@ pub fn build(b: *std.build.Builder) !void {
|
|||
lib.linkLibC();
|
||||
lib.linkSystemLibrary("luajit");
|
||||
|
||||
lib.strip = mode != .Debug;
|
||||
lib.strip = switch (mode) {
|
||||
.Debug, .ReleaseSafe => false,
|
||||
.ReleaseFast, .ReleaseSmall => true,
|
||||
};
|
||||
lib.unwind_tables = true;
|
||||
|
||||
b.getInstallStep().dependOn(&b.addInstallFile(lib.getOutputSource(), "share/nvim/mzte-nv.so").step);
|
||||
|
|
|
@ -11,13 +11,20 @@ pub fn luaFunc(comptime func: fn (*c.lua_State) anyerror!c_int) c.lua_CFunction
|
|||
return &struct {
|
||||
fn f(l: ?*c.lua_State) callconv(.C) c_int {
|
||||
return func(l.?) catch |e| {
|
||||
var buf: [128]u8 = undefined;
|
||||
const err_s = std.fmt.bufPrintZ(
|
||||
&buf,
|
||||
"Zig Error: {s}",
|
||||
.{@errorName(e)},
|
||||
) catch unreachable;
|
||||
c.lua_pushstring(l, err_s.ptr);
|
||||
var buf: [1024 * 4]u8 = undefined;
|
||||
var fbs = std.io.fixedBufferStream(&buf);
|
||||
fbs.writer().print("Zig Error: {s}\n", .{@errorName(e)}) catch @panic("OOM");
|
||||
if (@errorReturnTrace()) |ert| {
|
||||
std.debug.writeStackTrace(
|
||||
ert.*,
|
||||
fbs.writer(),
|
||||
std.heap.c_allocator,
|
||||
std.debug.getSelfDebugInfo() catch @panic("WTF"),
|
||||
.no_color,
|
||||
) catch @panic("OOM");
|
||||
}
|
||||
|
||||
luaPushString(l, fbs.getWritten());
|
||||
_ = c.lua_error(l);
|
||||
unreachable;
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
(define (run)
|
||||
(define nvim-config-dir (build-path (find-system-path 'home-dir) ".config" "nvim"))
|
||||
(install-zig "mzte-nv")
|
||||
(install-zig "mzte-nv" "ReleaseSafe")
|
||||
(rm nvim-config-dir)
|
||||
(copy "mzte-nv/conf" nvim-config-dir)
|
||||
(cmd "mzte-nv-compile" (path->string nvim-config-dir))
|
||||
|
|
|
@ -34,26 +34,26 @@
|
|||
(define-logging copy copy-directory/files)
|
||||
|
||||
(define-logging install-zig
|
||||
(λ (path)
|
||||
(parameterize ([current-directory path] [log-calls #f])
|
||||
(cmd "zig" "build" "-p" (output-bin-path) "-Doptimize=ReleaseFast"))))
|
||||
(λ (path [mode "ReleaseFast"])
|
||||
(parameterize ([current-directory path] [log-calls #f])
|
||||
(cmd "zig" "build" "-p" (output-bin-path) (string-append "-Doptimize=" mode)))))
|
||||
|
||||
(define-logging install-rust
|
||||
(λ (path)
|
||||
(parameterize ([current-directory path] [log-calls #f])
|
||||
(cmd "cargo"
|
||||
"-Z"
|
||||
"unstable-options"
|
||||
"build"
|
||||
"--release"
|
||||
"--out-dir"
|
||||
(build-path (output-bin-path) "bin")))))
|
||||
(λ (path)
|
||||
(parameterize ([current-directory path] [log-calls #f])
|
||||
(cmd "cargo"
|
||||
"-Z"
|
||||
"unstable-options"
|
||||
"build"
|
||||
"--release"
|
||||
"--out-dir"
|
||||
(build-path (output-bin-path) "bin")))))
|
||||
|
||||
(define-logging
|
||||
install-roswell
|
||||
(λ (path)
|
||||
(parameterize ([log-calls #f])
|
||||
(match-let*-values ([(_ filename _) (split-path path)]
|
||||
[(outpath)
|
||||
(build-path (output-bin-path) "bin" (path-replace-extension filename ""))])
|
||||
(cmd "ros" "dump" "executable" path "-o" outpath)))))
|
||||
install-roswell
|
||||
(λ (path)
|
||||
(parameterize ([log-calls #f])
|
||||
(match-let*-values ([(_ filename _) (split-path path)]
|
||||
[(outpath)
|
||||
(build-path (output-bin-path) "bin" (path-replace-extension filename ""))])
|
||||
(cmd "ros" "dump" "executable" path "-o" outpath)))))
|
||||
|
|
Loading…
Reference in a new issue