Menu

[r2972]: / trunk / libdwarf / dwarf_next_cu_header.3  Maximize  Restore  History

Download this file

204 lines (203 with data), 6.3 kB

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