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.3 3644 2018-10-15 19:55:01Z jkoshy $
28 .Dt DWARF_GET_ABBREV 3
32 .Nd retrieve abbreviation information
40 .Fa "Dwarf_Unsigned offset"
41 .Fa "Dwarf_Abbrev *ret_abbrev"
42 .Fa "Dwarf_Unsigned *length"
43 .Fa "Dwarf_Unsigned *attr_count"
44 .Fa "Dwarf_Error *err"
49 retrieves information about an abbreviation from the DWARF abbreviations
52 Abbreviation information is returned using an opaque descriptor
57 descriptor may then be passed to the other abbreviation related APIs
58 in the DWARF(3) API to retrieve specific information about the
63 should reference a DWARF debug context allocated using
68 should be an offset, relative to the
70 section, to the start of an abbreviation entry.
74 should point to a location that will hold a pointer to the
81 should point to a location that will hold the number of bytes used
82 by the abbrevation in the DWARF
88 should point to a location that will hold the number of
89 attributes in the abbrevation.
93 is not NULL, it will be used to store error information in case of an
96 The memory area used for the
98 descriptor returned in argument
102 Application code should use function
104 with the allocation type
106 to free the memory area when the
108 descriptor is no longer needed.
109 .Ss Application Programming Notes
110 The last abbreviation entry in a standard DWARF abbreviation section
111 will have a special length value of 1.
120 if there is no abbreviation information at offset
122 In case of an error, it returns
124 and sets the argument
127 To loop through all the abbreviation information associated with
128 a DWARF debug context, use:
129 .Bd -literal -offset indent
133 Dwarf_Unsigned length, attr_count;
138 while ((ret = dwarf_next_cu_header(dbg, NULL, NULL, &aboff,
139 NULL, NULL, &de)) == DW_DLV_OK) {
140 while ((ret = dwarf_get_abbrev(re->dbg, aboff, &ab, &length,
141 &attr_count, &de)) == DW_DLV_OK) {
142 if (length == 1) /* Last entry. */
145 if (dwarf_get_abbrev_tag(ab, &tag, &de) != DW_DLV_OK) {
146 warnx("dwarf_get_abbrev_tag failed: %s",
150 if (ret != DW_DLV_OK)
151 warnx("dwarf_get_abbrev: %s", dwarf_errmsg(de));
153 if (ret == DW_DLV_ERROR)
154 warnx("dwarf_next_cu_header: %s", dwarf_errmsg(de));
160 .Bl -tag -width ".Bq Er DW_DLE_NO_ENTRY"
161 .It Bq Er DW_DLE_ARGUMENT
169 .It Bq Er DW_DLE_NO_ENTRY
170 There is no abbreviation information at offset
175 .Xr dwarf_dealloc 3 ,
176 .Xr dwarf_get_abbrev_children_flag 3 ,
177 .Xr dwarf_get_abbrev_code 3 ,
178 .Xr dwarf_get_abbrev_entry 3 ,
179 .Xr dwarf_get_abbrev_tag 3