1 \documentclass{article}
2 \usepackage[fancyhdr,pdf]{latex2man}
8 \begin{Name}{3}{unw\_get\_reg}{David Mosberger-Tang}{Programming Library}{unw\_get\_reg}unw\_get\_reg -- get register contents
13 \File{\#include $<$libunwind.h$>$}\\
15 \Type{int} \Func{unw\_get\_reg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_word\_t~*}\Var{valp});\\
19 The \Func{unw\_get\_reg}() routine reads the value of register
20 \Var{reg} in the stack frame identified by cursor \Var{cp} and stores
21 the value in the word pointed to by \Var{valp}.
23 The register numbering is target-dependent and described in separate
24 manual pages (e.g., libunwind-ia64(3) for the IA-64 target).
25 Furthermore, the exact set of accessible registers may depend on the
26 type of frame that \Var{cp} is referring to. For ordinary stack
27 frames, it is normally possible to access only the preserved
28 (``callee-saved'') registers and frame-related registers (such as the
29 stack-pointer). However, for signal frames (see
30 \Func{unw\_is\_signal\_frame}(3)), it is usually possible to access
33 Note that \Func{unw\_get\_reg}() can only read the contents of
34 registers whose values fit in a single word. See
35 \Func{unw\_get\_fpreg}(3) for a way to read registers which do not fit
38 \section{Return Value}
40 On successful completion, \Func{unw\_get\_reg}() returns 0.
41 Otherwise the negative value of one of the error-codes below is
44 \section{Thread and Signal Safety}
46 \Func{unw\_get\_reg}() is thread-safe as well as safe to use
47 from a signal handler.
52 \item[\Const{UNW\_EUNSPEC}] An unspecified error occurred.
53 \item[\Const{UNW\_EBADREG}] An attempt was made to read a register
54 that is either invalid or not accessible in the current frame.
56 In addition, \Func{unw\_get\_reg}() may return any error returned by
57 the \Func{access\_mem}(), \Func{access\_reg}(), and
58 \Func{access\_fpreg}() call-backs (see
59 \Func{unw\_create\_addr\_space}(3)).
63 \SeeAlso{libunwind(3)},
64 \SeeAlso{libunwind-ia64(3)},
65 \SeeAlso{unw\_get\_fpreg(3)},
66 \SeeAlso{unw\_is\_signal\_frame(3)},
67 \SeeAlso{unw\_set\_reg(3)}
72 David Mosberger-Tang\\
73 Email: \Email{dmosberger@gmail.com}\\
74 WWW: \URL{http://www.nongnu.org/libunwind/}.