1\documentclass{article}
2\usepackage[fancyhdr,pdf]{latex2man}
3
4\input{common.tex}
5
6\begin{document}
7
8\begin{Name}{3}{unw\_set\_reg}{David Mosberger-Tang}{Programming Library}{unw\_set\_reg}unw\_set\_reg -- set register contents
9\end{Name}
10
11\section{Synopsis}
12
13\File{\#include $<$libunwind.h$>$}\\
14
15\Type{int} \Func{unw\_set\_reg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_word\_t} \Var{val});\\
16
17\section{Description}
18
19The \Func{unw\_set\_reg}() routine sets the value of register
20\Var{reg} in the stack frame identified by cursor \Var{cp} to the
21value passed in \Var{val}.
22
23The register numbering is target-dependent and described in separate
24manual pages (e.g., libunwind-ia64(3) for the IA-64 target).
25Furthermore, the exact set of accessible registers may depend on the
26type of frame that \Var{cp} is referring to.  For ordinary stack
27frames, it is normally possible to access only the preserved
28(``callee-saved'') registers and frame-related registers (such as the
29stack-pointer).  However, for signal frames (see
30\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access
31all registers.
32
33Note that \Func{unw\_set\_reg}() can only write the contents of
34registers whose values fit in a single word.  See
35\Func{unw\_set\_fpreg}(3) for a way to write registers which do not
36fit this constraint.
37
38\section{Return Value}
39
40On successful completion, \Func{unw\_set\_reg}() returns 0.
41Otherwise the negative value of one of the error-codes below is
42returned.
43
44\section{Thread and Signal Safety}
45
46\Func{unw\_set\_reg}() is thread-safe as well as safe to use
47from a signal handler.
48
49\section{Errors}
50
51\begin{Description}
52\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
53\item[\Const{UNW\_EBADREG}] An attempt was made to write a register
54  that is either invalid or not accessible in the current frame.
55\item[\Const{UNW\_EREADONLY}] An attempt was made to write to a
56  read-only register.
57\end{Description}
58In addition, \Func{unw\_set\_reg}() may return any error returned by
59the \Func{access\_mem}(), \Func{access\_reg}(), and
60\Func{access\_fpreg}() call-backs (see
61\Func{unw\_create\_addr\_space}(3)).
62
63\section{See Also}
64
65\SeeAlso{libunwind(3)},
66\SeeAlso{libunwind-ia64(3)},
67\SeeAlso{unw\_get\_reg(3)},
68\SeeAlso{unw\_is\_signal\_frame(3)},
69\SeeAlso{unw\_set\_fpreg(3)}
70
71\section{Author}
72
73\noindent
74David Mosberger-Tang\\
75Email: \Email{dmosberger@gmail.com}\\
76WWW: \URL{http://www.nongnu.org/libunwind/}.
77\LatexManEnd
78
79\end{document}
80