1 .\" $NetBSD: dwarf_attrlist.3,v 1.2 2014/03/09 16:58:03 christos Exp $
3 .\" Copyright (c) 2010 Kai Wang
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
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
27 .\" Id: dwarf_attrlist.3 2122 2011-11-09 15:35:14Z jkoshy
34 .Nd retrieve DWARF attribute descriptors
42 .Fa "Dwarf_Attribute **attrbuf"
43 .Fa "Dwarf_Signed *attrcount"
44 .Fa "Dwarf_Error *err"
49 retrieves the DWARF attribute descriptors associated with a
50 debugging information entry descriptor in argument
52 The descriptors are returned as an array of values of the opaque type
54 The data associated with each returned attribute descriptor may be
55 queried using the form query functions in the
61 points to a location that will hold a pointer to the returned
62 array of DWARF attribute descriptors.
65 points to a location that will hold the number of descriptors in
70 is non-NULL, it is used to return an error descriptor in case of an
73 In the current implementation, the memory allocated for each DWARF
74 attribute descriptor and for the returned array of descriptors is
75 managed by the library and the application does not need to explicitly
76 free the returned pointers.
77 However, for compatibility with other implementations of the
79 API, the application is permitted to pass the pointers returned by to
87 .Dv DW_DLV_OK on success.
89 If the debugging information entry descriptor denoted by argument
91 does not contain any attribute, the function returns
95 For other errors, it returns
100 To retrieve the attribute list for a DWARF debugging information
102 .Bd -literal -offset indent
105 Dwarf_Unsigned dw_count;
106 Dwarf_Attribute *dw_attributes;
109 \&... variable dw_die contains a reference to the DIE of interest ...
111 /* Retrieve the attribute list from the DIE. */
112 if ((error = dwarf_attrlist(dw_die, &dw_attributes, &dw_count,
113 &dw_e)) != DW_DLV_OK)
114 errx(EXIT_FAILURE, "dwarf_attrlist: %s", dwarf_errmsg(dw_e));
116 /* Process the attribute list. */
117 for (i = 0; i < dw_count; ++i) {
118 /* Use the returned pointers in dw_attributes[i] here. */
124 can fail with the following errors:
125 .Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
126 .It Bq Er DW_DLE_ARGUMENT
133 .It Bq Er DW_DLE_NO_ENTRY
137 .It Bq Er DW_DLE_MEMORY
138 An out of memory condition was encountered during the execution of the
144 .Xr dwarf_dealloc 3 ,
145 .Xr dwarf_hasattr 3 ,
146 .Xr dwarf_hasform 3 ,
147 .Xr dwarf_whatattr 3 ,