1 .\" $NetBSD: dwarf_get_globals.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2011 Kai Wang
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" Id: dwarf_get_globals.3 2071 2011-10-27 03:20:00Z jkoshy
31 .Dt DWARF_GET_GLOBALS 3
33 .Nm dwarf_get_globals ,
34 .Nm dwarf_global_cu_offset ,
35 .Nm dwarf_global_die_offset ,
36 .Nm dwarf_global_name_offsets ,
38 .Nd retrieve information about global objects
46 .Fa "Dwarf_Global **globals"
47 .Fa "Dwarf_Signed *nglobals"
48 .Fa "Dwarf_Error *err"
51 .Fo dwarf_global_cu_offset
52 .Fa "Dwarf_Global global"
53 .Fa "Dwarf_Off *cu_offset"
54 .Fa "Dwarf_Error *err"
57 .Fo dwarf_global_die_offset
58 .Fa "Dwarf_Global global"
59 .Fa "Dwarf_Off *die_offset"
60 .Fa "Dwarf_Error *err"
63 .Fo dwarf_global_name_offsets
64 .Fa "Dwarf_Global global"
66 .Fa "Dwarf_Off *die_offset"
67 .Fa "Dwarf_Off *cu_die_offset"
68 .Fa "Dwarf_Error *err"
72 .Fa "Dwarf_Global global"
74 .Fa "Dwarf_Error *err"
77 These functions retrieve information about global symbols from the
81 Information about these global symbols is returned using opaque descriptors
84 Applications need to use the functions described below to retrieve the
85 name and the offsets for these descriptors.
89 retrieves descriptors for all the global symbols associated with the
90 DWARF debug context specified by argument
94 should point to a location that will be set to a pointer to an array
100 should point to a location that will be set to the number of
101 descriptors returned.
104 .Fn dwarf_global_cu_offset
105 returns the section-relative offset, relative to the
107 section, of the compilation unit that contains the debugging
108 information entry associated with the argument
112 should point to a location that will hold the returned offset.
115 .Fn dwarf_global_die_offset
116 retrieves the section-relative offset, relative to the
118 section, of the debugging information entry associated with the
121 and stores it into the location pointed to by the argument
125 .Fn dwarf_global_name_offsets
126 retrieves the name and the offsets for the debugging information
131 should point to a location which will be set to a pointer to a
132 NUL-terminated string containing the name of the associated debugging
136 should point to a location which will be set to a section-relative
137 offset, relative to the
139 section, of the associated debugging information entry.
142 should point to a location which will be set to a
143 section-relative offset, relative to the
145 section, of the first debugging information entry in
146 the compilation unit associated with argument
151 sets the location pointed to by argument
153 to a pointer to a NUL-terminated string holding the name of the
154 debugging information entry associated with the argument
156 .Ss Memory Management
157 The memory area used for the array of
159 descriptors returned in argument
162 .Fn dwarf_get_globals
165 Application code should not attempt to directly free this pointer.
166 Portable code should instead use the function
167 .Xr dwarf_globals_dealloc 3
168 to indicate that the memory area may be freed.
170 The memory area used for the string returned in the
172 argument to functions
175 .Fn dwarf_global_name_offsets
178 Portable code should use the
180 function to indicate that the memory area may be freed.
184 is not NULL, these functions will use it to store error information,
187 On success, these functions returns
189 In case of an error, they return
194 These functions may fail with the following errors:
195 .Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
196 .It Bq Er DW_DLE_ARGUMENT
211 .Xr dwarf_dealloc 3 ,
212 .Xr dwarf_get_cu_die_offset_given_cu_header_offset 3 ,
213 .Xr dwarf_globals_dealloc 3