1.\" $NetBSD: dwarf_srcfiles.3,v 1.6 2024/03/03 17:37:32 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_srcfiles.3 3963 2022-03-12 16:07:32Z jkoshy 27.\" 28.Dd April 28, 2010 29.Dt DWARF_SRCFILES 3 30.Os 31.Sh NAME 32.Nm dwarf_srcfiles 33.Nd retrieve source file information 34.Sh LIBRARY 35.Lb libdwarf 36.Sh SYNOPSIS 37.In libdwarf.h 38.Ft int 39.Fo dwarf_srcfiles 40.Fa "Dwarf_Die die" 41.Fa "char ***filenames" 42.Fa "Dwarf_Signed *filenamecount" 43.Fa "Dwarf_Error *err" 44.Fc 45.Sh DESCRIPTION 46Function 47.Fn dwarf_srcfiles 48returns the source file names associated with a compilation unit. 49Source file names are returned as an array of NUL-terminated strings. 50.Pp 51Argument 52.Fa die 53should reference a DWARF debugging information entry descriptor with 54source file information, see 55.Xr dwarf 3 . 56Argument 57.Fa filenames 58should point to a location that will hold a pointer to the returned array 59of file names. 60Argument 61.Fa filenamecount 62should point to a location that will hold the number of file names returned. 63If argument 64.Fa err 65is not 66.Dv NULL , 67it will be used to store error information in case of an error. 68.Ss Memory Management 69The memory areas used for the file names and for array of pointers 70being returned are managed by the DWARF(3) library. 71The application should not attempt to directly free these memory areas. 72Portable code should indicate that the memory areas are to be freed 73by using 74.Xr dwarf_dealloc 3 . 75.Sh RETURN VALUES 76Function 77.Fn dwarf_srcfiles 78returns 79.Dv DW_DLV_OK 80when it succeeds. 81In case of an error, it returns 82.Dv DW_DLV_ERROR 83and sets the argument 84.Fa err . 85.Sh ERRORS 86Function 87.Fn dwarf_srcfiles 88can fail with: 89.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT" 90.It Bq Er DW_DLE_ARGUMENT 91One of the arguments 92.Fa die , 93.Fa filenames 94or 95.Fa filenamecount 96was 97.Dv NULL . 98.It Bq Er DW_DLE_NO_ENTRY 99The compilation unit referenced by argument 100.Fa die 101does not have associated source file information. 102.It Bq Er DW_DLE_MEMORY 103An out of memory condition was encountered during the execution of 104this function. 105.El 106.Sh SEE ALSO 107.Xr dwarf 3 , 108.Xr dwarf_dealloc 3 , 109.Xr dwarf_srclines 3 110