Debian Codegraph @

debug/+netbsd/+x86_64/ucontext.ha

raw
1 // SPDX-License-Identifier: MPL-2.0
2 // (c) Hare authors <https://harelang.org>
3
4 use rt;
5
6 // Returns the stack pointer from a ucontext.
7 fn uctx_sp(uctx: *opaque) uintptr = {
8 const uctx = uctx: *rt::ucontext_t;
9 return uctx.uc_mcontext.mc_rsp: uintptr;
10 };
11
12 // Returns the instruction pointer from a ucontext.
13 fn uctx_ip(uctx: *opaque) uintptr = {
14 const uctx = uctx: *rt::ucontext_t;
15 return uctx.uc_mcontext.mc_rip: uintptr;
16 };
17
18 // Returns the current call frame from a ucontext.
19 fn uctx_frame(uctx: *opaque) stackframe = {
20 const uctx = uctx: *rt::ucontext_t;
21 return *(uctx.uc_mcontext.mc_rbp: uintptr: *stackframe);
22 };