1 .\" Copyright (c) 2011 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_get_abbrev_entry.3 2071 2011-10-27 03:20:00Z jkoshy $
29 .Dt DWARF_GET_ABBREV_ENTRY 3
31 .Nm dwarf_get_abbrev_entry
32 .Nd retrieve attribute information from an abbreviation descriptor
38 .Fo dwarf_get_abbrev_entry
39 .Fa "Dwarf_Abbrev abbrev"
40 .Fa "Dwarf_Signed ndx"
41 .Fa "Dwarf_Half *code"
42 .Fa "Dwarf_Signed *form"
43 .Fa "Dwarf_Off *offset"
44 .Fa "Dwarf_Error *err"
48 .Fn dwarf_get_abbrev_entry
49 retrieves attribute information from a DWARF abbreviation descriptor.
53 should be a valid abbreviation descriptor, as returned by function
54 .Xr dwarf_get_abbrev 3 .
58 specifies the 0-based index of the attribute.
59 The total count of the attributes contained in the abbreviation
60 entry can be retrieved using the function
61 .Xr dwarf_get_abbrev 3 .
65 should point to a location which will hold a returned
70 should point to a location which will hold the returned
71 form of the attribute.
75 should point to a location which will hold a returned offset, relative
78 section, for the specified attribute.
82 is not NULL, it will be used to return an error descriptor in case
86 .Fn dwarf_get_abbrev_entry
92 if the attribute index specified by argument
95 In case of an error, it returns
101 .Fn dwarf_get_abbrev_entry
103 .Bl -tag -width ".Bq Er DW_DLE_NO_ENTRY"
104 .It Bq Er DW_DLE_ARGUMENT
112 .It Bq Er DW_DLE_NO_ENTRY
113 The attribute index specified by argument
118 To loop through all the attribute entries contained in the
119 abbreviation section, use:
120 .Bd -literal -offset indent
123 Dwarf_Off aboff, atoff;
126 Dwarf_Unsigned length, attr_count;
130 /* ...allocate 'dbg' using dwarf_init(3) ... */
132 while ((ret = dwarf_next_cu_header(dbg, NULL, NULL, &aboff,
133 NULL, NULL, &de)) == DW_DLV_OK) {
134 while ((ret = dwarf_get_abbrev(dbg, aboff, &ab, &length,
135 &attr_count, &de)) == DW_DLV_OK) {
136 if (length == 1) /* Last entry. */
139 for (i = 0; (Dwarf_Unsigned) i < attr_count; i++) {
140 if (dwarf_get_abbrev_entry(ab, i,
141 &attr, &form, &atoff, &de) != DW_DLV_OK) {
142 warnx("dwarf_get_abbrev_entry failed:"
143 " %s", dwarf_errmsg(de));
146 /* .. use the retrieved information ... */
150 if (ret != DW_DLV_OK)
151 warnx("dwarf_get_abbrev: %s", dwarf_errmsg(de));
154 if (ret == DW_DLV_ERROR)
155 warnx("dwarf_next_cu_header: %s", dwarf_errmsg(de));
159 .Xr dwarf_get_abbrev 3