xref: /minix3/external/bsd/elftoolchain/dist/libdwarf/dwarf_lineno.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: dwarf_lineno.3,v 1.2 2014/03/09 16:58:04 christos Exp $
2*0a6a1f1dSLionel Sambuc.\"
3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2011 Kai Wang
4*0a6a1f1dSLionel Sambuc.\" All rights reserved.
5*0a6a1f1dSLionel Sambuc.\"
6*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
7*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions
8*0a6a1f1dSLionel Sambuc.\" are met:
9*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
10*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
11*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
12*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
13*0a6a1f1dSLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
14*0a6a1f1dSLionel Sambuc.\"
15*0a6a1f1dSLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*0a6a1f1dSLionel Sambuc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*0a6a1f1dSLionel Sambuc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*0a6a1f1dSLionel Sambuc.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*0a6a1f1dSLionel Sambuc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*0a6a1f1dSLionel Sambuc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*0a6a1f1dSLionel Sambuc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*0a6a1f1dSLionel Sambuc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*0a6a1f1dSLionel Sambuc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*0a6a1f1dSLionel Sambuc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*0a6a1f1dSLionel Sambuc.\" SUCH DAMAGE.
26*0a6a1f1dSLionel Sambuc.\"
27*0a6a1f1dSLionel Sambuc.\" Id: dwarf_lineno.3 2074 2011-10-27 03:34:33Z jkoshy
28*0a6a1f1dSLionel Sambuc.\"
29*0a6a1f1dSLionel Sambuc.Dd February 5, 2011
30*0a6a1f1dSLionel Sambuc.Os
31*0a6a1f1dSLionel Sambuc.Dt DWARF_LINENO 3
32*0a6a1f1dSLionel Sambuc.Sh NAME
33*0a6a1f1dSLionel Sambuc.Nm dwarf_lineaddr ,
34*0a6a1f1dSLionel Sambuc.Nm dwarf_linebeginstatement ,
35*0a6a1f1dSLionel Sambuc.Nm dwarf_lineblock ,
36*0a6a1f1dSLionel Sambuc.Nm dwarf_lineendsequence ,
37*0a6a1f1dSLionel Sambuc.Nm dwarf_lineno ,
38*0a6a1f1dSLionel Sambuc.Nm dwarf_lineoff ,
39*0a6a1f1dSLionel Sambuc.Nm dwarf_linesrc ,
40*0a6a1f1dSLionel Sambuc.Nm dwarf_line_srcfileno
41*0a6a1f1dSLionel Sambuc.Nd retrieve information associated with a DWARF line descriptor
42*0a6a1f1dSLionel Sambuc.Sh LIBRARY
43*0a6a1f1dSLionel Sambuc.Lb libdwarf
44*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS
45*0a6a1f1dSLionel Sambuc.In libdwarf.h
46*0a6a1f1dSLionel Sambuc.Ft int
47*0a6a1f1dSLionel Sambuc.Fo dwarf_lineaddr
48*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
49*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Addr *ret"
50*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
51*0a6a1f1dSLionel Sambuc.Fc
52*0a6a1f1dSLionel Sambuc.Ft int
53*0a6a1f1dSLionel Sambuc.Fo dwarf_linebeginstatement
54*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
55*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Bool *ret"
56*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
57*0a6a1f1dSLionel Sambuc.Fc
58*0a6a1f1dSLionel Sambuc.Ft int
59*0a6a1f1dSLionel Sambuc.Fo dwarf_lineblock
60*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
61*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Bool *ret"
62*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
63*0a6a1f1dSLionel Sambuc.Fc
64*0a6a1f1dSLionel Sambuc.Ft int
65*0a6a1f1dSLionel Sambuc.Fo dwarf_lineendsequence
66*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
67*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Bool *ret"
68*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
69*0a6a1f1dSLionel Sambuc.Fc
70*0a6a1f1dSLionel Sambuc.Ft int
71*0a6a1f1dSLionel Sambuc.Fo dwarf_lineno
72*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
73*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Unsigned *ret"
74*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
75*0a6a1f1dSLionel Sambuc.Fc
76*0a6a1f1dSLionel Sambuc.Ft int
77*0a6a1f1dSLionel Sambuc.Fo dwarf_lineoff
78*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
79*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Signed *ret"
80*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
81*0a6a1f1dSLionel Sambuc.Fc
82*0a6a1f1dSLionel Sambuc.Ft int
83*0a6a1f1dSLionel Sambuc.Fo dwarf_linesrc
84*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
85*0a6a1f1dSLionel Sambuc.Fa "char **ret"
86*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
87*0a6a1f1dSLionel Sambuc.Fc
88*0a6a1f1dSLionel Sambuc.Ft int
89*0a6a1f1dSLionel Sambuc.Fo dwarf_line_srcfileno
90*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Line ln"
91*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Unsigned *ret"
92*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
93*0a6a1f1dSLionel Sambuc.Fc
94*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION
95*0a6a1f1dSLionel SambucThese functions retrieve specific line information associated with
96*0a6a1f1dSLionel Sambucthe line descriptor specified by argument
97*0a6a1f1dSLionel Sambuc.Ar ln ,
98*0a6a1f1dSLionel Sambucand stores it in the location pointed to by argument
99*0a6a1f1dSLionel Sambuc.Ar ret .
100*0a6a1f1dSLionel SambucIf argument
101*0a6a1f1dSLionel Sambuc.Ar err
102*0a6a1f1dSLionel Sambucis not NULL, it will be used to store error information in case of an
103*0a6a1f1dSLionel Sambucerror.
104*0a6a1f1dSLionel Sambuc.Pp
105*0a6a1f1dSLionel SambucFunction
106*0a6a1f1dSLionel Sambuc.Fn dwarf_lineaddr
107*0a6a1f1dSLionel Sambucstores the program address corresponding to the source line specified
108*0a6a1f1dSLionel Sambucin argument
109*0a6a1f1dSLionel Sambuc.Ar ln
110*0a6a1f1dSLionel Sambucinto the location pointed to by argument
111*0a6a1f1dSLionel Sambuc.Ar ret .
112*0a6a1f1dSLionel Sambuc.Pp
113*0a6a1f1dSLionel SambucFunction
114*0a6a1f1dSLionel Sambuc.Fn dwarf_linebeginstatement
115*0a6a1f1dSLionel Sambucsets the location pointed to by argument
116*0a6a1f1dSLionel Sambuc.Ar ret
117*0a6a1f1dSLionel Sambucto 1 if the source line specified by the line descriptor
118*0a6a1f1dSLionel Sambuc.Ar ln
119*0a6a1f1dSLionel Sambucis the beginning of a statement, or to 0 otherwise.
120*0a6a1f1dSLionel Sambuc.Pp
121*0a6a1f1dSLionel SambucFunction
122*0a6a1f1dSLionel Sambuc.Fn dwarf_lineblock
123*0a6a1f1dSLionel Sambucsets the location pointed to by argument
124*0a6a1f1dSLionel Sambuc.Ar ret
125*0a6a1f1dSLionel Sambucto 1 if the source line specified by the line descriptor
126*0a6a1f1dSLionel Sambuc.Ar ln
127*0a6a1f1dSLionel Sambucis the beginning of a basic block, or to 0 otherwise.
128*0a6a1f1dSLionel Sambuc.Pp
129*0a6a1f1dSLionel SambucFunction
130*0a6a1f1dSLionel Sambuc.Fn dwarf_lineendsequence
131*0a6a1f1dSLionel Sambucsets the location pointed to by argument
132*0a6a1f1dSLionel Sambuc.Ar ret
133*0a6a1f1dSLionel Sambucto 1 if the program address associated with the line descriptor
134*0a6a1f1dSLionel Sambuc.Ar ln
135*0a6a1f1dSLionel Sambucis the address immediately following the end of a sequence of target
136*0a6a1f1dSLionel Sambucmachine instructions, or to 0 otherwise.
137*0a6a1f1dSLionel Sambuc.Pp
138*0a6a1f1dSLionel SambucFunction
139*0a6a1f1dSLionel Sambuc.Fn dwarf_lineno
140*0a6a1f1dSLionel Sambucstores the line number of the source line associated with the line
141*0a6a1f1dSLionel Sambucdescriptor
142*0a6a1f1dSLionel Sambuc.Ar ln
143*0a6a1f1dSLionel Sambucinto the location pointed to by argument
144*0a6a1f1dSLionel Sambuc.Ar ret .
145*0a6a1f1dSLionel Sambuc.Pp
146*0a6a1f1dSLionel SambucFunction
147*0a6a1f1dSLionel Sambuc.Fn dwarf_lineoff
148*0a6a1f1dSLionel Sambucstores the column number within a line associated with descriptor
149*0a6a1f1dSLionel Sambuc.Ar ln
150*0a6a1f1dSLionel Sambucinto the location pointed to by argument
151*0a6a1f1dSLionel Sambuc.Ar ret .
152*0a6a1f1dSLionel SambucThe retrieved column numbers are 1-based, with the value -1 indicating
153*0a6a1f1dSLionel Sambucthat column number information was not available.
154*0a6a1f1dSLionel Sambuc.Pp
155*0a6a1f1dSLionel SambucFunction
156*0a6a1f1dSLionel Sambuc.Fn dwarf_linesrc
157*0a6a1f1dSLionel Sambucstores a pointer to a NUL-terminated string containing the source file
158*0a6a1f1dSLionel Sambucname associated with line descriptor
159*0a6a1f1dSLionel Sambuc.Ar ln
160*0a6a1f1dSLionel Sambucinto the location pointed to by argument
161*0a6a1f1dSLionel Sambuc.Ar ret .
162*0a6a1f1dSLionel SambucThe full path of the source file is returned if possible.
163*0a6a1f1dSLionel SambucThe memory used for the source file name string is managed by the DWARF(3)
164*0a6a1f1dSLionel Sambuclibrary and should not be directly freed by application code.
165*0a6a1f1dSLionel SambucInstead, portable code should use
166*0a6a1f1dSLionel Sambuc.Xr dwarf_dealloc 3
167*0a6a1f1dSLionel Sambucto indicate that the string should be freed.
168*0a6a1f1dSLionel Sambuc.Pp
169*0a6a1f1dSLionel SambucFunction
170*0a6a1f1dSLionel Sambuc.Fn dwarf_line_srcfileno
171*0a6a1f1dSLionel Sambucstores the index of the source file associated with the line descriptor
172*0a6a1f1dSLionel Sambuc.Ar ln
173*0a6a1f1dSLionel Sambucin the location pointed to by argument
174*0a6a1f1dSLionel Sambuc.Ar ret .
175*0a6a1f1dSLionel SambucThe returned value is 1-based index into the array of source file
176*0a6a1f1dSLionel Sambucnames returned by
177*0a6a1f1dSLionel Sambuc.Xr dwarf_srcfiles 3 .
178*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES
179*0a6a1f1dSLionel SambucOn success, these functions returns
180*0a6a1f1dSLionel Sambuc.Dv DW_DLV_OK .
181*0a6a1f1dSLionel SambucIn case of an error, they return
182*0a6a1f1dSLionel Sambuc.Dv DW_DLV_ERROR
183*0a6a1f1dSLionel Sambucand set the argument
184*0a6a1f1dSLionel Sambuc.Ar err .
185*0a6a1f1dSLionel Sambuc.Sh ERRORS
186*0a6a1f1dSLionel SambucThese functions may fail with the following errors:
187*0a6a1f1dSLionel Sambuc.Bl -tag -width ".Bq Er DW_DLE_LINE_FILE_NUM_BAD"
188*0a6a1f1dSLionel Sambuc.It Bq Er DW_DLE_ARGUMENT
189*0a6a1f1dSLionel SambucEither of the arguments
190*0a6a1f1dSLionel Sambuc.Va ln
191*0a6a1f1dSLionel Sambucor
192*0a6a1f1dSLionel Sambuc.Va ret
193*0a6a1f1dSLionel Sambucwas NULL.
194*0a6a1f1dSLionel Sambuc.It Bq Er DW_DLE_LINE_FILE_NUM_BAD
195*0a6a1f1dSLionel SambucThe source file name associated with the line descriptor
196*0a6a1f1dSLionel Sambuc.Ar ln
197*0a6a1f1dSLionel Sambuccould not be retrieved by function
198*0a6a1f1dSLionel Sambuc.Fn dwarf_linesrc .
199*0a6a1f1dSLionel Sambuc.El
200*0a6a1f1dSLionel Sambuc.Sh SEE ALSO
201*0a6a1f1dSLionel Sambuc.Xr dwarf 3 ,
202*0a6a1f1dSLionel Sambuc.Xr dwarf_dealloc 3 ,
203*0a6a1f1dSLionel Sambuc.Xr dwarf_srcfiles 3 ,
204*0a6a1f1dSLionel Sambuc.Xr dwarf_srclines 3
205