xref: /netbsd-src/external/bsd/elftoolchain/dist/libdwarf/dwarf_highpc.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: dwarf_highpc.3,v 1.3 2016/02/20 02:43:41 christos Exp $
2.\"
3.\" Copyright (c) 2010,2014 Kai Wang
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
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.
14.\"
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
25.\" SUCH DAMAGE.
26.\"
27.\" Id: dwarf_highpc.3 3092 2014-09-02 22:09:30Z kaiwang27
28.\"
29.Dd July 22, 2014
30.Os
31.Dt DWARF_HIGHPC 3
32.Sh NAME
33.Nm dwarf_arrayorder ,
34.Nm dwarf_bitoffset ,
35.Nm dwarf_bitsize ,
36.Nm dwarf_bytesize ,
37.Nm dwarf_highpc ,
38.Nm dwarf_highpc_b ,
39.Nm dwarf_lowpc ,
40.Nm dwarf_srclang
41.Nd retrieve the value of a DWARF attribute
42.Sh LIBRARY
43.Lb libdwarf
44.Sh SYNOPSIS
45.In libdwarf.h
46.Ft int
47.Fo dwarf_arrayorder
48.Fa "Dwarf_Die die"
49.Fa "Dwarf_Unsigned *ret_order"
50.Fa "Dwarf_Error *err"
51.Fc
52.Ft int
53.Fo dwarf_bitoffset
54.Fa "Dwarf_Die die"
55.Fa "Dwarf_Unsigned *ret_size"
56.Fa "Dwarf_Error *err"
57.Fc
58.Ft int
59.Fo dwarf_bitsize
60.Fa "Dwarf_Die die"
61.Fa "Dwarf_Unsigned *ret_size"
62.Fa "Dwarf_Error *err"
63.Fc
64.Ft int
65.Fo dwarf_bytesize
66.Fa "Dwarf_Die die"
67.Fa "Dwarf_Unsigned *ret_size"
68.Fa "Dwarf_Error *err"
69.Fc
70.Ft int
71.Fo dwarf_highpc
72.Fa "Dwarf_Die die"
73.Fa "Dwarf_Addr *ret_highpc"
74.Fa "Dwarf_Error *err"
75.Fc
76.Ft int
77.Fo dwarf_highpc_b
78.Fa "Dwarf_Die die"
79.Fa "Dwarf_Addr *ret_highpc"
80.Fa "Dwarf_Half *ret_form"
81.Fa "enum Dwarf_Form_Class *ret_class"
82.Fa "Dwarf_Error *err"
83.Fc
84.Ft int
85.Fo dwarf_lowpc
86.Fa "Dwarf_Die die"
87.Fa "Dwarf_Addr *ret_lowpc"
88.Fa "Dwarf_Error *err"
89.Fc
90.Ft int
91.Fo dwarf_srclang
92.Fa "Dwarf_Die die"
93.Fa "Dwarf_Unsigned *ret_lang"
94.Fa "Dwarf_Error *err"
95.Fc
96.Sh DESCRIPTION
97These convenience functions are used to retrieve DWARF attribute
98values associated with a Debugging Information Entry (DIE) descriptor
99denoted by argument
100.Ar die .
101These functions store the value of the requested attribute into the
102location pointed to by their second argument, provided that the requested
103attribute exists in the debugging information entry.
104.Pp
105The list of functions and the DWARF attribute that they retrieve are:
106.Pp
107.Bl -tag -width ".Fn dwarf_arrayorder" -compact
108.It Fn dwarf_arrayorder
109Retrieve the
110.Dv DW_AT_ordering
111attribute value.
112.It Fn dwarf_bitoffset
113Retrieve the
114.Dv DW_AT_bit_offset
115attribute value.
116.It Fn dwarf_bitsize
117Retrieve the
118.Dv DW_AT_bit_size
119attribute value.
120.It Fn dwarf_bytesize
121Retrieve the
122.Dv DW_AT_byte_size
123attribute value.
124.It Fn dwarf_highpc
125Retrieve the
126.Dv DW_AT_high_pc
127attribute value.
128.It Fn dwarf_highpc_b
129Retrieve the
130.Dv DW_AT_high_pc
131attribute value.
132.It Fn dwarf_lowpc
133Retrieve the
134.Dv DW_AT_low_pc
135attribute value.
136.It Fn dwarf_srclang
137Retrieve the
138.Dv DW_AT_language
139attribute value.
140.El
141.Pp
142Function
143.Fn dwarf_highpc_b
144is an enhanced version of function
145.Fn dwarf_highpc .
146It sets the location specified by argument
147.Ar ret_form
148to the form code of the attribute
149.Dv DW_AT_high_pc ,
150and sets the location specified by argument
151.Ar ret_class
152to the class of that form.
153A value of NULL may be used for either of the arguments
154.Ar ret_form
155or
156.Ar ret_class
157if the caller is not interested in the respective value.
158.Sh RETURN VALUES
159These functions return
160.Dv DW_DLV_OK on success.
161.Pp
162If the debugging information entry descriptor denoted by argument
163.Ar die
164does not contain the requested attribute, these functions return
165.Dv DW_DLV_NO_ENTRY
166and set argument
167.Ar err .
168For other errors, they return
169.Dv DW_DLV_ERROR
170and set argument
171.Ar err .
172.Sh ERRORS
173These functions can fail with the following errors:
174.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
175.It Bq Er DW_DLE_ARGUMENT
176Arguments
177.Ar die ,
178.Ar ret_highpc ,
179.Ar ret_lowpc ,
180.Ar ret_size ,
181.Ar ret_lang
182or
183.Ar ret_order
184were NULL.
185.It Bq Er DW_DLE_NO_ENTRY
186Argument
187.Ar die
188had no requested attribute.
189.El
190.Sh SEE ALSO
191.Xr dwarf 3 ,
192.Xr dwarf_attr 3 ,
193.Xr dwarf_attrlist 3 ,
194.Xr dwarf_hasattr 3 ,
195.Xr dwarf_get_form_class 3
196