1UNW_SET_REG(3)               Programming Library                UNW_SET_REG(3)
2
3
4

NAME

6       unw_set_reg -- set register contents
7

SYNOPSIS

9       #include <libunwind.h>
10
11       int unw_set_reg(unw_cursor_t *cp, unw_regnum_t reg, unw_word_t val);
12

DESCRIPTION

14       The  unw_set_reg()  routine sets the value of register reg in the stack
15       frame identified by cursor cp to the value passed in val.
16
17       The register numbering is target-dependent and  described  in  separate
18       manual  pages (e.g., libunwind-ia64(3) for the IA-64 target).  Further‐
19       more, the exact set of accessible registers may depend on the  type  of
20       frame  that  cp  is referring to. For ordinary stack frames, it is nor‐
21       mally possible to access only the preserved  (``callee-saved'')  regis‐
22       ters  and frame-related registers (such as the stack-pointer). However,
23       for signal frames (see unw_is_signal_frame(3)), it is usually  possible
24       to access all registers.
25
26       Note  that unw_set_reg() can only write the contents of registers whose
27       values fit in a single word. See unw_set_fpreg(3) for a  way  to  write
28       registers which do not fit this constraint.
29

RETURN VALUE

31       On successful completion, unw_set_reg() returns 0.  Otherwise the nega‐
32       tive value of one of the error-codes below is returned.
33

THREAD AND SIGNAL SAFETY

35       unw_set_reg() is thread-safe as well as safe to use from a signal  han‐
36       dler.
37

ERRORS

39       UNW_EUNSPEC
40               An unspecified error occurred.
41
42       UNW_EBADREG
43               An  attempt was made to write a register that is either invalid
44              or not accessible in the current frame.
45
46       UNW_EREADONLY
47               An attempt was made to write to a read-only register.
48
49       In addition,  unw_set_reg()  may  return  any  error  returned  by  the
50       access_mem(), access_reg(), and access_fpreg() call-backs (see unw_cre‐
51       ate_addr_space(3)).
52

SEE ALSO

54       libunwind(3),    libunwind-ia64(3),     unw_get_reg(3),     unw_is_sig‐
55       nal_frame(3), unw_set_fpreg(3)
56

AUTHOR

58       David Mosberger-Tang
59       Email: dmosberger@gmail.com
60       WWW: http://www.nongnu.org/libunwind/.
61
62
63
64Programming Library             16 August 2007                  UNW_SET_REG(3)
Impressum