xref: /netbsd-src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attr.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1*5ac3bc71Schristos.\"	$NetBSD: dwarf_attr.3,v 1.6 2024/03/03 17:37:30 christos Exp $
2e81373b4Schristos.\"
39dd9d0cfSchristos.\" Copyright (c) 2010 Kai Wang
49dd9d0cfSchristos.\" All rights reserved.
59dd9d0cfSchristos.\"
69dd9d0cfSchristos.\" Redistribution and use in source and binary forms, with or without
79dd9d0cfSchristos.\" modification, are permitted provided that the following conditions
89dd9d0cfSchristos.\" are met:
99dd9d0cfSchristos.\" 1. Redistributions of source code must retain the above copyright
109dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer.
119dd9d0cfSchristos.\" 2. Redistributions in binary form must reproduce the above copyright
129dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer in the
139dd9d0cfSchristos.\"    documentation and/or other materials provided with the distribution.
149dd9d0cfSchristos.\"
159dd9d0cfSchristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
169dd9d0cfSchristos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
179dd9d0cfSchristos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
189dd9d0cfSchristos.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
199dd9d0cfSchristos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
209dd9d0cfSchristos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
219dd9d0cfSchristos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
229dd9d0cfSchristos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
239dd9d0cfSchristos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
249dd9d0cfSchristos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
259dd9d0cfSchristos.\" SUCH DAMAGE.
269dd9d0cfSchristos.\"
27cdbf1fe1Sjkoshy.\" Id: dwarf_attr.3 3961 2022-03-12 15:13:22Z jkoshy
289dd9d0cfSchristos.\"
299dd9d0cfSchristos.Dd April 8, 2010
309dd9d0cfSchristos.Dt DWARF_ATTR 3
31604b0842Sjkoshy.Os
329dd9d0cfSchristos.Sh NAME
339dd9d0cfSchristos.Nm dwarf_attr
349dd9d0cfSchristos.Nd retrieve an attribute descriptor associated with a DWARF debugging information entry
359dd9d0cfSchristos.Sh LIBRARY
369dd9d0cfSchristos.Lb libdwarf
379dd9d0cfSchristos.Sh SYNOPSIS
389dd9d0cfSchristos.In libdwarf.h
399dd9d0cfSchristos.Ft int
409dd9d0cfSchristos.Fo dwarf_attr
419dd9d0cfSchristos.Fa "Dwarf_Die die"
429dd9d0cfSchristos.Fa "Dwarf_Half attr"
439dd9d0cfSchristos.Fa "Dwarf_Attribute *atp"
449dd9d0cfSchristos.Fa "Dwarf_Error *err"
459dd9d0cfSchristos.Fc
469dd9d0cfSchristos.Sh DESCRIPTION
479dd9d0cfSchristosFunction
489dd9d0cfSchristos.Fn dwarf_attr
499dd9d0cfSchristosretrieves the attribute descriptor for an attribute associated
509dd9d0cfSchristoswith the DWARF debugging information entry descriptor in
519dd9d0cfSchristosargument
52cdbf1fe1Sjkoshy.Fa die .
539dd9d0cfSchristos.Pp
549dd9d0cfSchristosDWARF attribute descriptors are represented by value of the opaque
559dd9d0cfSchristostype
569dd9d0cfSchristos.Vt Dwarf_Attribute ,
579dd9d0cfSchristossee
589dd9d0cfSchristos.Xr dwarf 3 .
599dd9d0cfSchristos.Pp
609dd9d0cfSchristosArgument
61cdbf1fe1Sjkoshy.Fa attr
629dd9d0cfSchristosnames the desired DWARF attribute.
639dd9d0cfSchristosLegal values for argument
64cdbf1fe1Sjkoshy.Fa attr
659dd9d0cfSchristosare those denoted by the
669dd9d0cfSchristos.Dv DW_AT_*
679dd9d0cfSchristosconstants in the DWARF specification.
689dd9d0cfSchristos.Pp
699dd9d0cfSchristosArgument
70cdbf1fe1Sjkoshy.Fa atp
719dd9d0cfSchristospoints to a location into which the returned attribute descriptor
729dd9d0cfSchristoswill be written.
739dd9d0cfSchristosThe returned descriptor may then be passed to the form query functions in the
749dd9d0cfSchristos.Xr dwarf 3
759dd9d0cfSchristosAPI set to access the data associated with the attribute.
769dd9d0cfSchristos.Pp
779dd9d0cfSchristosIf argument
78cdbf1fe1Sjkoshy.Fa err
79cdbf1fe1Sjkoshyis
80cdbf1fe1Sjkoshy.No non- Ns Dv NULL ,
81cdbf1fe1Sjkoshyit will be used to return an error descriptor in case of an error.
829dd9d0cfSchristos.Sh RETURN VALUES
839dd9d0cfSchristosFunction
849dd9d0cfSchristos.Fn dwarf_attr
859dd9d0cfSchristosreturns
86604b0842Sjkoshy.Dv DW_DLV_OK
87604b0842Sjkoshyon success.
889dd9d0cfSchristos.Pp
899dd9d0cfSchristosIf the debugging information entry descriptor denoted by argument
90cdbf1fe1Sjkoshy.Fa die
919dd9d0cfSchristosdoes not contain the named attribute, the function returns
929dd9d0cfSchristos.Dv DW_DLV_NO_ENTRY
939dd9d0cfSchristosand sets argument
94cdbf1fe1Sjkoshy.Fa err .
959dd9d0cfSchristosFor other errors, it returns
969dd9d0cfSchristos.Dv DW_DLV_ERROR
979dd9d0cfSchristosand sets argument
98cdbf1fe1Sjkoshy.Fa err .
999dd9d0cfSchristos.Sh ERRORS
1009dd9d0cfSchristosFunction
1019dd9d0cfSchristos.Fn dwarf_attr
1029dd9d0cfSchristoscan fail with the following errors:
1039dd9d0cfSchristos.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
1049dd9d0cfSchristos.It Bq Er DW_DLE_ARGUMENT
1059dd9d0cfSchristosEither of arguments
106cdbf1fe1Sjkoshy.Fa die
1079dd9d0cfSchristosor
108cdbf1fe1Sjkoshy.Fa atp
109cdbf1fe1Sjkoshywas
110cdbf1fe1Sjkoshy.Dv NULL .
1119dd9d0cfSchristos.It Bq Er DW_DLE_NO_ENTRY
1129dd9d0cfSchristosArgument
113cdbf1fe1Sjkoshy.Fa die
1149dd9d0cfSchristoshad no attribute corresponding to the value
1159dd9d0cfSchristosin argument
116cdbf1fe1Sjkoshy.Fa attr .
1179dd9d0cfSchristos.El
1189dd9d0cfSchristos.Sh SEE ALSO
1199dd9d0cfSchristos.Xr dwarf 3 ,
1209dd9d0cfSchristos.Xr dwarf_attrlist 3 ,
12142bd3019Schristos.Xr dwarf_attroffset 3 ,
1229dd9d0cfSchristos.Xr dwarf_hasattr 3 ,
1239dd9d0cfSchristos.Xr dwarf_hasform 3 ,
1249dd9d0cfSchristos.Xr dwarf_whatattr 3 ,
1259dd9d0cfSchristos.Xr dwarf_whatform 3
126