1.\" $NetBSD: dwarf_highpc.3,v 1.6 2024/03/03 17:37:31 christos Exp $ 2.\" 3.\" Copyright (c) 2010,2014 Kai Wang 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.\" Id: dwarf_highpc.3 3963 2022-03-12 16:07:32Z jkoshy 28.\" 29.Dd July 22, 2014 30.Dt DWARF_HIGHPC 3 31.Os 32.Sh NAME 33.Nm dwarf_arrayorder , 34.Nm dwarf_bitoffset , 35.Nm dwarf_bitsize , 36.Nm dwarf_bytesize , 37.Nm dwarf_highpc , 38.Nm dwarf_highpc_b , 39.Nm dwarf_lowpc , 40.Nm dwarf_srclang 41.Nd retrieve the value of a DWARF attribute 42.Sh LIBRARY 43.Lb libdwarf 44.Sh SYNOPSIS 45.In libdwarf.h 46.Ft int 47.Fo dwarf_arrayorder 48.Fa "Dwarf_Die die" 49.Fa "Dwarf_Unsigned *ret_order" 50.Fa "Dwarf_Error *err" 51.Fc 52.Ft int 53.Fo dwarf_bitoffset 54.Fa "Dwarf_Die die" 55.Fa "Dwarf_Unsigned *ret_size" 56.Fa "Dwarf_Error *err" 57.Fc 58.Ft int 59.Fo dwarf_bitsize 60.Fa "Dwarf_Die die" 61.Fa "Dwarf_Unsigned *ret_size" 62.Fa "Dwarf_Error *err" 63.Fc 64.Ft int 65.Fo dwarf_bytesize 66.Fa "Dwarf_Die die" 67.Fa "Dwarf_Unsigned *ret_size" 68.Fa "Dwarf_Error *err" 69.Fc 70.Ft int 71.Fo dwarf_highpc 72.Fa "Dwarf_Die die" 73.Fa "Dwarf_Addr *ret_highpc" 74.Fa "Dwarf_Error *err" 75.Fc 76.Ft int 77.Fo dwarf_highpc_b 78.Fa "Dwarf_Die die" 79.Fa "Dwarf_Addr *ret_highpc" 80.Fa "Dwarf_Half *ret_form" 81.Fa "enum Dwarf_Form_Class *ret_class" 82.Fa "Dwarf_Error *err" 83.Fc 84.Ft int 85.Fo dwarf_lowpc 86.Fa "Dwarf_Die die" 87.Fa "Dwarf_Addr *ret_lowpc" 88.Fa "Dwarf_Error *err" 89.Fc 90.Ft int 91.Fo dwarf_srclang 92.Fa "Dwarf_Die die" 93.Fa "Dwarf_Unsigned *ret_lang" 94.Fa "Dwarf_Error *err" 95.Fc 96.Sh DESCRIPTION 97These convenience functions are used to retrieve DWARF attribute 98values associated with a Debugging Information Entry (DIE) descriptor 99denoted by argument 100.Fa die . 101These functions store the value of the requested attribute into the 102location pointed to by their second argument, provided that the requested 103attribute exists in the debugging information entry. 104.Pp 105The list of functions and the DWARF attribute that they retrieve are: 106.Pp 107.Bl -tag -width ".Fn dwarf_arrayorder" -compact 108.It Fn dwarf_arrayorder 109Retrieve the 110.Dv DW_AT_ordering 111attribute value. 112.It Fn dwarf_bitoffset 113Retrieve the 114.Dv DW_AT_bit_offset 115attribute value. 116.It Fn dwarf_bitsize 117Retrieve the 118.Dv DW_AT_bit_size 119attribute value. 120.It Fn dwarf_bytesize 121Retrieve the 122.Dv DW_AT_byte_size 123attribute value. 124.It Fn dwarf_highpc 125Retrieve the 126.Dv DW_AT_high_pc 127attribute value. 128.It Fn dwarf_highpc_b 129Retrieve the 130.Dv DW_AT_high_pc 131attribute value. 132.It Fn dwarf_lowpc 133Retrieve the 134.Dv DW_AT_low_pc 135attribute value. 136.It Fn dwarf_srclang 137Retrieve the 138.Dv DW_AT_language 139attribute value. 140.El 141.Pp 142Function 143.Fn dwarf_highpc_b 144is an enhanced version of function 145.Fn dwarf_highpc . 146It sets the location specified by argument 147.Fa ret_form 148to the form code of the attribute 149.Dv DW_AT_high_pc , 150and sets the location specified by argument 151.Fa ret_class 152to the class of that form. 153A value of 154.Dv NULL 155may be used for either of the arguments 156.Fa ret_form 157or 158.Fa ret_class 159if the caller is not interested in the respective value. 160.Sh RETURN VALUES 161These functions return 162.Dv DW_DLV_OK 163on success. 164.Pp 165If the debugging information entry descriptor denoted by argument 166.Fa die 167does not contain the requested attribute, these functions return 168.Dv DW_DLV_NO_ENTRY 169and set argument 170.Fa err . 171For other errors, they return 172.Dv DW_DLV_ERROR 173and set argument 174.Fa err . 175.Sh ERRORS 176These functions can fail with the following errors: 177.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT" 178.It Bq Er DW_DLE_ARGUMENT 179Arguments 180.Fa die , 181.Fa ret_highpc , 182.Fa ret_lowpc , 183.Fa ret_size , 184.Fa ret_lang 185or 186.Fa ret_order 187were 188.Dv NULL . 189.It Bq Er DW_DLE_NO_ENTRY 190Argument 191.Fa die 192had no requested attribute. 193.El 194.Sh SEE ALSO 195.Xr dwarf 3 , 196.Xr dwarf_attr 3 , 197.Xr dwarf_attrlist 3 , 198.Xr dwarf_get_form_class 3 , 199.Xr dwarf_hasattr 3 200