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