1*5ac3bc71Schristos.\" $NetBSD: dwarf_get_weaks.3,v 1.6 2024/03/03 17:37:31 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_get_weaks.3 3963 2022-03-12 16:07:32Z jkoshy 289dd9d0cfSchristos.\" 299dd9d0cfSchristos.Dd April 10, 2011 309dd9d0cfSchristos.Dt DWARF_GET_WEAKS 3 31604b0842Sjkoshy.Os 329dd9d0cfSchristos.Sh NAME 339dd9d0cfSchristos.Nm dwarf_get_weaks , 349dd9d0cfSchristos.Nm dwarf_weak_cu_offset , 359dd9d0cfSchristos.Nm dwarf_weak_die_offset , 369dd9d0cfSchristos.Nm dwarf_weak_name_offsets , 379dd9d0cfSchristos.Nm dwarf_weakname 389dd9d0cfSchristos.Nd retrieve information about weak symbols 399dd9d0cfSchristos.Sh LIBRARY 409dd9d0cfSchristos.Lb libdwarf 419dd9d0cfSchristos.Sh SYNOPSIS 429dd9d0cfSchristos.In libdwarf.h 439dd9d0cfSchristos.Ft int 449dd9d0cfSchristos.Fo dwarf_get_weaks 459dd9d0cfSchristos.Fa "Dwarf_Debug dbg" 469dd9d0cfSchristos.Fa "Dwarf_Weak **weaks" 479dd9d0cfSchristos.Fa "Dwarf_Signed *nweaks" 489dd9d0cfSchristos.Fa "Dwarf_Error *err" 499dd9d0cfSchristos.Fc 509dd9d0cfSchristos.Ft int 519dd9d0cfSchristos.Fo dwarf_weak_cu_offset 529dd9d0cfSchristos.Fa "Dwarf_Weak weak" 539dd9d0cfSchristos.Fa "Dwarf_Off *cu_offset" 549dd9d0cfSchristos.Fa "Dwarf_Error *err" 559dd9d0cfSchristos.Fc 569dd9d0cfSchristos.Ft int 579dd9d0cfSchristos.Fo dwarf_weak_die_offset 589dd9d0cfSchristos.Fa "Dwarf_Weak weak" 599dd9d0cfSchristos.Fa "Dwarf_Off *die_offset" 609dd9d0cfSchristos.Fa "Dwarf_Error *err" 619dd9d0cfSchristos.Fc 629dd9d0cfSchristos.Ft int 639dd9d0cfSchristos.Fo dwarf_weak_name_offsets 649dd9d0cfSchristos.Fa "Dwarf_Weak weak" 659dd9d0cfSchristos.Fa "char **name" 669dd9d0cfSchristos.Fa "Dwarf_Off *die_offset" 679dd9d0cfSchristos.Fa "Dwarf_Off *cu_die_offset" 689dd9d0cfSchristos.Fa "Dwarf_Error *err" 699dd9d0cfSchristos.Fc 709dd9d0cfSchristos.Ft int 719dd9d0cfSchristos.Fo dwarf_weakname 729dd9d0cfSchristos.Fa "Dwarf_Weak weak" 739dd9d0cfSchristos.Fa "char **name" 749dd9d0cfSchristos.Fa "Dwarf_Error *err" 759dd9d0cfSchristos.Fc 769dd9d0cfSchristos.Sh DESCRIPTION 779dd9d0cfSchristosThese functions retrieve information about weak symbols from the 789dd9d0cfSchristoslookup tables in the (SGI-specific) 799dd9d0cfSchristos.Dq ".debug_weaknames" 809dd9d0cfSchristossection. 819dd9d0cfSchristosInformation about weak symbols is returned using opaque descriptors 829dd9d0cfSchristosof type 839dd9d0cfSchristos.Vt Dwarf_Weak . 849dd9d0cfSchristosApplications need to use the functions described below to retrieve 859dd9d0cfSchristosthe name and offset information contained in these descriptors. 869dd9d0cfSchristos.Pp 879dd9d0cfSchristosFunction 889dd9d0cfSchristos.Fn dwarf_get_weaks 899dd9d0cfSchristosretrieves descriptors for all the weak symbols associated with the 909dd9d0cfSchristosDWARF debug context specified by argument 91cdbf1fe1Sjkoshy.Fa dbg . 929dd9d0cfSchristosThe argument 93cdbf1fe1Sjkoshy.Fa weaks 949dd9d0cfSchristosshould point to a location that will be set to a pointer to an array 959dd9d0cfSchristosof 969dd9d0cfSchristos.Vt Dwarf_Weak 979dd9d0cfSchristosdescriptors. 989dd9d0cfSchristosThe argument 99cdbf1fe1Sjkoshy.Fa nweaks 1009dd9d0cfSchristosshould point to a location that will be set to the number of 1019dd9d0cfSchristosdescriptors returned. 1029dd9d0cfSchristos.Pp 1039dd9d0cfSchristosFunction 1049dd9d0cfSchristos.Fn dwarf_weak_cu_offset 1059dd9d0cfSchristosreturns the offset, relative to the 1069dd9d0cfSchristos.Dq ".debug_info" 1079dd9d0cfSchristossection, of the compilation unit that contains the debugging 1089dd9d0cfSchristosinformation entry associated with the argument 109cdbf1fe1Sjkoshy.Fa weak . 1109dd9d0cfSchristosArgument 111cdbf1fe1Sjkoshy.Fa cu_offset 1129dd9d0cfSchristosshould point to a location that will hold the returned offset. 1139dd9d0cfSchristos.Pp 1149dd9d0cfSchristosFunction 1159dd9d0cfSchristos.Fn dwarf_weak_die_offset 1169dd9d0cfSchristosretrieves the offset, relative to the 1179dd9d0cfSchristos.Dq ".debug_info" 1189dd9d0cfSchristossection, of the debugging information entry associated with the 1199dd9d0cfSchristosargument 120cdbf1fe1Sjkoshy.Fa weak , 1219dd9d0cfSchristosand stores it into the location pointed to by the argument 122cdbf1fe1Sjkoshy.Fa die_offset . 1239dd9d0cfSchristos.Pp 1249dd9d0cfSchristosFunction 1259dd9d0cfSchristos.Fn dwarf_weak_name_offsets 1269dd9d0cfSchristosretrieves the name and offsets for the debugging information 1279dd9d0cfSchristosentry for argument 128cdbf1fe1Sjkoshy.Fa weak . 1299dd9d0cfSchristosArgument 130cdbf1fe1Sjkoshy.Fa name 1319dd9d0cfSchristosshould point to a location which will be set to a pointer to a 1329dd9d0cfSchristosNUL-terminated string containing the name of the associated debugging 1339dd9d0cfSchristosinformation entry. 1349dd9d0cfSchristosArgument 135cdbf1fe1Sjkoshy.Fa die_offset 1369dd9d0cfSchristosshould point to a location which will be set to the offset, relative 1379dd9d0cfSchristosto the 1389dd9d0cfSchristos.Dq ".debug_info" 1399dd9d0cfSchristossection, of the associated debugging information entry. 1409dd9d0cfSchristosArgument 141cdbf1fe1Sjkoshy.Fa cu_die_offset 1429dd9d0cfSchristosshould point to a location which will be set to the 1439dd9d0cfSchristosoffset, relative to the 1449dd9d0cfSchristos.Dq ".debug_info" 1459dd9d0cfSchristossection, of the first debugging information entry in the compilation 1469dd9d0cfSchristosunit associated with argument 147cdbf1fe1Sjkoshy.Fa weak . 1489dd9d0cfSchristos.Pp 1499dd9d0cfSchristosFunction 1509dd9d0cfSchristos.Fn dwarf_weakname 1519dd9d0cfSchristossets the location pointed to by argument 152cdbf1fe1Sjkoshy.Fa name 1539dd9d0cfSchristosto a pointer to a NUL-terminated string holding the name of the 1549dd9d0cfSchristosdebugging information entry associated with the argument 155cdbf1fe1Sjkoshy.Fa weak . 1569dd9d0cfSchristos.Ss Memory Management 1579dd9d0cfSchristosThe memory area used for the array of 1589dd9d0cfSchristos.Vt Dwarf_Weak 1599dd9d0cfSchristosdescriptors returned in argument 160cdbf1fe1Sjkoshy.Fa weaks 1619dd9d0cfSchristosby function 1629dd9d0cfSchristos.Fn dwarf_get_weaks 1639dd9d0cfSchristosis owned by the 1649dd9d0cfSchristos.Lb libdwarf . 1659dd9d0cfSchristosApplication code should not attempt to directly free this pointer. 1669dd9d0cfSchristosPortable code should instead use the function 1679dd9d0cfSchristos.Xr dwarf_weaks_dealloc 3 1689dd9d0cfSchristosto indicate that the memory area may be freed. 1699dd9d0cfSchristos.Pp 1709dd9d0cfSchristosThe memory area used for the string returned in the 171cdbf1fe1Sjkoshy.Fa name 1729dd9d0cfSchristosargument to functions 1739dd9d0cfSchristos.Fn dwarf_weak_name_offsets 1749dd9d0cfSchristosand 1759dd9d0cfSchristos.Fn dwarf_weakname 1769dd9d0cfSchristosis owned by the 1779dd9d0cfSchristos.Lb libdwarf . 1789dd9d0cfSchristosPortable code should indicate that the memory area can 1799dd9d0cfSchristosbe freed using the 1809dd9d0cfSchristos.Xr dwarf_dealloc 3 1819dd9d0cfSchristosfunction. 1829dd9d0cfSchristos.Ss Error Returns 1839dd9d0cfSchristosIf argument 184cdbf1fe1Sjkoshy.Fa err 185cdbf1fe1Sjkoshyis not 186cdbf1fe1Sjkoshy.Dv NULL , 187cdbf1fe1Sjkoshythese functions will use it to store error information, 1889dd9d0cfSchristosin case of an error. 1899dd9d0cfSchristos.Sh RETURN VALUES 1909dd9d0cfSchristosOn success, these functions returns 1919dd9d0cfSchristos.Dv DW_DLV_OK . 1929dd9d0cfSchristosIn case of an error, they return 1939dd9d0cfSchristos.Dv DW_DLV_ERROR 1949dd9d0cfSchristosand set the argument 195cdbf1fe1Sjkoshy.Fa err . 1969dd9d0cfSchristos.Sh ERRORS 1979dd9d0cfSchristosThese functions may fail with the following errors: 1989dd9d0cfSchristos.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT" 1999dd9d0cfSchristos.It Bq Er DW_DLE_ARGUMENT 2009dd9d0cfSchristosOne of the arguments 2019dd9d0cfSchristos.Va cu_die_offset , 2029dd9d0cfSchristos.Va cu_offset , 2039dd9d0cfSchristos.Va dbg , 2049dd9d0cfSchristos.Va die_offset , 2059dd9d0cfSchristos.Va weak , 2069dd9d0cfSchristos.Va weaks , 2079dd9d0cfSchristos.Va name , 2089dd9d0cfSchristosor 2099dd9d0cfSchristos.Va nweaks 210cdbf1fe1Sjkoshywas 211cdbf1fe1Sjkoshy.Dv NULL . 2129dd9d0cfSchristos.It Bq Er DW_DLE_NO_ENTRY 2139dd9d0cfSchristosThe DWARF debugging context referenced by argument 214cdbf1fe1Sjkoshy.Fa dbg 2159dd9d0cfSchristosdid not contain information about weak symbols. 2169dd9d0cfSchristos.El 2179dd9d0cfSchristos.Sh SEE ALSO 2189dd9d0cfSchristos.Xr dwarf 3 , 2199dd9d0cfSchristos.Xr dwarf_get_cu_die_offset_given_cu_header_offset 3 , 2209dd9d0cfSchristos.Xr dwarf_weaks_dealloc 3 221