1*5ac3bc71Schristos.\" $NetBSD: dwarf_attrval_signed.3,v 1.6 2024/03/03 17:37:30 christos Exp $ 2e81373b4Schristos.\" 39dd9d0cfSchristos.\" Copyright (c) 2011 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_attrval_signed.3 3961 2022-03-12 15:13:22Z jkoshy 289dd9d0cfSchristos.\" 29604b0842Sjkoshy.Dd December 26, 2016 309dd9d0cfSchristos.Dt DWARF_ATTRVAL_SIGNED 3 31604b0842Sjkoshy.Os 329dd9d0cfSchristos.Sh NAME 339dd9d0cfSchristos.Nm dwarf_attrval_flag , 349dd9d0cfSchristos.Nm dwarf_attrval_signed , 359dd9d0cfSchristos.Nm dwarf_attrval_string , 369dd9d0cfSchristos.Nm dwarf_attrval_unsigned 379dd9d0cfSchristos.Nd retrieve the value of an attribute within a DWARF debugging information entry 389dd9d0cfSchristos.Sh LIBRARY 399dd9d0cfSchristos.Lb libdwarf 409dd9d0cfSchristos.Sh SYNOPSIS 419dd9d0cfSchristos.In libdwarf.h 429dd9d0cfSchristos.Ft int 439dd9d0cfSchristos.Fo dwarf_attrval_flag 449dd9d0cfSchristos.Fa "Dwarf_Die die" 459dd9d0cfSchristos.Fa "Dwarf_Half attr" 469dd9d0cfSchristos.Fa "Dwarf_Bool *ret" 479dd9d0cfSchristos.Fa "Dwarf_Error *err" 489dd9d0cfSchristos.Fc 499dd9d0cfSchristos.Ft int 509dd9d0cfSchristos.Fo dwarf_attrval_signed 519dd9d0cfSchristos.Fa "Dwarf_Die die" 529dd9d0cfSchristos.Fa "Dwarf_Half attr" 539dd9d0cfSchristos.Fa "Dwarf_Signed *ret" 549dd9d0cfSchristos.Fa "Dwarf_Error *err" 559dd9d0cfSchristos.Fc 569dd9d0cfSchristos.Ft int 579dd9d0cfSchristos.Fo dwarf_attrval_string 589dd9d0cfSchristos.Fa "Dwarf_Die die" 599dd9d0cfSchristos.Fa "Dwarf_Half attr" 609dd9d0cfSchristos.Fa "const char **ret" 619dd9d0cfSchristos.Fa "Dwarf_Error *err" 629dd9d0cfSchristos.Fc 639dd9d0cfSchristos.Ft int 649dd9d0cfSchristos.Fo dwarf_attrval_unsigned 659dd9d0cfSchristos.Fa "Dwarf_Die die" 669dd9d0cfSchristos.Fa "Dwarf_Half attr" 679dd9d0cfSchristos.Fa "Dwarf_Unsigned *ret" 689dd9d0cfSchristos.Fa "Dwarf_Error *err" 699dd9d0cfSchristos.Fc 709dd9d0cfSchristos.Sh DESCRIPTION 719dd9d0cfSchristosThese functions search the debugging information entry referenced 729dd9d0cfSchristosby argument 73cdbf1fe1Sjkoshy.Fa die 749dd9d0cfSchristosfor the attribute named by argument 75cdbf1fe1Sjkoshy.Fa attr . 769dd9d0cfSchristosIf the named attribute is found, the functions set the location 779dd9d0cfSchristospointed to by argument 78cdbf1fe1Sjkoshy.Fa ret 799dd9d0cfSchristosto the value of the attribute. 809dd9d0cfSchristosThe argument 81cdbf1fe1Sjkoshy.Fa err , 82cdbf1fe1Sjkoshyif 83cdbf1fe1Sjkoshy.No non- Ns Dv NULL , 849dd9d0cfSchristoswill be used to return an error descriptor in case of an error. 859dd9d0cfSchristos.Pp 869dd9d0cfSchristosFunction 879dd9d0cfSchristos.Fn dwarf_attrval_flag 889dd9d0cfSchristossets the location pointed to by argument 89cdbf1fe1Sjkoshy.Fa ret 909dd9d0cfSchristosto either 0 or 1. If the form of the attribute named by argument 91cdbf1fe1Sjkoshy.Fa attr 929dd9d0cfSchristosis 939dd9d0cfSchristos.Dv DW_FORM_flag , 949dd9d0cfSchristosfunction 959dd9d0cfSchristos.Fn dwarf_attrval_flag 969dd9d0cfSchristossets the location pointed to by argument 97cdbf1fe1Sjkoshy.Fa ret 989dd9d0cfSchristosto 1 if the attribute has a non-zero value, or to 0 otherwise. 999dd9d0cfSchristosIf the form of the attribute named by argument 100cdbf1fe1Sjkoshy.Fa attr 1019dd9d0cfSchristosis 1029dd9d0cfSchristos.Dv DW_FORM_flag_present , 1039dd9d0cfSchristosfunction 1049dd9d0cfSchristos.Fn dwarf_attrval_flag 1059dd9d0cfSchristosunconditionally sets the location pointed to by argument 106cdbf1fe1Sjkoshy.Fa ret 1079dd9d0cfSchristosto 1. 1089dd9d0cfSchristosThe form of the attribute must be one of 1099dd9d0cfSchristos.Dv DW_FORM_flag 1109dd9d0cfSchristosor 1119dd9d0cfSchristos.Dv DW_FORM_flag_present . 1129dd9d0cfSchristos.Pp 1139dd9d0cfSchristosFunction 1149dd9d0cfSchristos.Fn dwarf_attrval_signed 1159dd9d0cfSchristosstores the value for the attribute named by argument 116cdbf1fe1Sjkoshy.Fa attr , 1179dd9d0cfSchristosinto the location pointed to by argument 118cdbf1fe1Sjkoshy.Fa ret . 1199dd9d0cfSchristosThe attribute's value is treated as a signed integral quantity and is 1209dd9d0cfSchristossign-extended as needed. 1219dd9d0cfSchristosThe attribute named by the argument 122cdbf1fe1Sjkoshy.Fa attr 1239dd9d0cfSchristosmust belong to the 1249dd9d0cfSchristos.Dv CONSTANT 1259dd9d0cfSchristosclass and must have one of the following forms: 1269dd9d0cfSchristos.Dv DW_FORM_data1 , 1279dd9d0cfSchristos.Dv DW_FORM_data2 , 1289dd9d0cfSchristos.Dv DW_FORM_data4 , 1299dd9d0cfSchristos.Dv DW_FORM_data8 1309dd9d0cfSchristosor 1319dd9d0cfSchristos.Dv DW_FORM_sdata . 1329dd9d0cfSchristos.Pp 1339dd9d0cfSchristosFunction 1349dd9d0cfSchristos.Fn dwarf_attrval_string 1359dd9d0cfSchristossets the location pointed to by argument 136cdbf1fe1Sjkoshy.Fa ret 1379dd9d0cfSchristosto a pointer to a NUL-terminated string that is the value of the 1389dd9d0cfSchristosattribute named by argument 139cdbf1fe1Sjkoshy.Fa attr . 1409dd9d0cfSchristosThe form of the attribute must be one of 1419dd9d0cfSchristos.Dv DW_FORM_string 1429dd9d0cfSchristosor 1439dd9d0cfSchristos.Dv DW_FORM_strp . 1449dd9d0cfSchristos.Pp 1459dd9d0cfSchristosFunction 1469dd9d0cfSchristos.Fn dwarf_attrval_unsigned 1479dd9d0cfSchristosstores the value for the attribute named by argument 148cdbf1fe1Sjkoshy.Fa attr 1499dd9d0cfSchristosinto the location pointed to by argument 150cdbf1fe1Sjkoshy.Fa ret . 1519dd9d0cfSchristosThe attribute's value is treated as an unsigned integral quantity, and 1529dd9d0cfSchristosis zero-extended as needed. 1539dd9d0cfSchristosThe named attribute must belong to one of the 1549dd9d0cfSchristos.Dv CONSTANT , 1559dd9d0cfSchristos.Dv ADDRESS 1569dd9d0cfSchristosor 1579dd9d0cfSchristos.Dv REFERENCE 1589dd9d0cfSchristosclasses and must have one of the following forms: 1599dd9d0cfSchristos.Dv DW_FORM_addr , 1609dd9d0cfSchristos.Dv DW_FORM_data1 , 1619dd9d0cfSchristos.Dv DW_FORM_data2 , 1629dd9d0cfSchristos.Dv DW_FORM_data4 , 1639dd9d0cfSchristos.Dv DW_FORM_data8 , 1649dd9d0cfSchristos.Dv DW_FORM_udata , 1659dd9d0cfSchristos.Dv DW_FORM_ref1 , 1669dd9d0cfSchristos.Dv DW_FORM_ref2 , 1679dd9d0cfSchristos.Dv DW_FORM_ref4 , 1689dd9d0cfSchristos.Dv DW_FORM_ref8 , 1699dd9d0cfSchristosor 1709dd9d0cfSchristos.Dv DW_FORM_ref_udata . 1719dd9d0cfSchristos.Pp 1729dd9d0cfSchristosIf the attribute named by argument 173cdbf1fe1Sjkoshy.Fa attr 174604b0842Sjkoshyis 175604b0842Sjkoshy.Dv DW_AT_type 176604b0842Sjkoshyand is not present in the debugging information entry referenced by argument 177cdbf1fe1Sjkoshy.Fa die , 1789dd9d0cfSchristosand if a 1799dd9d0cfSchristos.Dv DW_AT_abstract_origin 180604b0842Sjkoshyor 181604b0842Sjkoshy.Dv DW_AT_specification 1829dd9d0cfSchristosattribute is present in the debugging information entry, 1839dd9d0cfSchristosfunction 1849dd9d0cfSchristos.Fn dwarf_attrval_unsigned 1859dd9d0cfSchristoswill search for the named attribute in the debugging information entry 1869dd9d0cfSchristosreferenced by the 1879dd9d0cfSchristos.Dv DW_AT_abstract_origin 188604b0842Sjkoshyor 189604b0842Sjkoshy.Dv DW_AT_specification 1909dd9d0cfSchristosattribute. 1919dd9d0cfSchristos.Sh RETURN VALUES 1929dd9d0cfSchristosOn success, these functions returns 1939dd9d0cfSchristos.Dv DW_DLV_OK . 1949dd9d0cfSchristosIf the named attribute was not found in the specified debugging 1959dd9d0cfSchristosinformation entry descriptor these functions return 1969dd9d0cfSchristos.Dv DW_DLV_NO_ENTRY 1979dd9d0cfSchristosand set argument 198cdbf1fe1Sjkoshy.Fa err . 1999dd9d0cfSchristosFor other errors, these functions return 2009dd9d0cfSchristos.Dv DW_DLV_ERROR 2019dd9d0cfSchristosand set argument 202cdbf1fe1Sjkoshy.Fa err . 2039dd9d0cfSchristos.Sh COMPATIBILITY 2049dd9d0cfSchristosThese functions are extensions added by this implementation of the 2059dd9d0cfSchristosDWARF(3) API. 2069dd9d0cfSchristos.Sh ERRORS 2079dd9d0cfSchristosThese functions may fail with the following errors: 2089dd9d0cfSchristos.Bl -tag -width ".Bq Er DW_DLE_ATTR_FORM_BAD" 2099dd9d0cfSchristos.It Bq Er DW_DLE_ARGUMENT 2109dd9d0cfSchristosEither of the arguments 2119dd9d0cfSchristos.Va die 2129dd9d0cfSchristosor 2139dd9d0cfSchristos.Va ret 214cdbf1fe1Sjkoshywas 215cdbf1fe1Sjkoshy.Dv NULL . 2169dd9d0cfSchristos.It Bq Er DW_DLE_NO_ENTRY 2179dd9d0cfSchristosArgument 218cdbf1fe1Sjkoshy.Fa die 2199dd9d0cfSchristosdid not contain an attribute corresponding to the value in argument 220cdbf1fe1Sjkoshy.Fa attr . 2219dd9d0cfSchristos.It Bq Er DW_DLE_ATTR_FORM_BAD 2229dd9d0cfSchristosThe attribute named by argument 223cdbf1fe1Sjkoshy.Fa attr 2249dd9d0cfSchristoswas not of a permitted form. 2259dd9d0cfSchristos.El 2269dd9d0cfSchristos.Sh SEE ALSO 2279dd9d0cfSchristos.Xr dwarf 3 , 2289dd9d0cfSchristos.Xr dwarf_attr 3 , 2299dd9d0cfSchristos.Xr dwarf_hasattr 3 230