xref: /freebsd/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3 (revision 2de3b87a120614a3b053be7dd845b72f1e9ce804)
1*2de3b87aSKai Wang.\" Copyright (c) 2010 Kai Wang
2*2de3b87aSKai Wang.\" All rights reserved.
3*2de3b87aSKai Wang.\"
4*2de3b87aSKai Wang.\" Redistribution and use in source and binary forms, with or without
5*2de3b87aSKai Wang.\" modification, are permitted provided that the following conditions
6*2de3b87aSKai Wang.\" are met:
7*2de3b87aSKai Wang.\" 1. Redistributions of source code must retain the above copyright
8*2de3b87aSKai Wang.\"    notice, this list of conditions and the following disclaimer.
9*2de3b87aSKai Wang.\" 2. Redistributions in binary form must reproduce the above copyright
10*2de3b87aSKai Wang.\"    notice, this list of conditions and the following disclaimer in the
11*2de3b87aSKai Wang.\"    documentation and/or other materials provided with the distribution.
12*2de3b87aSKai Wang.\"
13*2de3b87aSKai Wang.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*2de3b87aSKai Wang.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*2de3b87aSKai Wang.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*2de3b87aSKai Wang.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*2de3b87aSKai Wang.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*2de3b87aSKai Wang.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*2de3b87aSKai Wang.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*2de3b87aSKai Wang.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*2de3b87aSKai Wang.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*2de3b87aSKai Wang.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*2de3b87aSKai Wang.\" SUCH DAMAGE.
24*2de3b87aSKai Wang.\"
25*2de3b87aSKai Wang.\" $Id: dwarf_dieoffset.3 2073 2011-10-27 03:30:47Z jkoshy $
26*2de3b87aSKai Wang.\"
27*2de3b87aSKai Wang.Dd April 17, 2010
28*2de3b87aSKai Wang.Os
29*2de3b87aSKai Wang.Dt DWARF_DIEOFFSET 3
30*2de3b87aSKai Wang.Sh NAME
31*2de3b87aSKai Wang.Nm dwarf_die_CU_offset ,
32*2de3b87aSKai Wang.Nm dwarf_die_CU_offset_range ,
33*2de3b87aSKai Wang.Nm dwarf_dieoffset ,
34*2de3b87aSKai Wang.Nm dwarf_get_cu_die_offset_given_cu_header_offset
35*2de3b87aSKai Wang.Nd return offsets of DWARF debugging information entries
36*2de3b87aSKai Wang.Sh LIBRARY
37*2de3b87aSKai Wang.Lb libdwarf
38*2de3b87aSKai Wang.Sh SYNOPSIS
39*2de3b87aSKai Wang.In libdwarf.h
40*2de3b87aSKai Wang.Ft int
41*2de3b87aSKai Wang.Fo dwarf_die_CU_offset
42*2de3b87aSKai Wang.Fa "Dwarf_Die die"
43*2de3b87aSKai Wang.Fa "Dwarf_Off *ret_offset"
44*2de3b87aSKai Wang.Fa "Dwarf_Error *err"
45*2de3b87aSKai Wang.Fc
46*2de3b87aSKai Wang.Ft int
47*2de3b87aSKai Wang.Fo dwarf_die_CU_offset_range
48*2de3b87aSKai Wang.Fa "Dwarf_Die die"
49*2de3b87aSKai Wang.Fa "Dwarf_Off *cu_offset"
50*2de3b87aSKai Wang.Fa "Dwarf_Off *cu_length"
51*2de3b87aSKai Wang.Fa "Dwarf_Error *err"
52*2de3b87aSKai Wang.Fc
53*2de3b87aSKai Wang.Ft int
54*2de3b87aSKai Wang.Fo dwarf_dieoffset
55*2de3b87aSKai Wang.Fa "Dwarf_Die die"
56*2de3b87aSKai Wang.Fa "Dwarf_Off *ret_offset"
57*2de3b87aSKai Wang.Fa "Dwarf_Error *err"
58*2de3b87aSKai Wang.Fc
59*2de3b87aSKai Wang.Ft int
60*2de3b87aSKai Wang.Fo dwarf_get_cu_die_offset_given_cu_header_offset
61*2de3b87aSKai Wang.Fa "Dwarf_Debug dbg"
62*2de3b87aSKai Wang.Fa "Dwarf_Off in_cu_header_offset"
63*2de3b87aSKai Wang.Fa "Dwarf_Off *out_cu_die_offset"
64*2de3b87aSKai Wang.Fa "Dwarf_Error *err"
65*2de3b87aSKai Wang.Fc
66*2de3b87aSKai Wang.Sh DESCRIPTION
67*2de3b87aSKai WangThese functions are used to retrieve offsets for DWARF debugging
68*2de3b87aSKai Wanginformation entries.
69*2de3b87aSKai Wang.Pp
70*2de3b87aSKai WangFunction
71*2de3b87aSKai Wang.Fn dwarf_die_CU_offset
72*2de3b87aSKai Wangreturns the offset of the debugging information entry referenced by
73*2de3b87aSKai Wangargument
74*2de3b87aSKai Wang.Ar die
75*2de3b87aSKai Wangrelative to the start of its containing compilation unit.
76*2de3b87aSKai WangArgument
77*2de3b87aSKai Wang.Ar ret_offset
78*2de3b87aSKai Wangshould point to the location that is to hold the returned offset.
79*2de3b87aSKai WangIf argument
80*2de3b87aSKai Wang.Ar err
81*2de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of
82*2de3b87aSKai Wangan error.
83*2de3b87aSKai Wang.Pp
84*2de3b87aSKai WangFunction
85*2de3b87aSKai Wang.Fn dwarf_die_CU_offset_range
86*2de3b87aSKai Wangreturns the section-relative offset and length of the compilation unit
87*2de3b87aSKai Wangcontaining the debugging information entry referenced by argument
88*2de3b87aSKai Wang.Ar die .
89*2de3b87aSKai WangArgument
90*2de3b87aSKai Wang.Ar cu_offset
91*2de3b87aSKai Wangshould point to a location that will hold the returned offset.
92*2de3b87aSKai WangArgument
93*2de3b87aSKai Wang.Ar cu_length
94*2de3b87aSKai Wangshould point to a location that will hold the returned length of the
95*2de3b87aSKai Wangcompilation unit.
96*2de3b87aSKai WangIf argument
97*2de3b87aSKai Wang.Ar err
98*2de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of
99*2de3b87aSKai Wangan error.
100*2de3b87aSKai Wang.Pp
101*2de3b87aSKai WangFunction
102*2de3b87aSKai Wang.Fn dwarf_dieoffset
103*2de3b87aSKai Wangretrieves the section-relative offset of the debugging information
104*2de3b87aSKai Wangentry referenced by argument
105*2de3b87aSKai Wang.Ar die .
106*2de3b87aSKai WangArgument
107*2de3b87aSKai Wang.Ar ret_offset
108*2de3b87aSKai Wangshould point to a location that is to hold the returned
109*2de3b87aSKai Wangsection-relative offset.
110*2de3b87aSKai WangIf argument
111*2de3b87aSKai Wang.Ar err
112*2de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of
113*2de3b87aSKai Wangan error.
114*2de3b87aSKai Wang.Pp
115*2de3b87aSKai WangFunction
116*2de3b87aSKai Wang.Fn dwarf_get_cu_die_offset_given_cu_header_offset
117*2de3b87aSKai Wangreturns the offset for the debugging information entry for a
118*2de3b87aSKai Wangcompilation unit, given an offset to the header of the compilation
119*2de3b87aSKai Wangunit.
120*2de3b87aSKai WangArgument
121*2de3b87aSKai Wang.Ar dbg
122*2de3b87aSKai Wangshould reference a valid debugging context allocated using
123*2de3b87aSKai Wang.Xr dwarf_init 3 .
124*2de3b87aSKai WangArgument
125*2de3b87aSKai Wang.Ar in_cu_header_offset
126*2de3b87aSKai Wangcontains the offset to the start of a compilation unit.
127*2de3b87aSKai WangArgument
128*2de3b87aSKai Wang.Ar out_cu_die_offset
129*2de3b87aSKai Wangpoints to a location that will hold the returned offset.
130*2de3b87aSKai WangIf argument
131*2de3b87aSKai Wang.Ar err
132*2de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of
133*2de3b87aSKai Wangan error.
134*2de3b87aSKai Wang.Sh RETURN VALUES
135*2de3b87aSKai WangOn success, these functions returns
136*2de3b87aSKai Wang.Dv DW_DLV_OK .
137*2de3b87aSKai WangIn case of an error, these functions return
138*2de3b87aSKai Wang.Dv DW_DLV_ERROR
139*2de3b87aSKai Wangand set argument
140*2de3b87aSKai Wang.Ar err .
141*2de3b87aSKai Wang.Pp
142*2de3b87aSKai WangFunction
143*2de3b87aSKai Wang.Fn dwarf_get_cu_die_offset_given_cu_header_offset
144*2de3b87aSKai Wangreturns
145*2de3b87aSKai Wang.Dv DW_DLV_NO_ENTRY
146*2de3b87aSKai Wangand sets argument
147*2de3b87aSKai Wang.Ar err
148*2de3b87aSKai Wangif there is no compilation unit located at the
149*2de3b87aSKai Wangoffset specified in argument
150*2de3b87aSKai Wang.Ar in_cu_header_offset .
151*2de3b87aSKai Wang.Sh ERRORS
152*2de3b87aSKai WangThese functions may fail with the following errors:
153*2de3b87aSKai Wang.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
154*2de3b87aSKai Wang.It Bq Er DW_DLE_ARGUMENT
155*2de3b87aSKai WangOne of the arguments
156*2de3b87aSKai Wang.Va cu_length ,
157*2de3b87aSKai Wang.Va cu_offset ,
158*2de3b87aSKai Wang.Va dbg ,
159*2de3b87aSKai Wang.Va die ,
160*2de3b87aSKai Wang.Va out_cu_die_offset
161*2de3b87aSKai Wangor
162*2de3b87aSKai Wang.Va ret_offset
163*2de3b87aSKai Wangwas NULL.
164*2de3b87aSKai Wang.It Bq Er DW_DLE_NO_ENTRY
165*2de3b87aSKai WangArgument
166*2de3b87aSKai Wang.Ar in_cu_header_offset
167*2de3b87aSKai Wangspecified an unknown offset.
168*2de3b87aSKai Wang.El
169*2de3b87aSKai Wang.Sh SEE ALSO
170*2de3b87aSKai Wang.Xr dwarf 3 ,
171*2de3b87aSKai Wang.Xr dwarf_next_cu_header 3 ,
172*2de3b87aSKai Wang.Xr dwarf_offdie 3
173