1UNW_SET_REG(3) Programming Library UNW_SET_REG(3)
2
3
4
6 unw_set_reg -- set register contents
7
9 #include <libunwind.h>
10
11 int unw_set_reg(unw_cursor_t *cp, unw_regnum_t reg, unw_word_t val);
12
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
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
35 unw_set_reg() is thread-safe as well as safe to use from a signal han‐
36 dler.
37
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
54 libunwind(3), libunwind-ia64(3), unw_get_reg(3), unw_is_sig‐
55 nal_frame(3), unw_set_fpreg(3)
56
58 David Mosberger-Tang
59 Hewlett-Packard Labs
60 Palo-Alto, CA 94304
61 Email: davidm@hpl.hp.com
62 WWW: http://www.hpl.hp.com/research/linux/libunwind/.
63
64
65
66Programming Library 05 August 2004 UNW_SET_REG(3)