xref: /minix3/external/bsd/elftoolchain/dist/libdwarf/dwarf_srcfiles.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1.\"	$NetBSD: dwarf_srcfiles.3,v 1.2 2014/03/09 16:58:04 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 2075 2011-10-27 03:47:28Z jkoshy
27.\"
28.Dd April 28, 2010
29.Os
30.Dt DWARF_SRCFILES 3
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.Ar die
53should reference a DWARF debugging information entry descriptor with
54source file information, see
55.Xr dwarf 3 .
56Argument
57.Ar filenames
58should point to a location that will hold a pointer to the returned array
59of file names.
60Argument
61.Ar filenamecount
62should point to a location that will hold the number of file names returned.
63If argument
64.Ar err
65is not NULL, it will be used to store error information in case of an
66error.
67.Ss Memory Management
68The memory areas used for the file names and for array of pointers
69being returned are managed by the DWARF(3) library.
70The application should not attempt to directly free these memory areas.
71Portable code should indicate that the memory areas are to be freed
72by using
73.Xr dwarf_dealloc 3 .
74.Sh RETURN VALUES
75Function
76.Fn dwarf_srcfiles
77returns
78.Dv DW_DLV_OK
79when it succeeds.
80In case of an error, it returns
81.Dv DW_DLV_ERROR
82and sets the argument
83.Ar err .
84.Sh ERRORS
85Function
86.Fn dwarf_srcfiles
87can fail with:
88.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
89.It Bq Er DW_DLE_ARGUMENT
90One of the arguments
91.Ar die ,
92.Ar filenames
93or
94.Ar filenamecount
95was NULL.
96.It Bq Er DW_DLE_NO_ENTRY
97The compilation unit referenced by argument
98.Ar die
99does not have associated source file information.
100.It Bq Er DW_DLE_MEMORY
101An out of memory condition was encountered during the execution of
102this function.
103.El
104.Sh SEE ALSO
105.Xr dwarf 3 ,
106.Xr dwarf_dealloc 3 ,
107.Xr dwarf_srclines 3
108