1UNW_GET_REG(3) Programming Library UNW_GET_REG(3)
2
3
4
6 unw_get_reg -- get register contents
7
9 #include <libunwind.h>
10
11 int unw_get_reg(unw_cursor_t *cp, unw_regnum_t reg, unw_word_t *valp);
12
14 The unw_get_reg() routine reads the value of register reg in the stack
15 frame identified by cursor cp and stores the value in the word pointed
16 to by valp.
17
18 The register numbering is target-dependent and described in separate
19 manual pages (e.g., libunwind-ia64(3) for the IA-64 target). Further‐
20 more, the exact set of accessible registers may depend on the type of
21 frame that cp is referring to. For ordinary stack frames, it is nor‐
22 mally possible to access only the preserved (``callee-saved'') regis‐
23 ters and frame-related registers (such as the stack-pointer). However,
24 for signal frames (see unw_is_signal_frame(3)), it is usually possible
25 to access all registers.
26
27 Note that unw_get_reg() can only read the contents of registers whose
28 values fit in a single word. See unw_get_fpreg(3) for a way to read
29 registers which do not fit this constraint.
30
32 On successful completion, unw_get_reg() returns 0. Otherwise the nega‐
33 tive value of one of the error-codes below is returned.
34
36 unw_get_reg() is thread-safe as well as safe to use from a signal han‐
37 dler.
38
40 UNW_EUNSPEC
41 An unspecified error occurred.
42
43 UNW_EBADREG
44 An attempt was made to read a register that is either invalid
45 or not accessible in the current frame.
46
47 In addition, unw_get_reg() may return any error returned by the
48 access_mem(), access_reg(), and access_fpreg() call-backs (see unw_cre‐
49 ate_addr_space(3)).
50
52 libunwind(3), libunwind-ia64(3), unw_get_fpreg(3), unw_is_sig‐
53 nal_frame(3), unw_set_reg(3)
54
56 David Mosberger-Tang
57 Email: dmosberger@gmail.com
58 WWW: http://www.nongnu.org/libunwind/.
59
60
61
62Programming Library 16 August 2007 UNW_GET_REG(3)