1 .\" $NetBSD: dwarf_next_cu_header.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2010 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_next_cu_header.3 2074 2011-10-27 03:34:33Z jkoshy
31 .Dt DWARF_NEXT_CU_HEADER 3
33 .Nm dwarf_next_cu_header ,
34 .Nm dwarf_next_cu_header_b
35 .Nd step through compilation units in a DWARF debug context
41 .Fo dwarf_next_cu_header
43 .Fa "Dwarf_Unsigned *cu_length"
44 .Fa "Dwarf_Half *cu_version"
45 .Fa "Dwarf_Off *cu_abbrev_offset"
46 .Fa "Dwarf_Half *cu_pointer_size"
47 .Fa "Dwarf_Unsigned *cu_next_offset"
48 .Fa "Dwarf_Error *err"
51 .Fo dwarf_next_cu_header_b
53 .Fa "Dwarf_Unsigned *cu_length"
54 .Fa "Dwarf_Half *cu_version"
55 .Fa "Dwarf_Off *cu_abbrev_offset"
56 .Fa "Dwarf_Half *cu_pointer_size"
57 .Fa "Dwarf_Half *cu_offset_size"
58 .Fa "Dwarf_Half *cu_extension_size"
59 .Fa "Dwarf_Unsigned *cu_next_offset"
60 .Fa "Dwarf_Error *err"
63 These functions are used to step through compilation unit contexts
64 associated with a DWARF debug context, optionally returning information
68 .Fn dwarf_next_cu_header_b
69 is the API recommended for new application code.
72 should reference a DWARF debug context allocated using
76 should point to a location that will be set to the
77 length of the compilation unit.
80 should point to a location that will be set to the
81 version number for the compilation unit.
84 should point to a location that will be set to the
85 starting offset (in the
87 section) of the set of debugging information entry abbreviations
88 associated with this compilation unit.
91 should point to a location that will be set to the
92 size in bytes of an address for the machine architecture of the
93 underlying object being debugged.
96 should point to a location that will be set to the
97 size in bytes for a DWARF offset in the compilation unit.
100 is only needed for processing MIPS/IRIX objects that use
101 a non-standard DWARF format.
102 It should point to a location that will be set to 4 for normal
103 objects and to 0 for non-standard ones.
106 should point to a location that will be set to the
107 offset of the next compilation unit header in the
112 should point to a location that will hold an error descriptor in case
116 .Fn dwarf_next_cu_header
118 .Fn dwarf_next_cu_header_b ,
119 and is deprecated for use by new application code.
122 should reference a DWARF debug context allocated using
126 should point to a location that will be set to the
127 length of the compilation unit.
130 should point to a location that will be set to the
131 version number for the compilation unit.
134 should point to a location that will be set to the
135 starting offset in the
137 section of the set of debugging information entry abbreviations
138 associated with this compilation unit.
141 should point to a location that will be set to the
142 size of an address in bytes for the machine architecture of the
143 underlying debugging object.
146 should point to a location that will be set to the
147 offset of the next compilation unit.
150 should point to a location that will hold an error descriptor in case
153 A value of NULL may be used for any of the arguments
156 .Ar cu_abbrev_offset ,
157 .Ar cu_pointer_size ,
159 .Ar cu_extension_size ,
163 if the caller is not interested in the respective value.
164 .Ss Iterating Through Compilation Units in a Debug Context
166 The first call to functions
167 .Fn dwarf_next_cu_header_b
169 .Fn dwarf_next_cu_header
170 for a given debug context will return information about the first
171 compilation unit in the debug context.
172 Subsequent calls to these functions will iterate through the remaining
173 compilation units in the debug context.
174 On stepping past the last compilation unit in the debug context,
176 .Fn dwarf_next_cu_header
178 .Fn dwarf_next_cu_header_b
181 and reset their internal state.
182 The next call to these functions will restart from the first compilation
183 unit in the debug context.
185 On success, these functions return
187 In case of an error, they return
191 When there are no more compilation units left to traverse, they return
192 .Dv DW_DLV_NO_ENTRY .
194 These functions can fail with the following error:
195 .Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
196 .It Bq Er DW_DLE_ARGUMENT
203 .Xr dwarf_get_cu_die_offset_given_cu_header_offset 3 ,
205 .Xr dwarf_siblingof 3