1 .\" Copyright (c) 2011 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_get_vars.3 2071 2011-10-27 03:20:00Z jkoshy $
32 .Nm dwarf_var_cu_offset ,
33 .Nm dwarf_var_die_offset ,
34 .Nm dwarf_var_name_offsets ,
36 .Nd retrieve information about static variables
44 .Fa "Dwarf_Var **vars"
45 .Fa "Dwarf_Signed *nvars"
46 .Fa "Dwarf_Error *err"
49 .Fo dwarf_var_cu_offset
51 .Fa "Dwarf_Off *cu_offset"
52 .Fa "Dwarf_Error *err"
55 .Fo dwarf_var_die_offset
57 .Fa "Dwarf_Off *die_offset"
58 .Fa "Dwarf_Error *err"
61 .Fo dwarf_var_name_offsets
64 .Fa "Dwarf_Off *die_offset"
65 .Fa "Dwarf_Off *cu_die_offset"
66 .Fa "Dwarf_Error *err"
72 .Fa "Dwarf_Error *err"
75 These functions retrieve information about the file scope static
76 variables associated with a DWARF debug context.
77 Information about these static variables is returned using opaque
80 Applications need to use the functions described below to retrieve
81 the name and offset information contained in these descriptors.
85 retrieves descriptors for all the static variables associated with the
86 DWARF debug context specified by argument
90 should point to a location that will be set to a pointer to an array
96 should point to a location that will be set to the number of
100 .Fn dwarf_var_cu_offset
101 returns the section-relative offset, relative to the
103 section, of the compilation unit that
104 contains the debugging information entry associated with the argument
108 should point to a location that will hold the returned offset.
111 .Fn dwarf_var_die_offset
112 retrieves the section-relative offset, relative to the
114 section, of the debugging information
115 entry associated with the argument
117 and stores it into the location pointed to by the argument
121 .Fn dwarf_var_name_offsets
122 retrieves both the name and the associated offsets for the debugging
123 information entry for argument
127 should point to a location which will be set to a pointer to a
128 NUL-terminated string containing the name of the associated debugging
132 should point to a location which will be set to a section-relative
133 offset, relative to the
135 section, of the associated debugging information entry.
138 should point to a location which will be set to a
139 section-relative offset, relative to the
141 section, of the first debugging information entry in
142 the compilation unit associated with argument
147 sets the location pointed to by argument
149 to a pointer to a NUL-terminated string holding the name of the
150 debugging information entry associated with the argument
152 .Ss Memory Management
153 The memory area used for the array of
155 descriptors returned in argument
161 Application code should not attempt to directly free this pointer.
162 Portable code should instead use the function
163 .Xr dwarf_vars_dealloc 3
164 to indicate that the memory area may be freed.
166 The memory area used for the string returned in the
168 argument to functions
169 .Fn dwarf_var_name_offsets
174 Portable code should indicate that the memory area can
181 is not NULL, these functions will use it to store error information,
184 On success, these functions returns
186 In case of an error, they return
191 These functions may fail with the following errors:
192 .Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
193 .It Bq Er DW_DLE_ARGUMENT
208 .Xr dwarf_dealloc 3 ,
209 .Xr dwarf_get_cu_die_offset_given_cu_header_offset 3 ,
210 .Xr dwarf_vars_dealloc 3