1*5ac3bc71Schristos.\" $NetBSD: dwarf_lineno.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_lineno.3 3963 2022-03-12 16:07:32Z jkoshy 289dd9d0cfSchristos.\" 299dd9d0cfSchristos.Dd February 5, 2011 309dd9d0cfSchristos.Dt DWARF_LINENO 3 31604b0842Sjkoshy.Os 329dd9d0cfSchristos.Sh NAME 339dd9d0cfSchristos.Nm dwarf_lineaddr , 349dd9d0cfSchristos.Nm dwarf_linebeginstatement , 359dd9d0cfSchristos.Nm dwarf_lineblock , 369dd9d0cfSchristos.Nm dwarf_lineendsequence , 379dd9d0cfSchristos.Nm dwarf_lineno , 389dd9d0cfSchristos.Nm dwarf_lineoff , 399dd9d0cfSchristos.Nm dwarf_linesrc , 409dd9d0cfSchristos.Nm dwarf_line_srcfileno 419dd9d0cfSchristos.Nd retrieve information associated with a DWARF line descriptor 429dd9d0cfSchristos.Sh LIBRARY 439dd9d0cfSchristos.Lb libdwarf 449dd9d0cfSchristos.Sh SYNOPSIS 459dd9d0cfSchristos.In libdwarf.h 469dd9d0cfSchristos.Ft int 479dd9d0cfSchristos.Fo dwarf_lineaddr 489dd9d0cfSchristos.Fa "Dwarf_Line ln" 499dd9d0cfSchristos.Fa "Dwarf_Addr *ret" 509dd9d0cfSchristos.Fa "Dwarf_Error *err" 519dd9d0cfSchristos.Fc 529dd9d0cfSchristos.Ft int 539dd9d0cfSchristos.Fo dwarf_linebeginstatement 549dd9d0cfSchristos.Fa "Dwarf_Line ln" 559dd9d0cfSchristos.Fa "Dwarf_Bool *ret" 569dd9d0cfSchristos.Fa "Dwarf_Error *err" 579dd9d0cfSchristos.Fc 589dd9d0cfSchristos.Ft int 599dd9d0cfSchristos.Fo dwarf_lineblock 609dd9d0cfSchristos.Fa "Dwarf_Line ln" 619dd9d0cfSchristos.Fa "Dwarf_Bool *ret" 629dd9d0cfSchristos.Fa "Dwarf_Error *err" 639dd9d0cfSchristos.Fc 649dd9d0cfSchristos.Ft int 659dd9d0cfSchristos.Fo dwarf_lineendsequence 669dd9d0cfSchristos.Fa "Dwarf_Line ln" 679dd9d0cfSchristos.Fa "Dwarf_Bool *ret" 689dd9d0cfSchristos.Fa "Dwarf_Error *err" 699dd9d0cfSchristos.Fc 709dd9d0cfSchristos.Ft int 719dd9d0cfSchristos.Fo dwarf_lineno 729dd9d0cfSchristos.Fa "Dwarf_Line ln" 739dd9d0cfSchristos.Fa "Dwarf_Unsigned *ret" 749dd9d0cfSchristos.Fa "Dwarf_Error *err" 759dd9d0cfSchristos.Fc 769dd9d0cfSchristos.Ft int 779dd9d0cfSchristos.Fo dwarf_lineoff 789dd9d0cfSchristos.Fa "Dwarf_Line ln" 799dd9d0cfSchristos.Fa "Dwarf_Signed *ret" 809dd9d0cfSchristos.Fa "Dwarf_Error *err" 819dd9d0cfSchristos.Fc 829dd9d0cfSchristos.Ft int 839dd9d0cfSchristos.Fo dwarf_linesrc 849dd9d0cfSchristos.Fa "Dwarf_Line ln" 859dd9d0cfSchristos.Fa "char **ret" 869dd9d0cfSchristos.Fa "Dwarf_Error *err" 879dd9d0cfSchristos.Fc 889dd9d0cfSchristos.Ft int 899dd9d0cfSchristos.Fo dwarf_line_srcfileno 909dd9d0cfSchristos.Fa "Dwarf_Line ln" 919dd9d0cfSchristos.Fa "Dwarf_Unsigned *ret" 929dd9d0cfSchristos.Fa "Dwarf_Error *err" 939dd9d0cfSchristos.Fc 949dd9d0cfSchristos.Sh DESCRIPTION 959dd9d0cfSchristosThese functions retrieve specific line information associated with 969dd9d0cfSchristosthe line descriptor specified by argument 97cdbf1fe1Sjkoshy.Fa ln , 989dd9d0cfSchristosand stores it in the location pointed to by argument 99cdbf1fe1Sjkoshy.Fa ret . 1009dd9d0cfSchristosIf argument 101cdbf1fe1Sjkoshy.Fa err 102cdbf1fe1Sjkoshyis not 103cdbf1fe1Sjkoshy.Dv NULL , 104cdbf1fe1Sjkoshyit will be used to store error information in case of an error. 1059dd9d0cfSchristos.Pp 1069dd9d0cfSchristosFunction 1079dd9d0cfSchristos.Fn dwarf_lineaddr 1089dd9d0cfSchristosstores the program address corresponding to the source line specified 1099dd9d0cfSchristosin argument 110cdbf1fe1Sjkoshy.Fa ln 1119dd9d0cfSchristosinto the location pointed to by argument 112cdbf1fe1Sjkoshy.Fa ret . 1139dd9d0cfSchristos.Pp 1149dd9d0cfSchristosFunction 1159dd9d0cfSchristos.Fn dwarf_linebeginstatement 1169dd9d0cfSchristossets the location pointed to by argument 117cdbf1fe1Sjkoshy.Fa ret 1189dd9d0cfSchristosto 1 if the source line specified by the line descriptor 119cdbf1fe1Sjkoshy.Fa ln 1209dd9d0cfSchristosis the beginning of a statement, or to 0 otherwise. 1219dd9d0cfSchristos.Pp 1229dd9d0cfSchristosFunction 1239dd9d0cfSchristos.Fn dwarf_lineblock 1249dd9d0cfSchristossets the location pointed to by argument 125cdbf1fe1Sjkoshy.Fa ret 1269dd9d0cfSchristosto 1 if the source line specified by the line descriptor 127cdbf1fe1Sjkoshy.Fa ln 1289dd9d0cfSchristosis the beginning of a basic block, or to 0 otherwise. 1299dd9d0cfSchristos.Pp 1309dd9d0cfSchristosFunction 1319dd9d0cfSchristos.Fn dwarf_lineendsequence 1329dd9d0cfSchristossets the location pointed to by argument 133cdbf1fe1Sjkoshy.Fa ret 1349dd9d0cfSchristosto 1 if the program address associated with the line descriptor 135cdbf1fe1Sjkoshy.Fa ln 1369dd9d0cfSchristosis the address immediately following the end of a sequence of target 1379dd9d0cfSchristosmachine instructions, or to 0 otherwise. 1389dd9d0cfSchristos.Pp 1399dd9d0cfSchristosFunction 1409dd9d0cfSchristos.Fn dwarf_lineno 1419dd9d0cfSchristosstores the line number of the source line associated with the line 1429dd9d0cfSchristosdescriptor 143cdbf1fe1Sjkoshy.Fa ln 1449dd9d0cfSchristosinto the location pointed to by argument 145cdbf1fe1Sjkoshy.Fa ret . 1469dd9d0cfSchristos.Pp 1479dd9d0cfSchristosFunction 1489dd9d0cfSchristos.Fn dwarf_lineoff 1499dd9d0cfSchristosstores the column number within a line associated with descriptor 150cdbf1fe1Sjkoshy.Fa ln 1519dd9d0cfSchristosinto the location pointed to by argument 152cdbf1fe1Sjkoshy.Fa ret . 1539dd9d0cfSchristosThe retrieved column numbers are 1-based, with the value -1 indicating 1549dd9d0cfSchristosthat column number information was not available. 1559dd9d0cfSchristos.Pp 1569dd9d0cfSchristosFunction 1579dd9d0cfSchristos.Fn dwarf_linesrc 1589dd9d0cfSchristosstores a pointer to a NUL-terminated string containing the source file 1599dd9d0cfSchristosname associated with line descriptor 160cdbf1fe1Sjkoshy.Fa ln 1619dd9d0cfSchristosinto the location pointed to by argument 162cdbf1fe1Sjkoshy.Fa ret . 1639dd9d0cfSchristosThe full path of the source file is returned if possible. 1649dd9d0cfSchristosThe memory used for the source file name string is managed by the DWARF(3) 1659dd9d0cfSchristoslibrary and should not be directly freed by application code. 1669dd9d0cfSchristosInstead, portable code should use 1679dd9d0cfSchristos.Xr dwarf_dealloc 3 1689dd9d0cfSchristosto indicate that the string should be freed. 1699dd9d0cfSchristos.Pp 1709dd9d0cfSchristosFunction 1719dd9d0cfSchristos.Fn dwarf_line_srcfileno 1729dd9d0cfSchristosstores the index of the source file associated with the line descriptor 173cdbf1fe1Sjkoshy.Fa ln 1749dd9d0cfSchristosin the location pointed to by argument 175cdbf1fe1Sjkoshy.Fa ret . 1769dd9d0cfSchristosThe returned value is 1-based index into the array of source file 1779dd9d0cfSchristosnames returned by 1789dd9d0cfSchristos.Xr dwarf_srcfiles 3 . 1799dd9d0cfSchristos.Sh RETURN VALUES 1809dd9d0cfSchristosOn success, these functions returns 1819dd9d0cfSchristos.Dv DW_DLV_OK . 1829dd9d0cfSchristosIn case of an error, they return 1839dd9d0cfSchristos.Dv DW_DLV_ERROR 1849dd9d0cfSchristosand set the argument 185cdbf1fe1Sjkoshy.Fa err . 1869dd9d0cfSchristos.Sh ERRORS 1879dd9d0cfSchristosThese functions may fail with the following errors: 1889dd9d0cfSchristos.Bl -tag -width ".Bq Er DW_DLE_LINE_FILE_NUM_BAD" 1899dd9d0cfSchristos.It Bq Er DW_DLE_ARGUMENT 1909dd9d0cfSchristosEither of the arguments 1919dd9d0cfSchristos.Va ln 1929dd9d0cfSchristosor 1939dd9d0cfSchristos.Va ret 194cdbf1fe1Sjkoshywas 195cdbf1fe1Sjkoshy.Dv NULL . 1969dd9d0cfSchristos.It Bq Er DW_DLE_LINE_FILE_NUM_BAD 1979dd9d0cfSchristosThe source file name associated with the line descriptor 198cdbf1fe1Sjkoshy.Fa ln 1999dd9d0cfSchristoscould not be retrieved by function 2009dd9d0cfSchristos.Fn dwarf_linesrc . 2019dd9d0cfSchristos.El 2029dd9d0cfSchristos.Sh SEE ALSO 2039dd9d0cfSchristos.Xr dwarf 3 , 2049dd9d0cfSchristos.Xr dwarf_dealloc 3 , 2059dd9d0cfSchristos.Xr dwarf_srcfiles 3 , 2069dd9d0cfSchristos.Xr dwarf_srclines 3 207