xref: /minix3/external/bsd/elftoolchain/dist/libdwarf/dwarf_next_cu_header.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: dwarf_next_cu_header.3,v 1.2 2014/03/09 16:58:04 christos Exp $
2*0a6a1f1dSLionel Sambuc.\"
3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2010 Kai Wang
4*0a6a1f1dSLionel Sambuc.\" All rights reserved.
5*0a6a1f1dSLionel Sambuc.\"
6*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
7*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions
8*0a6a1f1dSLionel Sambuc.\" are met:
9*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
10*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
11*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
12*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
13*0a6a1f1dSLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
14*0a6a1f1dSLionel Sambuc.\"
15*0a6a1f1dSLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*0a6a1f1dSLionel Sambuc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*0a6a1f1dSLionel Sambuc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*0a6a1f1dSLionel Sambuc.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*0a6a1f1dSLionel Sambuc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*0a6a1f1dSLionel Sambuc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*0a6a1f1dSLionel Sambuc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*0a6a1f1dSLionel Sambuc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*0a6a1f1dSLionel Sambuc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*0a6a1f1dSLionel Sambuc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*0a6a1f1dSLionel Sambuc.\" SUCH DAMAGE.
26*0a6a1f1dSLionel Sambuc.\"
27*0a6a1f1dSLionel Sambuc.\" Id: dwarf_next_cu_header.3 2074 2011-10-27 03:34:33Z jkoshy
28*0a6a1f1dSLionel Sambuc.\"
29*0a6a1f1dSLionel Sambuc.Dd July 24, 2010
30*0a6a1f1dSLionel Sambuc.Os
31*0a6a1f1dSLionel Sambuc.Dt DWARF_NEXT_CU_HEADER 3
32*0a6a1f1dSLionel Sambuc.Sh NAME
33*0a6a1f1dSLionel Sambuc.Nm dwarf_next_cu_header ,
34*0a6a1f1dSLionel Sambuc.Nm dwarf_next_cu_header_b
35*0a6a1f1dSLionel Sambuc.Nd step through compilation units in a DWARF debug context
36*0a6a1f1dSLionel Sambuc.Sh LIBRARY
37*0a6a1f1dSLionel Sambuc.Lb libdwarf
38*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS
39*0a6a1f1dSLionel Sambuc.In libdwarf.h
40*0a6a1f1dSLionel Sambuc.Ft int
41*0a6a1f1dSLionel Sambuc.Fo dwarf_next_cu_header
42*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Debug dbg"
43*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Unsigned *cu_length"
44*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Half *cu_version"
45*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Off *cu_abbrev_offset"
46*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Half *cu_pointer_size"
47*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Unsigned *cu_next_offset"
48*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
49*0a6a1f1dSLionel Sambuc.Fc
50*0a6a1f1dSLionel Sambuc.Ft int
51*0a6a1f1dSLionel Sambuc.Fo dwarf_next_cu_header_b
52*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Debug dbg"
53*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Unsigned *cu_length"
54*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Half *cu_version"
55*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Off *cu_abbrev_offset"
56*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Half *cu_pointer_size"
57*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Half *cu_offset_size"
58*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Half *cu_extension_size"
59*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Unsigned *cu_next_offset"
60*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
61*0a6a1f1dSLionel Sambuc.Fc
62*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION
63*0a6a1f1dSLionel SambucThese functions are used to step through compilation unit contexts
64*0a6a1f1dSLionel Sambucassociated with a DWARF debug context, optionally returning information
65*0a6a1f1dSLionel Sambucabout the unit.
66*0a6a1f1dSLionel Sambuc.Pp
67*0a6a1f1dSLionel SambucFunction
68*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header_b
69*0a6a1f1dSLionel Sambucis the API recommended for new application code.
70*0a6a1f1dSLionel SambucArgument
71*0a6a1f1dSLionel Sambuc.Ar dbg
72*0a6a1f1dSLionel Sambucshould reference a DWARF debug context allocated using
73*0a6a1f1dSLionel Sambuc.Xr dwarf_init 3 .
74*0a6a1f1dSLionel SambucArgument
75*0a6a1f1dSLionel Sambuc.Ar cu_length
76*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
77*0a6a1f1dSLionel Sambuclength of the compilation unit.
78*0a6a1f1dSLionel SambucArgument
79*0a6a1f1dSLionel Sambuc.Ar cu_version
80*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
81*0a6a1f1dSLionel Sambucversion number for the compilation unit.
82*0a6a1f1dSLionel SambucArgument
83*0a6a1f1dSLionel Sambuc.Ar cu_abbrev_offset
84*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
85*0a6a1f1dSLionel Sambucstarting offset (in the
86*0a6a1f1dSLionel Sambuc.Dq .debug_abbrev
87*0a6a1f1dSLionel Sambucsection) of the set of debugging information entry abbreviations
88*0a6a1f1dSLionel Sambucassociated with this compilation unit.
89*0a6a1f1dSLionel SambucArgument
90*0a6a1f1dSLionel Sambuc.Ar cu_pointer_size
91*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
92*0a6a1f1dSLionel Sambucsize in bytes of an address for the machine architecture of the
93*0a6a1f1dSLionel Sambucunderlying object being debugged.
94*0a6a1f1dSLionel SambucArgument
95*0a6a1f1dSLionel Sambuc.Ar cu_offset_size
96*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
97*0a6a1f1dSLionel Sambucsize in bytes for a DWARF offset in the compilation unit.
98*0a6a1f1dSLionel SambucArgument
99*0a6a1f1dSLionel Sambuc.Ar cu_extension_size
100*0a6a1f1dSLionel Sambucis only needed for processing MIPS/IRIX objects that use
101*0a6a1f1dSLionel Sambuca non-standard DWARF format.
102*0a6a1f1dSLionel SambucIt should point to a location that will be set to 4 for normal
103*0a6a1f1dSLionel Sambucobjects and to 0 for non-standard ones.
104*0a6a1f1dSLionel SambucArgument
105*0a6a1f1dSLionel Sambuc.Ar cu_next_offset
106*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
107*0a6a1f1dSLionel Sambucoffset of the next compilation unit header in the
108*0a6a1f1dSLionel Sambuc.Dq \&.debug_info
109*0a6a1f1dSLionel Sambucsection.
110*0a6a1f1dSLionel SambucArgument
111*0a6a1f1dSLionel Sambuc.Ar err
112*0a6a1f1dSLionel Sambucshould point to a location that will hold an error descriptor in case
113*0a6a1f1dSLionel Sambucof an error.
114*0a6a1f1dSLionel Sambuc.Pp
115*0a6a1f1dSLionel SambucFunction
116*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header
117*0a6a1f1dSLionel Sambucis less general than
118*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header_b ,
119*0a6a1f1dSLionel Sambucand is deprecated for use by new application code.
120*0a6a1f1dSLionel SambucArgument
121*0a6a1f1dSLionel Sambuc.Ar dbg
122*0a6a1f1dSLionel Sambucshould reference a DWARF debug context allocated using
123*0a6a1f1dSLionel Sambuc.Xr dwarf_init 3 .
124*0a6a1f1dSLionel SambucArgument
125*0a6a1f1dSLionel Sambuc.Ar cu_length
126*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
127*0a6a1f1dSLionel Sambuclength of the compilation unit.
128*0a6a1f1dSLionel SambucArgument
129*0a6a1f1dSLionel Sambuc.Ar cu_version
130*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
131*0a6a1f1dSLionel Sambucversion number for the compilation unit.
132*0a6a1f1dSLionel SambucArgument
133*0a6a1f1dSLionel Sambuc.Ar cu_abbrev_offset
134*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
135*0a6a1f1dSLionel Sambucstarting offset in the
136*0a6a1f1dSLionel Sambuc.Dq .debug_abbrev
137*0a6a1f1dSLionel Sambucsection of the set of debugging information entry abbreviations
138*0a6a1f1dSLionel Sambucassociated with this compilation unit.
139*0a6a1f1dSLionel SambucArgument
140*0a6a1f1dSLionel Sambuc.Ar cu_pointer_size
141*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
142*0a6a1f1dSLionel Sambucsize of an address in bytes for the machine architecture of the
143*0a6a1f1dSLionel Sambucunderlying debugging object.
144*0a6a1f1dSLionel SambucArgument
145*0a6a1f1dSLionel Sambuc.Ar cu_next_offset
146*0a6a1f1dSLionel Sambucshould point to a location that will be set to the
147*0a6a1f1dSLionel Sambucoffset of the next compilation unit.
148*0a6a1f1dSLionel SambucArgument
149*0a6a1f1dSLionel Sambuc.Ar err
150*0a6a1f1dSLionel Sambucshould point to a location that will hold an error descriptor in case
151*0a6a1f1dSLionel Sambucof an error.
152*0a6a1f1dSLionel Sambuc.Pp
153*0a6a1f1dSLionel SambucA value of NULL may be used for any of the arguments
154*0a6a1f1dSLionel Sambuc.Ar cu_length ,
155*0a6a1f1dSLionel Sambuc.Ar cu_version ,
156*0a6a1f1dSLionel Sambuc.Ar cu_abbrev_offset ,
157*0a6a1f1dSLionel Sambuc.Ar cu_pointer_size ,
158*0a6a1f1dSLionel Sambuc.Ar cu_offset_size ,
159*0a6a1f1dSLionel Sambuc.Ar cu_extension_size ,
160*0a6a1f1dSLionel Sambuc.Ar cu_next_offset
161*0a6a1f1dSLionel Sambucand
162*0a6a1f1dSLionel Sambuc.Ar err
163*0a6a1f1dSLionel Sambucif the caller is not interested in the respective value.
164*0a6a1f1dSLionel Sambuc.Ss Iterating Through Compilation Units in a Debug Context
165*0a6a1f1dSLionel Sambuc.Pp
166*0a6a1f1dSLionel SambucThe first call to functions
167*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header_b
168*0a6a1f1dSLionel Sambucand
169*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header
170*0a6a1f1dSLionel Sambucfor a given debug context will return information about the first
171*0a6a1f1dSLionel Sambuccompilation unit in the debug context.
172*0a6a1f1dSLionel SambucSubsequent calls to these functions will iterate through the remaining
173*0a6a1f1dSLionel Sambuccompilation units in the debug context.
174*0a6a1f1dSLionel SambucOn stepping past the last compilation unit in the debug context,
175*0a6a1f1dSLionel Sambucfunctions
176*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header
177*0a6a1f1dSLionel Sambucand
178*0a6a1f1dSLionel Sambuc.Fn dwarf_next_cu_header_b
179*0a6a1f1dSLionel Sambucreturn
180*0a6a1f1dSLionel Sambuc.Dv DW_DLV_NO_ENTRY
181*0a6a1f1dSLionel Sambucand reset their internal state.
182*0a6a1f1dSLionel SambucThe next call to these functions will restart from the first compilation
183*0a6a1f1dSLionel Sambucunit in the debug context.
184*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES
185*0a6a1f1dSLionel SambucOn success, these functions return
186*0a6a1f1dSLionel Sambuc.Dv DW_DLV_OK .
187*0a6a1f1dSLionel SambucIn case of an error, they return
188*0a6a1f1dSLionel Sambuc.Dv DW_DLV_ERROR
189*0a6a1f1dSLionel Sambucand set argument
190*0a6a1f1dSLionel Sambuc.Ar err .
191*0a6a1f1dSLionel SambucWhen there are no more compilation units left to traverse, they return
192*0a6a1f1dSLionel Sambuc.Dv DW_DLV_NO_ENTRY .
193*0a6a1f1dSLionel Sambuc.Sh ERRORS
194*0a6a1f1dSLionel SambucThese functions can fail with the following error:
195*0a6a1f1dSLionel Sambuc.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
196*0a6a1f1dSLionel Sambuc.It Bq Er DW_DLE_ARGUMENT
197*0a6a1f1dSLionel SambucArgument
198*0a6a1f1dSLionel Sambuc.Va dbg
199*0a6a1f1dSLionel Sambucwas NULL.
200*0a6a1f1dSLionel Sambuc.El
201*0a6a1f1dSLionel Sambuc.Sh SEE ALSO
202*0a6a1f1dSLionel Sambuc.Xr dwarf 3 ,
203*0a6a1f1dSLionel Sambuc.Xr dwarf_get_cu_die_offset_given_cu_header_offset 3 ,
204*0a6a1f1dSLionel Sambuc.Xr dwarf_init 3 ,
205*0a6a1f1dSLionel Sambuc.Xr dwarf_siblingof 3
206