1 .\" $NetBSD: dwarf_get_abbrev_entry.3,v 1.2 2014/03/09 16:58:03 christos Exp $
3 .\" Copyright (c) 2011 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_get_abbrev_entry.3 2071 2011-10-27 03:20:00Z jkoshy
31 .Dt DWARF_GET_ABBREV_ENTRY 3
33 .Nm dwarf_get_abbrev_entry
34 .Nd retrieve attribute information from an abbreviation descriptor
40 .Fo dwarf_get_abbrev_entry
41 .Fa "Dwarf_Abbrev abbrev"
42 .Fa "Dwarf_Signed ndx"
43 .Fa "Dwarf_Half *code"
44 .Fa "Dwarf_Signed *form"
45 .Fa "Dwarf_Off *offset"
46 .Fa "Dwarf_Error *err"
50 .Fn dwarf_get_abbrev_entry
51 retrieves attribute information from a DWARF abbreviation descriptor.
55 should be a valid abbreviation descriptor, as returned by function
56 .Xr dwarf_get_abbrev 3 .
60 specifies the 0-based index of the attribute.
61 The total count of the attributes contained in the abbreviation
62 entry can be retrieved using the function
63 .Xr dwarf_get_abbrev 3 .
67 should point to a location which will hold a returned
72 should point to a location which will hold the returned
73 form of the attribute.
77 should point to a location which will hold a returned offset, relative
80 section, for the specified attribute.
84 is not NULL, it will be used to return an error descriptor in case
88 .Fn dwarf_get_abbrev_entry
94 if the attribute index specified by argument
97 In case of an error, it returns
103 .Fn dwarf_get_abbrev_entry
105 .Bl -tag -width ".Bq Er DW_DLE_NO_ENTRY"
106 .It Bq Er DW_DLE_ARGUMENT
114 .It Bq Er DW_DLE_NO_ENTRY
115 The attribute index specified by argument
120 To loop through all the attribute entries contained in the
121 abbreviation section, use:
122 .Bd -literal -offset indent
125 Dwarf_Off aboff, atoff;
128 Dwarf_Unsigned length, attr_count;
132 /* ...allocate 'dbg' using dwarf_init(3) ... */
134 while ((ret = dwarf_next_cu_header(dbg, NULL, NULL, &aboff,
135 NULL, NULL, &de)) == DW_DLV_OK) {
136 while ((ret = dwarf_get_abbrev(dbg, aboff, &ab, &length,
137 &attr_count, &de)) == DW_DLV_OK) {
138 if (length == 1) /* Last entry. */
141 for (i = 0; (Dwarf_Unsigned) i < attr_count; i++) {
142 if (dwarf_get_abbrev_entry(ab, i,
143 &attr, &form, &atoff, &de) != DW_DLV_OK) {
144 warnx("dwarf_get_abbrev_entry failed:"
145 " %s", dwarf_errmsg(de));
148 /* .. use the retrieved information ... */
152 if (ret != DW_DLV_OK)
153 warnx("dwarf_get_abbrev: %s", dwarf_errmsg(de));
156 if (ret == DW_DLV_ERROR)
157 warnx("dwarf_next_cu_header: %s", dwarf_errmsg(de));
161 .Xr dwarf_get_abbrev 3