Skip to content

Commit

Permalink
fix assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
laytan committed Jul 16, 2024
1 parent 954ab90 commit 1bfa38c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions back_darwin.odin
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ _trace :: proc(buf: Trace) -> (n: int) {
ctx: unw_context_t
cursor: unw_cursor_t

assert(unw_getcontext(&ctx) == 0)
assert(unw_init_local(&cursor, &ctx) == 0)
ret: i32
ret = unw_getcontext(&ctx)
assert(ret == 0)
ret = unw_init_local(&cursor, &ctx)
assert(ret == 0)

pc: uintptr
for ; unw_step(&cursor) > 0 && n < len(buf); n += 1 {
assert(unw_get_reg(&cursor, .IP, &pc) == 0)
ret = unw_get_reg(&cursor, .IP, &pc)
assert(ret == 0)
buf[n] = rawptr(pc)
}

Expand Down

0 comments on commit 1bfa38c

Please sign in to comment.