1.\" $NetBSD: dwarf_hasform.3,v 1.6 2024/03/03 17:37:31 christos Exp $ 2.\" 3.\" Copyright (c) 2010 Joseph Koshy. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" This software is provided by Joseph Koshy ``as is'' and 15.\" any express or implied warranties, including, but not limited to, the 16.\" implied warranties of merchantability and fitness for a particular purpose 17.\" are disclaimed. in no event shall Joseph Koshy be liable 18.\" for any direct, indirect, incidental, special, exemplary, or consequential 19.\" damages (including, but not limited to, procurement of substitute goods 20.\" or services; loss of use, data, or profits; or business interruption) 21.\" however caused and on any theory of liability, whether in contract, strict 22.\" liability, or tort (including negligence or otherwise) arising in any way 23.\" out of the use of this software, even if advised of the possibility of 24.\" such damage. 25.\" 26.\" Id: dwarf_hasform.3 3963 2022-03-12 16:07:32Z jkoshy 27.\" 28.Dd May 22, 2010 29.Dt DWARF_HASFORM 3 30.Os 31.Sh NAME 32.Nm dwarf_hasform , 33.Nm dwarf_whatform , 34.Nm dwarf_whatform_direct 35.Nd query attribute forms 36.Sh LIBRARY 37.Lb libdwarf 38.Sh SYNOPSIS 39.In libdwarf.h 40.Ft int 41.Fo dwarf_hasform 42.Fa "Dwarf_Attribute attr" 43.Fa "Dwarf_Half form" 44.Fa "Dwarf_Bool *ret" 45.Fa "Dwarf_Error *err" 46.Fc 47.Ft int 48.Fo dwarf_whatform 49.Fa "Dwarf_Attribute attr" 50.Fa "Dwarf_Half *retform" 51.Fa "Dwarf_Error *err" 52.Fc 53.Ft int 54.Fo dwarf_whatform_direct 55.Fa "Dwarf_Attribute attr" 56.Fa "Dwarf_Half *retform" 57.Fa "Dwarf_Error *err" 58.Fc 59.Sh DESCRIPTION 60Function 61.Fn dwarf_hasform 62indicates whether the DWARF attribute denoted by argument 63.Fa attr 64has the attribute form specified by argument 65.Fa form . 66If the attribute has the specified form, then 67argument 68.Fa ret 69is set to a non-zero value, otherwise it is set to zero. 70If argument 71.Fa err 72is 73.No non- Ns Dv NULL , 74it will be used to return an error descriptor in case of an error. 75.Pp 76Function 77.Fn dwarf_whatform 78sets the location specified by argument 79.Fa retform 80to the attribute form code for the DWARF attribute referenced 81by argument 82.Fa attr . 83If the attribute referenced by argument 84.Fa attr 85has an indirect form attribute, this function will return the final 86form for the attribute. 87If argument 88.Fa err 89is 90.No non- Ns Dv NULL , 91it will be used to return an error descriptor in case of an error. 92.Pp 93Function 94.Fn dwarf_whatform_direct 95sets the location specified by argument 96.Fa retform 97to the attribute form code for the DWARF attribute referenced 98by argument 99.Fa attr . 100If the form is an indirect form, the function sets the location 101specified by argument 102.Fa retform 103to 104.Dv DW_FORM_indirect . 105If argument 106.Fa err 107is 108.No non- Ns Dv NULL , 109it will be used to return an error descriptor in case of an error. 110.Sh RETURN VALUES 111These functions return 112.Dv DW_DLV_OK 113on success. 114In case of an error, these functions return 115.Dv DW_DLV_ERR 116and set argument 117.Fa err . 118.Sh ERRORS 119These functions may fail with the following errors: 120.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT" 121.It Bq Er DW_DLE_ARGUMENT 122Any of the arguments 123.Fa attr , 124.Fa ret , 125or 126.Fa retform 127was 128.Dv NULL . 129.El 130.Sh SEE ALSO 131.Xr dwarf 3 , 132.Xr dwarf_attr 3 , 133.Xr dwarf_hasattr 3 134