1UNW_INIT_LOCAL(3) Programming Library UNW_INIT_LOCAL(3)
2
3
4
6 unw_init_local -- initialize cursor for local unwinding
7
9 #include <libunwind.h>
10
11 int unw_init_local(unw_cursor_t *c, unw_context_t *ctxt);
12 int unw_init_local2(unw_cursor_t *c, unw_context_t *ctxt, int flag);
13
15 The unw_init_local() routine initializes the unwind cursor pointed to
16 by c with the machine-state in the context structure pointed to by
17 ctxt. As such, the machine-state pointed to by ctxt identifies the
18 initial stack frame at which unwinding starts. The machine-state is
19 expected to be one provided by a call to unw_getcontext; as such, the
20 instruction pointer may point to the instruction after the last
21 instruction of a function, and libunwind will back-up the instruction
22 pointer before beginning a walk up the call stack. The machine-state
23 must remain valid for the duration for which the cursor c is in use.
24
25 The unw_init_local() routine can be used only for unwinding in the
26 address space of the current process (i.e., for local unwinding). For
27 all other cases, unw_init_remote() must be used instead. However,
28 unwind performance may be better when using unw_init_local(). Also,
29 unw_init_local() is available even when UNW_LOCAL_ONLY has been defined
30 before including <libunwind.h>, whereas unw_init_remote() is not.
31
32 If the unw_context_t is known to be a signal frame (i.e., from the
33 third argument in a sigaction handler on linux), unw_init_local2()
34 should be used for correct initialization on some platforms, passing
35 the UNW_INIT_SIGNAL_FRAME flag.
36
38 On successful completion, unw_init_local() returns 0. Otherwise the
39 negative value of one of the error-codes below is returned.
40
42 unw_init_local() is thread-safe as well as safe to use from a signal
43 handler.
44
46 UNW_EINVAL
47 unw_init_local() was called in a version of libunwind which
48 supports remote unwinding only (this normally happens when call‐
49 ing unw_init_local() for a cross-platform version of libunwind).
50
51 UNW_EUNSPEC
52 An unspecified error occurred.
53
54 UNW_EBADREG
55 A register needed by unw_init_local() wasn't accessible.
56
58 libunwind(3), unw_init_remote(3)
59
61 David Mosberger-Tang
62 Email: dmosberger@gmail.com
63 WWW: http://www.nongnu.org/libunwind/.
64
65
66
67Programming Library 16 August 2017 UNW_INIT_LOCAL(3)