1 .\" Copyright (c) 2011,2014 Kai Wang
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $Id: dwarf_loclist_from_expr.3 3644 2018-10-15 19:55:01Z jkoshy $
28 .Dt DWARF_LOCLIST_FROM_EXPR 3
31 .Nm dwarf_loclist_from_expr ,
32 .Nm dwarf_loclist_from_expr_a ,
33 .Nm dwarf_loclist_from_expr_b
34 .Nd translate DWARF location expression bytes
40 .Fo dwarf_loclist_from_expr
42 .Fa "Dwarf_Ptr bytes_in"
43 .Fa "Dwarf_Unsigned bytes_len"
44 .Fa "Dwarf_Locdesc **llbuf"
45 .Fa "Dwarf_Signed *listlen"
46 .Fa "Dwarf_Error *err"
49 .Fo dwarf_loclist_from_expr_a
51 .Fa "Dwarf_Ptr bytes_in"
52 .Fa "Dwarf_Unsigned bytes_len"
53 .Fa "Dwarf_Half addr_size"
54 .Fa "Dwarf_Locdesc **llbuf"
55 .Fa "Dwarf_Signed *listlen"
56 .Fa "Dwarf_Error *err"
59 .Fo dwarf_loclist_from_expr_b
61 .Fa "Dwarf_Ptr bytes_in"
62 .Fa "Dwarf_Unsigned bytes_len"
63 .Fa "Dwarf_Half addr_size"
64 .Fa "Dwarf_Half offset_size"
65 .Fa "Dwarf_Small version"
66 .Fa "Dwarf_Locdesc **llbuf"
67 .Fa "Dwarf_Signed *listlen"
68 .Fa "Dwarf_Error *error"
72 .Fn dwarf_loclist_from_expr
73 translates DWARF location expression bytes into a
76 The size for address related data is taken to be the default address
77 size for the object being read.
81 should reference a DWARF debug context allocated using
86 should point to an array of DWARF location expression bytes.
90 should specify the number of the location expression bytes to be
95 should point to a location which will be set to a pointer
102 should point to a location which will hold the number of the
104 descriptors returned.
105 In this case it is always set to 1.
109 is not NULL, it will be used to store error information in case of an
113 .Fn dwarf_loclist_from_expr_a
114 is identical to function
115 .Fn dwarf_loclist_from_expr ,
116 except that it requires one additional argument
118 which specifies the address size to use when translating the location
122 .Fn dwarf_loclist_from_expr_b
123 is identical to function
124 .Fn dwarf_loclist_from_expr_a
125 except that it requires two additional arguments for translating the
126 location expression bytes.
129 specifies the offset size, and argument
131 specifies the DWARF version.
132 These values are required to correctly translate the
133 .Dv DW_OP_GNU_implicit_pointer
135 .Ss Memory Management
136 The memory area used for the descriptor returned in argument
140 When the descriptor is no longer needed, application code should use
143 to free the memory area in two steps:
148 descriptors pointed to by the
152 descriptor should be deallocated using the allocation type
153 .Dv DW_DLA_LOC_BLOCK .
155 Next, the application should free the
157 pointer using the allocation type
161 On success, these functions returns
163 In case of an error, they return
168 These functions may fail with the following errors:
169 .Bl -tag -width ".Bq Er DW_DLE_LOC_EXPR_BAD"
170 .It Bq Er DW_DLE_ARGUMENT
178 .It Bq Er DW_DLE_ARGUMENT
182 .It Bq Er DW_DLE_ARGUMENT
183 The value of argument
186 .It Bq Er DW_DLE_LOC_EXPR_BAD
187 An unknown or invalid operation was found in the location expression
188 bytes provided in argument
190 .It Bq Er DW_DLE_MEMORY
191 An out of memory condition was encountered during the execution of
196 .Xr dwarf_dealloc 3 ,
197 .Xr dwarf_get_fde_info_for_all_regs3 3 ,
198 .Xr dwarf_get_fde_info_for_cfa_reg3 3 ,
199 .Xr dwarf_get_fde_info_for_reg3 3 ,
200 .Xr dwarf_get_loclist_entry 3 ,
201 .Xr dwarf_loclist_n 3