blob: 6f60264587082e965a2c8d207c5d02a714b83640 [file] [log] [blame]
mostang.com!davidmf18f14e2003-12-10 07:14:38 +00001'\" t
2.\" Manual page created with latex2man on Tue Dec 9 23:06:06 PST 2003
3.\" NOTE: This file is generated, DO NOT EDIT.
4.de Vb
5.ft CW
6.nf
7..
8.de Ve
9.ft R
10
11.fi
12..
13.TH "LIBUNWIND\-DYNAMIC" "3" "09 December 2003" "Programming Library " "Programming Library "
14.SH NAME
15libunwind\-dynamic
16\-\- libunwind\-support for runtime\-generated code
17.PP
18.SH INTRODUCTION
19
20.PP
21For libunwind
22to do its work, it needs to be able to
23reconstruct the \fIframe state\fP
24of each frame in a call\-chain. The
25frame state consists of some frame registers (such as the
26instruction\-pointer and the stack\-pointer) and the locations at which
27the current values of every callee\-saved (``preserved\&'') resides.
28.PP
29The purpose of the dynamic unwind\-info is therefore to provide
30libunwind
31the minimal information it needs about each
32dynamically generated procedure such that it can reconstruct the
33procedure\&'s frame state.
34.PP
35For the purpose of the following discussion, a \fIprocedure\fP
36is any
37contiguous piece of code. Normally, each procedure directly
38corresponds to a function in the source\-language but this is not
39strictly required. For example, a runtime code\-generator could
40translate a given function into two separate (discontiguous)
41procedures: one for frequently\-executed (hot) code and one for
42rarely\-executed (cold) code. Similarly, simple source\-language
43functions (usually leaf functions) may get translated into code for
44which the default unwind\-conventions apply and for such code, no
45dynamic unwind info needs to be registered.
46.PP
47Within a procedure, the code can be thought of as being divided into a
48sequence of \fIregions\fP\&.
49Each region logically consists of an
50optional \fIprologue\fP,
51a \fIbody\fP,
52and an optional
53\fIepilogue\fP\&.
54If present, the prologue sets up the frame state for
55the body, which does the actual work of the procedure. For example,
56the prologue may need to allocate a stack\-frame and save some
57callee\-saved registers before the body can start executing.
58Correspondingly, the epilogue, if present, restores the previous frame
59state and thereby undoes the effect of the prologue. Regions are
60nested in the sense that the frame state at the end of a region serves
61as the entry\-state of the next region. At the end of several nested
62regions, there may be a single epilogue which undoes the effect of all
63the prologues in the nested regions.
64.PP
65Even though logically we think of the prologue, body, and epilogue as
66separate entities, optimizing code\-generators will generally
67interleave instructions from all three entities to achieve higher
68performance. In fact, as far as the dynamic unwind\-info is concerned,
69there is no distinction at all between prologue and body. Similarly,
70the exact set of instructions that make up an epilogue is also
71irrelevant. The only point in the epilogue that needs to be described
72explicitly is the point at which the stack\-pointer gets restored. The
73reason this point needs to be described is that once the stack\-pointer
74is restored, all values saved in the deallocated portion of the stack
75become invalid. All other locations that store the values of
76callee\-saved register are assumed to remain valid throughout the end
77of the region.
78.PP
79Within a region, each instruction that affects the frame state in some
80fashion needs to be described with an operation descriptor. For this
81purpose, each instruction in the region is assigned a unique index.
82Exactly how this index is derived depends on the architecture. For
83example, on RISC and EPIC\-style architecture, instructions have a
84fixed size so it\&'s possible to simply number the instructions. In
85contrast, most CISC use variable\-length instruction encodings, so it
86is usually necessary to use a byte\-offset as the index. Given the
87instruction index, the operation descriptor specifies the effect of
88the instruction in an abstract manner. For example, it might express
89that the instruction stores calle\-saved register r1
90at offset 16
91in the stack frame.
92.PP
93.SH PROCEDURES
94
95.PP
96unw_dyn_info_t
97unw_dyn_proc_info_t
98unw_dyn_table_info_t
99unw_dyn_remote_table_info_t
100.PP
101.SH REGIONS
102
103.PP
104unw_dyn_region_info_t:
105\- insn_count can be negative to indicate that the region is
106at the end of the procedure; in such a case, the negated
107insn_count value specifies the length of the final region
108in number of instructions. There must be at most one region
109with a negative insn_count and only the last region in a
110procedure\&'s region list may be negative. Furthermore, both
111di\->start_ip and di\->end_ip must be valid.
112.PP
113.SH OPERATIONS
114
115.PP
116unw_dyn_operation_t
117unw_dyn_op_t
118_U_QP_TRUE
119.PP
120unw_dyn_info_format_t
121.PP
122\- instructions don\&'t have to be sorted in increasing order of ``when\&''
123values: In general, if you can generate the sorted order easily
124(e.g., without an explicit sorting step), I\&'d recommend doing so
125because in that case, should some version of libunwind ever require
126sorted order, libunwind can verify in O(N) that the list is sorted
127already. In the particular case of the ia64\-version of libunwind, a
128sorted order won\&'t help, since it always scans the instructions up
129to UNW_DYN_STOP.
130.PP
131_U_dyn_region_info_size(opcount);
132_U_dyn_op_save_reg();
133_U_dyn_op_spill_fp_rel();
134_U_dyn_op_spill_sp_rel();
135_U_dyn_op_add();
136_U_dyn_op_pop_frames();
137_U_dyn_op_label_state();
138_U_dyn_op_copy_state();
139_U_dyn_op_alias();
140_U_dyn_op_stop();
141.PP
142.SH SEE ALSO
143
144.PP
145libunwind(3),
146_U_dyn_register(3),
147_U_dyn_cancel(3)
148.PP
149.SH AUTHOR
150
151.PP
152David Mosberger\-Tang
153.br
154Hewlett\-Packard Labs
155.br
156Palo\-Alto, CA 94304
157.br
158Email: \fBdavidm@hpl.hp.com\fP
159.br
160WWW: \fBhttp://www.hpl.hp.com/research/linux/libunwind/\fP\&.
161.\" NOTE: This file is generated, DO NOT EDIT.