1 .\" Copyright (c) 2010 Kai Wang
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $Id: dwarf_attrlist.3 3644 2018-10-15 19:55:01Z jkoshy $
32 .Nd retrieve DWARF attribute descriptors
40 .Fa "Dwarf_Attribute **attrbuf"
41 .Fa "Dwarf_Signed *attrcount"
42 .Fa "Dwarf_Error *err"
47 retrieves the DWARF attribute descriptors associated with a
48 debugging information entry descriptor in argument
50 The descriptors are returned as an array of values of the opaque type
52 The data associated with each returned attribute descriptor may be
53 queried using the form query functions in the
59 points to a location that will hold a pointer to the returned
60 array of DWARF attribute descriptors.
63 points to a location that will hold the number of descriptors in
68 is non-NULL, it is used to return an error descriptor in case of an
71 In the current implementation, the memory allocated for each DWARF
72 attribute descriptor and for the returned array of descriptors is
73 managed by the library and the application does not need to explicitly
74 free the returned pointers.
75 However, for compatibility with other implementations of the
77 API, the application is permitted to pass the pointers returned by to
88 If the debugging information entry descriptor denoted by argument
90 does not contain any attribute, the function returns
94 For other errors, it returns
99 To retrieve the attribute list for a DWARF debugging information
101 .Bd -literal -offset indent
104 Dwarf_Unsigned dw_count;
105 Dwarf_Attribute *dw_attributes;
108 \&... variable dw_die contains a reference to the DIE of interest ...
110 /* Retrieve the attribute list from the DIE. */
111 if ((error = dwarf_attrlist(dw_die, &dw_attributes, &dw_count,
112 &dw_e)) != DW_DLV_OK)
113 errx(EXIT_FAILURE, "dwarf_attrlist: %s", dwarf_errmsg(dw_e));
115 /* Process the attribute list. */
116 for (i = 0; i < dw_count; ++i) {
117 /* Use the returned pointers in dw_attributes[i] here. */
123 can fail with the following errors:
124 .Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
125 .It Bq Er DW_DLE_ARGUMENT
132 .It Bq Er DW_DLE_NO_ENTRY
136 .It Bq Er DW_DLE_MEMORY
137 An out of memory condition was encountered during the execution of the
143 .Xr dwarf_dealloc 3 ,
144 .Xr dwarf_hasattr 3 ,
145 .Xr dwarf_hasform 3 ,
146 .Xr dwarf_whatattr 3 ,