1cf781b2eSEd Maste.\" Copyright (c) 2010,2014 Kai Wang 22de3b87aSKai Wang.\" All rights reserved. 32de3b87aSKai Wang.\" 42de3b87aSKai Wang.\" Redistribution and use in source and binary forms, with or without 52de3b87aSKai Wang.\" modification, are permitted provided that the following conditions 62de3b87aSKai Wang.\" are met: 72de3b87aSKai Wang.\" 1. Redistributions of source code must retain the above copyright 82de3b87aSKai Wang.\" notice, this list of conditions and the following disclaimer. 92de3b87aSKai Wang.\" 2. Redistributions in binary form must reproduce the above copyright 102de3b87aSKai Wang.\" notice, this list of conditions and the following disclaimer in the 112de3b87aSKai Wang.\" documentation and/or other materials provided with the distribution. 122de3b87aSKai Wang.\" 132de3b87aSKai Wang.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 142de3b87aSKai Wang.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 152de3b87aSKai Wang.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 162de3b87aSKai Wang.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 172de3b87aSKai Wang.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 182de3b87aSKai Wang.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 192de3b87aSKai Wang.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 202de3b87aSKai Wang.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 212de3b87aSKai Wang.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 222de3b87aSKai Wang.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 232de3b87aSKai Wang.\" SUCH DAMAGE. 242de3b87aSKai Wang.\" 25*ae500c1fSEd Maste.\" $Id: dwarf_dieoffset.3 3640 2018-10-14 14:09:13Z jkoshy $ 262de3b87aSKai Wang.\" 27cf781b2eSEd Maste.Dd December 21, 2014 282de3b87aSKai Wang.Dt DWARF_DIEOFFSET 3 29*ae500c1fSEd Maste.Os 302de3b87aSKai Wang.Sh NAME 312de3b87aSKai Wang.Nm dwarf_die_CU_offset , 322de3b87aSKai Wang.Nm dwarf_die_CU_offset_range , 332de3b87aSKai Wang.Nm dwarf_dieoffset , 34cf781b2eSEd Maste.Nm dwarf_get_cu_die_offset_given_cu_header_offset , 35cf781b2eSEd Maste.Nm dwarf_get_cu_die_offset_given_cu_header_offset_b 362de3b87aSKai Wang.Nd return offsets of DWARF debugging information entries 372de3b87aSKai Wang.Sh LIBRARY 382de3b87aSKai Wang.Lb libdwarf 392de3b87aSKai Wang.Sh SYNOPSIS 402de3b87aSKai Wang.In libdwarf.h 412de3b87aSKai Wang.Ft int 422de3b87aSKai Wang.Fo dwarf_die_CU_offset 432de3b87aSKai Wang.Fa "Dwarf_Die die" 442de3b87aSKai Wang.Fa "Dwarf_Off *ret_offset" 452de3b87aSKai Wang.Fa "Dwarf_Error *err" 462de3b87aSKai Wang.Fc 472de3b87aSKai Wang.Ft int 482de3b87aSKai Wang.Fo dwarf_die_CU_offset_range 492de3b87aSKai Wang.Fa "Dwarf_Die die" 502de3b87aSKai Wang.Fa "Dwarf_Off *cu_offset" 512de3b87aSKai Wang.Fa "Dwarf_Off *cu_length" 522de3b87aSKai Wang.Fa "Dwarf_Error *err" 532de3b87aSKai Wang.Fc 542de3b87aSKai Wang.Ft int 552de3b87aSKai Wang.Fo dwarf_dieoffset 562de3b87aSKai Wang.Fa "Dwarf_Die die" 572de3b87aSKai Wang.Fa "Dwarf_Off *ret_offset" 582de3b87aSKai Wang.Fa "Dwarf_Error *err" 592de3b87aSKai Wang.Fc 602de3b87aSKai Wang.Ft int 612de3b87aSKai Wang.Fo dwarf_get_cu_die_offset_given_cu_header_offset 622de3b87aSKai Wang.Fa "Dwarf_Debug dbg" 632de3b87aSKai Wang.Fa "Dwarf_Off in_cu_header_offset" 642de3b87aSKai Wang.Fa "Dwarf_Off *out_cu_die_offset" 652de3b87aSKai Wang.Fa "Dwarf_Error *err" 662de3b87aSKai Wang.Fc 67cf781b2eSEd Maste.Ft int 68cf781b2eSEd Maste.Fo dwarf_get_cu_die_offset_given_cu_header_offset_b 69cf781b2eSEd Maste.Fa "Dwarf_Debug dbg" 70cf781b2eSEd Maste.Fa "Dwarf_Off in_cu_header_offset" 71cf781b2eSEd Maste.Fa "Dwarf_Bool is_info" 72cf781b2eSEd Maste.Fa "Dwarf_Off *out_cu_die_offset" 73cf781b2eSEd Maste.Fa "Dwarf_Error *err" 74cf781b2eSEd Maste.Fc 752de3b87aSKai Wang.Sh DESCRIPTION 762de3b87aSKai WangThese functions are used to retrieve offsets for DWARF debugging 772de3b87aSKai Wanginformation entries. 782de3b87aSKai Wang.Pp 792de3b87aSKai WangFunction 802de3b87aSKai Wang.Fn dwarf_die_CU_offset 812de3b87aSKai Wangreturns the offset of the debugging information entry referenced by 822de3b87aSKai Wangargument 832de3b87aSKai Wang.Ar die 842de3b87aSKai Wangrelative to the start of its containing compilation unit. 852de3b87aSKai WangArgument 862de3b87aSKai Wang.Ar ret_offset 872de3b87aSKai Wangshould point to the location that is to hold the returned offset. 882de3b87aSKai WangIf argument 892de3b87aSKai Wang.Ar err 902de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of 912de3b87aSKai Wangan error. 922de3b87aSKai Wang.Pp 932de3b87aSKai WangFunction 942de3b87aSKai Wang.Fn dwarf_die_CU_offset_range 952de3b87aSKai Wangreturns the section-relative offset and length of the compilation unit 962de3b87aSKai Wangcontaining the debugging information entry referenced by argument 972de3b87aSKai Wang.Ar die . 982de3b87aSKai WangArgument 992de3b87aSKai Wang.Ar cu_offset 1002de3b87aSKai Wangshould point to a location that will hold the returned offset. 1012de3b87aSKai WangArgument 1022de3b87aSKai Wang.Ar cu_length 1032de3b87aSKai Wangshould point to a location that will hold the returned length of the 1042de3b87aSKai Wangcompilation unit. 1052de3b87aSKai WangIf argument 1062de3b87aSKai Wang.Ar err 1072de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of 1082de3b87aSKai Wangan error. 1092de3b87aSKai Wang.Pp 1102de3b87aSKai WangFunction 1112de3b87aSKai Wang.Fn dwarf_dieoffset 1122de3b87aSKai Wangretrieves the section-relative offset of the debugging information 1132de3b87aSKai Wangentry referenced by argument 1142de3b87aSKai Wang.Ar die . 1152de3b87aSKai WangArgument 1162de3b87aSKai Wang.Ar ret_offset 1172de3b87aSKai Wangshould point to a location that is to hold the returned 1182de3b87aSKai Wangsection-relative offset. 1192de3b87aSKai WangIf argument 1202de3b87aSKai Wang.Ar err 1212de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of 1222de3b87aSKai Wangan error. 1232de3b87aSKai Wang.Pp 1242de3b87aSKai WangFunction 1252de3b87aSKai Wang.Fn dwarf_get_cu_die_offset_given_cu_header_offset 126cf781b2eSEd Mastereturns the offset for the first debugging information entry for a 1272de3b87aSKai Wangcompilation unit, given an offset to the header of the compilation 1282de3b87aSKai Wangunit. 1292de3b87aSKai WangArgument 1302de3b87aSKai Wang.Ar dbg 1312de3b87aSKai Wangshould reference a valid debugging context allocated using 1322de3b87aSKai Wang.Xr dwarf_init 3 . 1332de3b87aSKai WangArgument 1342de3b87aSKai Wang.Ar in_cu_header_offset 1352de3b87aSKai Wangcontains the offset to the start of a compilation unit. 1362de3b87aSKai WangArgument 1372de3b87aSKai Wang.Ar out_cu_die_offset 1382de3b87aSKai Wangpoints to a location that will hold the returned offset. 1392de3b87aSKai WangIf argument 1402de3b87aSKai Wang.Ar err 1412de3b87aSKai Wangis non-NULL, it will be used to return an error descriptor in case of 1422de3b87aSKai Wangan error. 143cf781b2eSEd Maste.Pp 144cf781b2eSEd MasteFunction 145cf781b2eSEd Maste.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b 146cf781b2eSEd Mastebehaves identically to the function 147cf781b2eSEd Maste.Fn dwarf_get_cu_die_offset_given_cu_header_offset 148cf781b2eSEd Mastewhen the argument 149cf781b2eSEd Maste.Ar is_info 150cf781b2eSEd Masteis non-zero. 151cf781b2eSEd MasteWhen the argument 152cf781b2eSEd Maste.Ar is_info 153cf781b2eSEd Masteis zero, function 154cf781b2eSEd Maste.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b 155cf781b2eSEd Mastereturns the offset for the first debugging information entry for a 156cf781b2eSEd Mastetype unit, given an offset to the header of the type unit in argument 157cf781b2eSEd Maste.Ar in_cu_header_offset . 158cf781b2eSEd MasteArgument 159cf781b2eSEd Maste.Ar out_cu_die_offset 160cf781b2eSEd Mastepoints to a location that will hold the returned offset. 161cf781b2eSEd MasteIf the argument 162cf781b2eSEd Maste.Ar err 163cf781b2eSEd Masteis non-NULL, it will be used to return an error descriptor in case of 164cf781b2eSEd Mastean error. 1652de3b87aSKai Wang.Sh RETURN VALUES 166cf781b2eSEd MasteOn success, these functions return 1672de3b87aSKai Wang.Dv DW_DLV_OK . 1682de3b87aSKai WangIn case of an error, these functions return 1692de3b87aSKai Wang.Dv DW_DLV_ERROR 1702de3b87aSKai Wangand set argument 1712de3b87aSKai Wang.Ar err . 1722de3b87aSKai Wang.Pp 1732de3b87aSKai WangFunction 1742de3b87aSKai Wang.Fn dwarf_get_cu_die_offset_given_cu_header_offset 175cf781b2eSEd Masteand 176cf781b2eSEd Maste.Fn dwarf_get_cu_die_offset_given_cu_header_offset_b 1772de3b87aSKai Wangreturns 1782de3b87aSKai Wang.Dv DW_DLV_NO_ENTRY 1792de3b87aSKai Wangand sets argument 1802de3b87aSKai Wang.Ar err 181cf781b2eSEd Masteif there is no compilation or type unit located at the 1822de3b87aSKai Wangoffset specified in argument 1832de3b87aSKai Wang.Ar in_cu_header_offset . 1842de3b87aSKai Wang.Sh ERRORS 1852de3b87aSKai WangThese functions may fail with the following errors: 1862de3b87aSKai Wang.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT" 1872de3b87aSKai Wang.It Bq Er DW_DLE_ARGUMENT 1882de3b87aSKai WangOne of the arguments 1892de3b87aSKai Wang.Va cu_length , 1902de3b87aSKai Wang.Va cu_offset , 1912de3b87aSKai Wang.Va dbg , 1922de3b87aSKai Wang.Va die , 1932de3b87aSKai Wang.Va out_cu_die_offset 1942de3b87aSKai Wangor 1952de3b87aSKai Wang.Va ret_offset 1962de3b87aSKai Wangwas NULL. 1972de3b87aSKai Wang.It Bq Er DW_DLE_NO_ENTRY 1982de3b87aSKai WangArgument 1992de3b87aSKai Wang.Ar in_cu_header_offset 2002de3b87aSKai Wangspecified an unknown offset. 2012de3b87aSKai Wang.El 2022de3b87aSKai Wang.Sh SEE ALSO 2032de3b87aSKai Wang.Xr dwarf 3 , 2042de3b87aSKai Wang.Xr dwarf_next_cu_header 3 , 205cf781b2eSEd Maste.Xr dwarf_offdie 3 , 206cf781b2eSEd Maste.Xr dwarf_offdie_b 3 207