Created
January 13, 2020 19:28
-
-
Save metaleap/244268f50ab5b466809460ada68becaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn FromJson(mem: *std.mem.Allocator, src: []u8) !atem.Prog { | |
var jsonparser = std.json.Parser.init(mem, true); | |
defer jsonparser.deinit(); | |
var jsontree = try jsonparser.parse(src); | |
defer jsontree.deinit(); | |
const rootarr = try as(std.json.Value.Array, std.json.Array, jsontree.root); | |
// defer rootarr.deinit(); | |
return fromJson(mem, rootarr.toSlice()); | |
} |
backtrace:
(lldb) bt
* thread #1, name = 'main', stop reason = signal SIGSEGV: invalid address (fault address: 0x3)
* frame #0: 0x0000000000000003
frame #1: 0x0000000000237ef0 main`std.mem.Allocator.free(self=0x00007fffffffde48, memory=<unavailable>) at mem.zig:237:44
frame #2: 0x000000000022efcb main`std.array_list.AlignedArrayList(self=std.array_list.AlignedArrayList(std.json.Value,null) @ 0x00007fffffffdfa0).deinit at array_list.zig:54:32
frame #3: 0x000000000022df2f main`load.FromJson(mem=0x00007fffffffe338, src=(ptr = "[ [ [\"[0]std.same\",\"it\"], [1],\n\t\t\"0\" ]\n, [ [\"[1]std.True\",\"__Bool_Of_True\",\"__Bool_Of_False\"], [1,0],\n\t\t\"0\" ]\n, [ [\"[2]std.False\",\"__Bool_Of_True\",\"__Bool_Of_False\"], [0,1],\n\t\t\"1\" ]\n, [ [\"[3]std.ListEnd\",\"__List_Of_ListEnd\",\"__List_Of_ListLink\"], [1,0],\n\t\t\"0\" ]\n, [ [\"[4]std.ListLink\",\"__list0__\",\"__list1__\",\"__List_Of_ListEnd\",\"__List_Of_ListLink\"], [1,1,0,1],\n\t\t[\"3\", \"0\", \"1\"] ]\n, [ [\"[5]std.**\",\"args\"], [2],\n\t\t[[6], [8], [\"0\", [[-1010101], [[4], 102, [[4], 111, [[4], 114, [[4], 103, [[4], 111, [[4], 116, [[4], 32, [[4], 110, [[4], 105, [[4], 108, [[4], 32, [[4], 99, [[4], 104, [[4], 101, [[4], 99, [[4], 107, [[4], 32, [[4], 98, [[4], 101, [[4], 102, [[4], 111, [[4], 114, [[4], 101, [[4], 32, [[4], 62, [[4], 45, [3]]]]]]]]]]]]]]]]]]]]]]]]]]], [0]], [2]], [\"0\", [[-1010101], [[4], 102, [[4], 111, [[4], 114, [[4], 103, [[4], 111, [[4], 116, [[4], 32, [[4], 110, [[4], 105, [[4], 108, [[4], 32, [[4], 99, [[4], 104, [[4], 101, [[4], 99, [[4], 107, [[4], 32, [[4], 98, [[4], 101, [[4], 102, [[4], 111, [[4], 114, [[4"..., len = 1867)) at load.zig:11:25
frame #4: 0x000000000022966f main`main at main.zig:25:35
frame #5: 0x0000000000207986 main`std.start.posixCallMainAndExit at start.zig:259:37
frame #6: 0x000000000020797a main`std.start.posixCallMainAndExit [inlined] std.start.initEventLoopAndCallMain at start.zig:231
frame #7: 0x000000000020797a main`std.start.posixCallMainAndExit [inlined] std.start.callMainWithArgs(argc=2, argv=0x00007fffffffe578, envp=[][*:0]u8 @ 0x00007fffffffe3e0) at start.zig:194
frame #8: 0x0000000000207915 main`std.start.posixCallMainAndExit at start.zig:185
frame #9: 0x0000000000207800 main`std.start._start at start.zig:123:5
up 1:
frame #1: 0x0000000000237ef0 main`std.mem.Allocator.free(self=0x00007fffffffde48, memory=<unavailable>) at mem.zig:237:44
234 const bytes_len = bytes.len + @boolToInt(Slice.sentinel != null);
235 if (bytes_len == 0) return;
236 const non_const_ptr = @intToPtr([*]u8, @ptrToInt(bytes.ptr));
-> 237 const shrink_result = self.shrinkFn(self, non_const_ptr[0..bytes_len], Slice.alignment, 0, 1);
238 assert(shrink_result.len == 0);
239 }
240 };
p *self:
(std.mem.Allocator) $0 = {
reallocFn = 0x0000000000000008
shrinkFn = 0x0000000000000003
}
(std.array_list.AlignedArrayList(std.json.Value,null)) $1 = {
items = {
ptr = 0x00007ffff7fe2828
len = 20
}
len = 12
allocator = 0x00007fffffffde48
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lldb: