1.\" Copyright (c) 2010 Joseph Koshy 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 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. 12.\" 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 23.\" SUCH DAMAGE. 24.\" 25.\" $Id: dwarf_formudata.3 3181 2015-04-10 13:22:51Z emaste $ 26.\" 27.Dd June 21, 2010 28.Os 29.Dt DWARF_FORMUDATA 3 30.Sh NAME 31.Nm dwarf_formudata , 32.Nm dwarf_formsdata 33.Nd return the value of a CONSTANT class attribute 34.Sh LIBRARY 35.Lb libdwarf 36.Sh SYNOPSIS 37.In libdwarf.h 38.Ft int 39.Fo dwarf_formudata 40.Fa "Dwarf_Attribute attr" 41.Fa "Dwarf_Unsigned *ret" 42.Fa "Dwarf_Error *err" 43.Fc 44.Ft int 45.Fo dwarf_formsdata 46.Fa "Dwarf_Attribute attr" 47.Fa "Dwarf_Signed *ret" 48.Fa "Dwarf_Error *err" 49.Fc 50.Sh DESCRIPTION 51These functions return the value associated with a DWARF attribute 52describing a constant. 53.Pp 54Function 55.Fn dwarf_formudata 56sets the location pointed to by argument 57.Ar ret 58to the value of the attribute referenced by argument 59.Ar attr , 60treating the value as an unsigned quantity. 61Argument 62.Ar attr 63must have one of the following forms: 64.Dv DW_FORM_data1 , 65.Dv DW_FORM_data2 , 66.Dv DW_FORM_data4 , 67.Dv DW_FORM_data8 68and 69.Dv DW_FORM_udata . 70.Pp 71Function 72.Fn dwarf_formsdata 73sets the location pointed to by argument 74.Ar ret 75to the value of the attribute referenced by argument 76.Ar attr , 77appropriately sign extended. 78Argument 79.Ar attr 80must have one of the following forms: 81.Dv DW_FORM_data1 , 82.Dv DW_FORM_data2 , 83.Dv DW_FORM_data4 , 84.Dv DW_FORM_data8 85and 86.Dv DW_FORM_sdata . 87.Pp 88If argument 89.Ar err 90is not NULL, it will be used to return an error descriptor in case 91of an error. 92.Sh RETURN VALUES 93These functions return 94.Dv DW_DLV_OK 95on success. 96In case of an error, they return 97.Dv DW_DLV_ERROR 98and set argument 99.Ar err . 100.Sh ERRORS 101These functions may fail with the following errors: 102.Bl -tag -width ".Bq Er DW_DLE_ATTR_FORM_BAD" 103.It Bq Er DW_DLE_ARGUMENT 104Either of arguments 105.Ar attr 106or 107.Ar ret 108was NULL. 109.It Bq Er DW_DLE_ATTR_FORM_BAD 110The attribute referenced by argument 111.Ar attr 112was not of a permitted kind. 113.El 114.Sh SEE ALSO 115.Xr dwarf 3 , 116.Xr dwarf_attr 3 , 117.Xr dwarf_formblock 3 , 118.Xr dwarf_formflag 3 , 119.Xr dwarf_formref 3 , 120.Xr dwarf_formsig8 3 , 121.Xr dwarf_formstring 3 , 122.Xr dwarf_hasattr 3 123