xref: /minix3/external/bsd/elftoolchain/dist/libdwarf/dwarf_lineno.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: dwarf_lineno.c,v 1.2 2014/03/09 16:58:04 christos Exp $	*/
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc /*-
4*0a6a1f1dSLionel Sambuc  * Copyright (c) 2009,2011 Kai Wang
5*0a6a1f1dSLionel Sambuc  * All rights reserved.
6*0a6a1f1dSLionel Sambuc  *
7*0a6a1f1dSLionel Sambuc  * Redistribution and use in source and binary forms, with or without
8*0a6a1f1dSLionel Sambuc  * modification, are permitted provided that the following conditions
9*0a6a1f1dSLionel Sambuc  * are met:
10*0a6a1f1dSLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
11*0a6a1f1dSLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
12*0a6a1f1dSLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
13*0a6a1f1dSLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
14*0a6a1f1dSLionel Sambuc  *    documentation and/or other materials provided with the distribution.
15*0a6a1f1dSLionel Sambuc  *
16*0a6a1f1dSLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*0a6a1f1dSLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*0a6a1f1dSLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*0a6a1f1dSLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*0a6a1f1dSLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*0a6a1f1dSLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*0a6a1f1dSLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*0a6a1f1dSLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*0a6a1f1dSLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*0a6a1f1dSLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*0a6a1f1dSLionel Sambuc  * SUCH DAMAGE.
27*0a6a1f1dSLionel Sambuc  */
28*0a6a1f1dSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc #include "_libdwarf.h"
30*0a6a1f1dSLionel Sambuc 
31*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: dwarf_lineno.c,v 1.2 2014/03/09 16:58:04 christos Exp $");
32*0a6a1f1dSLionel Sambuc ELFTC_VCSID("Id: dwarf_lineno.c 2074 2011-10-27 03:34:33Z jkoshy ");
33*0a6a1f1dSLionel Sambuc 
34*0a6a1f1dSLionel Sambuc int
dwarf_srclines(Dwarf_Die die,Dwarf_Line ** linebuf,Dwarf_Signed * linecount,Dwarf_Error * error)35*0a6a1f1dSLionel Sambuc dwarf_srclines(Dwarf_Die die, Dwarf_Line **linebuf, Dwarf_Signed *linecount,
36*0a6a1f1dSLionel Sambuc     Dwarf_Error *error)
37*0a6a1f1dSLionel Sambuc {
38*0a6a1f1dSLionel Sambuc 	Dwarf_LineInfo li;
39*0a6a1f1dSLionel Sambuc 	Dwarf_Debug dbg;
40*0a6a1f1dSLionel Sambuc 	Dwarf_Line ln;
41*0a6a1f1dSLionel Sambuc 	Dwarf_CU cu;
42*0a6a1f1dSLionel Sambuc 	Dwarf_Attribute at;
43*0a6a1f1dSLionel Sambuc 	int i;
44*0a6a1f1dSLionel Sambuc 
45*0a6a1f1dSLionel Sambuc 	dbg = die != NULL ? die->die_dbg : NULL;
46*0a6a1f1dSLionel Sambuc 
47*0a6a1f1dSLionel Sambuc 	if (die == NULL || linebuf == NULL || linecount == NULL) {
48*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
49*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
50*0a6a1f1dSLionel Sambuc 	}
51*0a6a1f1dSLionel Sambuc 
52*0a6a1f1dSLionel Sambuc 	if ((at = _dwarf_attr_find(die, DW_AT_stmt_list)) == NULL) {
53*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
54*0a6a1f1dSLionel Sambuc 		return (DW_DLV_NO_ENTRY);
55*0a6a1f1dSLionel Sambuc 	}
56*0a6a1f1dSLionel Sambuc 
57*0a6a1f1dSLionel Sambuc 	cu = die->die_cu;
58*0a6a1f1dSLionel Sambuc 	if (cu->cu_lineinfo == NULL) {
59*0a6a1f1dSLionel Sambuc 		if (_dwarf_lineno_init(die, at->u[0].u64, error) !=
60*0a6a1f1dSLionel Sambuc 		    DW_DLE_NONE)
61*0a6a1f1dSLionel Sambuc 			return (DW_DLV_ERROR);
62*0a6a1f1dSLionel Sambuc 	}
63*0a6a1f1dSLionel Sambuc 	if (cu->cu_lineinfo == NULL) {
64*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
65*0a6a1f1dSLionel Sambuc 		return (DW_DLV_NO_ENTRY);
66*0a6a1f1dSLionel Sambuc 	}
67*0a6a1f1dSLionel Sambuc 
68*0a6a1f1dSLionel Sambuc 	li = cu->cu_lineinfo;
69*0a6a1f1dSLionel Sambuc 	*linecount = (Dwarf_Signed) li->li_lnlen;
70*0a6a1f1dSLionel Sambuc 
71*0a6a1f1dSLionel Sambuc 	if (*linecount == 0) {
72*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
73*0a6a1f1dSLionel Sambuc 		return (DW_DLV_NO_ENTRY);
74*0a6a1f1dSLionel Sambuc 	}
75*0a6a1f1dSLionel Sambuc 
76*0a6a1f1dSLionel Sambuc 	if (li->li_lnarray != NULL) {
77*0a6a1f1dSLionel Sambuc 		*linebuf = li->li_lnarray;
78*0a6a1f1dSLionel Sambuc 		return (DW_DLV_OK);
79*0a6a1f1dSLionel Sambuc 	}
80*0a6a1f1dSLionel Sambuc 
81*0a6a1f1dSLionel Sambuc 	if ((li->li_lnarray = malloc(*linecount *
82*0a6a1f1dSLionel Sambuc 	    sizeof(struct _Dwarf_Line))) == NULL) {
83*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
84*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
85*0a6a1f1dSLionel Sambuc 	}
86*0a6a1f1dSLionel Sambuc 
87*0a6a1f1dSLionel Sambuc 	for (i = 0, ln = STAILQ_FIRST(&li->li_lnlist);
88*0a6a1f1dSLionel Sambuc 	     i < *linecount && ln != NULL; i++, ln = STAILQ_NEXT(ln, ln_next))
89*0a6a1f1dSLionel Sambuc 		li->li_lnarray[i] = ln;
90*0a6a1f1dSLionel Sambuc 
91*0a6a1f1dSLionel Sambuc 	*linebuf = li->li_lnarray;
92*0a6a1f1dSLionel Sambuc 
93*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
94*0a6a1f1dSLionel Sambuc }
95*0a6a1f1dSLionel Sambuc 
96*0a6a1f1dSLionel Sambuc int
dwarf_srcfiles(Dwarf_Die die,char *** srcfiles,Dwarf_Signed * srccount,Dwarf_Error * error)97*0a6a1f1dSLionel Sambuc dwarf_srcfiles(Dwarf_Die die, char ***srcfiles, Dwarf_Signed *srccount,
98*0a6a1f1dSLionel Sambuc     Dwarf_Error *error)
99*0a6a1f1dSLionel Sambuc {
100*0a6a1f1dSLionel Sambuc 	Dwarf_LineInfo li;
101*0a6a1f1dSLionel Sambuc 	Dwarf_LineFile lf;
102*0a6a1f1dSLionel Sambuc 	Dwarf_Debug dbg;
103*0a6a1f1dSLionel Sambuc 	Dwarf_CU cu;
104*0a6a1f1dSLionel Sambuc 	Dwarf_Attribute at;
105*0a6a1f1dSLionel Sambuc 	int i;
106*0a6a1f1dSLionel Sambuc 
107*0a6a1f1dSLionel Sambuc 	dbg = die != NULL ? die->die_dbg : NULL;
108*0a6a1f1dSLionel Sambuc 
109*0a6a1f1dSLionel Sambuc 	if (die == NULL || srcfiles == NULL || srccount == NULL) {
110*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
111*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
112*0a6a1f1dSLionel Sambuc 	}
113*0a6a1f1dSLionel Sambuc 
114*0a6a1f1dSLionel Sambuc 	if ((at = _dwarf_attr_find(die, DW_AT_stmt_list)) == NULL) {
115*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
116*0a6a1f1dSLionel Sambuc 		return (DW_DLV_NO_ENTRY);
117*0a6a1f1dSLionel Sambuc 	}
118*0a6a1f1dSLionel Sambuc 
119*0a6a1f1dSLionel Sambuc 	cu = die->die_cu;
120*0a6a1f1dSLionel Sambuc 	if (cu->cu_lineinfo == NULL) {
121*0a6a1f1dSLionel Sambuc 		if (_dwarf_lineno_init(die, at->u[0].u64, error) !=
122*0a6a1f1dSLionel Sambuc 		    DW_DLE_NONE)
123*0a6a1f1dSLionel Sambuc 			return (DW_DLV_ERROR);
124*0a6a1f1dSLionel Sambuc 	}
125*0a6a1f1dSLionel Sambuc 	if (cu->cu_lineinfo == NULL) {
126*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
127*0a6a1f1dSLionel Sambuc 		return (DW_DLV_NO_ENTRY);
128*0a6a1f1dSLionel Sambuc 	}
129*0a6a1f1dSLionel Sambuc 
130*0a6a1f1dSLionel Sambuc 	li = cu->cu_lineinfo;
131*0a6a1f1dSLionel Sambuc 	*srccount = (Dwarf_Signed) li->li_lflen;
132*0a6a1f1dSLionel Sambuc 
133*0a6a1f1dSLionel Sambuc 	if (*srccount == 0) {
134*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
135*0a6a1f1dSLionel Sambuc 		return (DW_DLV_NO_ENTRY);
136*0a6a1f1dSLionel Sambuc 	}
137*0a6a1f1dSLionel Sambuc 
138*0a6a1f1dSLionel Sambuc 	if (li->li_lfnarray != NULL) {
139*0a6a1f1dSLionel Sambuc 		*srcfiles = li->li_lfnarray;
140*0a6a1f1dSLionel Sambuc 		return (DW_DLV_OK);
141*0a6a1f1dSLionel Sambuc 	}
142*0a6a1f1dSLionel Sambuc 
143*0a6a1f1dSLionel Sambuc 	if ((li->li_lfnarray = malloc(*srccount * sizeof(char *))) == NULL) {
144*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(dbg, error, DW_DLE_MEMORY);
145*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
146*0a6a1f1dSLionel Sambuc 	}
147*0a6a1f1dSLionel Sambuc 
148*0a6a1f1dSLionel Sambuc 	for (i = 0, lf = STAILQ_FIRST(&li->li_lflist);
149*0a6a1f1dSLionel Sambuc 	     i < *srccount && lf != NULL; i++, lf = STAILQ_NEXT(lf, lf_next)) {
150*0a6a1f1dSLionel Sambuc 		if (lf->lf_fullpath)
151*0a6a1f1dSLionel Sambuc 			li->li_lfnarray[i] = lf->lf_fullpath;
152*0a6a1f1dSLionel Sambuc 		else
153*0a6a1f1dSLionel Sambuc 			li->li_lfnarray[i] = lf->lf_fname;
154*0a6a1f1dSLionel Sambuc 	}
155*0a6a1f1dSLionel Sambuc 
156*0a6a1f1dSLionel Sambuc 	*srcfiles = li->li_lfnarray;
157*0a6a1f1dSLionel Sambuc 
158*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
159*0a6a1f1dSLionel Sambuc }
160*0a6a1f1dSLionel Sambuc 
161*0a6a1f1dSLionel Sambuc int
dwarf_linebeginstatement(Dwarf_Line ln,Dwarf_Bool * ret_bool,Dwarf_Error * error)162*0a6a1f1dSLionel Sambuc dwarf_linebeginstatement(Dwarf_Line ln, Dwarf_Bool *ret_bool,
163*0a6a1f1dSLionel Sambuc     Dwarf_Error *error)
164*0a6a1f1dSLionel Sambuc {
165*0a6a1f1dSLionel Sambuc 
166*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_bool == NULL) {
167*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
168*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
169*0a6a1f1dSLionel Sambuc 	}
170*0a6a1f1dSLionel Sambuc 
171*0a6a1f1dSLionel Sambuc 	*ret_bool = ln->ln_stmt;
172*0a6a1f1dSLionel Sambuc 
173*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
174*0a6a1f1dSLionel Sambuc }
175*0a6a1f1dSLionel Sambuc 
176*0a6a1f1dSLionel Sambuc int
dwarf_lineendsequence(Dwarf_Line ln,Dwarf_Bool * ret_bool,Dwarf_Error * error)177*0a6a1f1dSLionel Sambuc dwarf_lineendsequence(Dwarf_Line ln, Dwarf_Bool *ret_bool, Dwarf_Error *error)
178*0a6a1f1dSLionel Sambuc {
179*0a6a1f1dSLionel Sambuc 
180*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_bool == NULL) {
181*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
182*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
183*0a6a1f1dSLionel Sambuc 	}
184*0a6a1f1dSLionel Sambuc 
185*0a6a1f1dSLionel Sambuc 	*ret_bool = ln->ln_endseq;
186*0a6a1f1dSLionel Sambuc 
187*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
188*0a6a1f1dSLionel Sambuc }
189*0a6a1f1dSLionel Sambuc 
190*0a6a1f1dSLionel Sambuc int
dwarf_lineno(Dwarf_Line ln,Dwarf_Unsigned * ret_lineno,Dwarf_Error * error)191*0a6a1f1dSLionel Sambuc dwarf_lineno(Dwarf_Line ln, Dwarf_Unsigned *ret_lineno, Dwarf_Error *error)
192*0a6a1f1dSLionel Sambuc {
193*0a6a1f1dSLionel Sambuc 
194*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_lineno == NULL) {
195*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
196*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
197*0a6a1f1dSLionel Sambuc 	}
198*0a6a1f1dSLionel Sambuc 
199*0a6a1f1dSLionel Sambuc 	*ret_lineno = ln->ln_lineno;
200*0a6a1f1dSLionel Sambuc 
201*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
202*0a6a1f1dSLionel Sambuc }
203*0a6a1f1dSLionel Sambuc 
204*0a6a1f1dSLionel Sambuc int
dwarf_line_srcfileno(Dwarf_Line ln,Dwarf_Unsigned * ret_fileno,Dwarf_Error * error)205*0a6a1f1dSLionel Sambuc dwarf_line_srcfileno(Dwarf_Line ln, Dwarf_Unsigned *ret_fileno,
206*0a6a1f1dSLionel Sambuc     Dwarf_Error *error)
207*0a6a1f1dSLionel Sambuc {
208*0a6a1f1dSLionel Sambuc 
209*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_fileno == NULL) {
210*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
211*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
212*0a6a1f1dSLionel Sambuc 	}
213*0a6a1f1dSLionel Sambuc 
214*0a6a1f1dSLionel Sambuc 	*ret_fileno = ln->ln_fileno;
215*0a6a1f1dSLionel Sambuc 
216*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
217*0a6a1f1dSLionel Sambuc }
218*0a6a1f1dSLionel Sambuc 
219*0a6a1f1dSLionel Sambuc int
dwarf_lineaddr(Dwarf_Line ln,Dwarf_Addr * ret_lineaddr,Dwarf_Error * error)220*0a6a1f1dSLionel Sambuc dwarf_lineaddr(Dwarf_Line ln, Dwarf_Addr *ret_lineaddr, Dwarf_Error *error)
221*0a6a1f1dSLionel Sambuc {
222*0a6a1f1dSLionel Sambuc 
223*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_lineaddr == NULL) {
224*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
225*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
226*0a6a1f1dSLionel Sambuc 	}
227*0a6a1f1dSLionel Sambuc 
228*0a6a1f1dSLionel Sambuc 	*ret_lineaddr = ln->ln_addr;
229*0a6a1f1dSLionel Sambuc 
230*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
231*0a6a1f1dSLionel Sambuc }
232*0a6a1f1dSLionel Sambuc 
233*0a6a1f1dSLionel Sambuc int
dwarf_lineoff(Dwarf_Line ln,Dwarf_Signed * ret_lineoff,Dwarf_Error * error)234*0a6a1f1dSLionel Sambuc dwarf_lineoff(Dwarf_Line ln, Dwarf_Signed *ret_lineoff, Dwarf_Error *error)
235*0a6a1f1dSLionel Sambuc {
236*0a6a1f1dSLionel Sambuc 
237*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_lineoff == NULL) {
238*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
239*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
240*0a6a1f1dSLionel Sambuc 	}
241*0a6a1f1dSLionel Sambuc 
242*0a6a1f1dSLionel Sambuc 	if (ln->ln_column == 0)
243*0a6a1f1dSLionel Sambuc 		*ret_lineoff = -1;
244*0a6a1f1dSLionel Sambuc 	else
245*0a6a1f1dSLionel Sambuc 		*ret_lineoff = (Dwarf_Signed) ln->ln_column;
246*0a6a1f1dSLionel Sambuc 
247*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
248*0a6a1f1dSLionel Sambuc }
249*0a6a1f1dSLionel Sambuc 
250*0a6a1f1dSLionel Sambuc int
dwarf_linesrc(Dwarf_Line ln,char ** ret_linesrc,Dwarf_Error * error)251*0a6a1f1dSLionel Sambuc dwarf_linesrc(Dwarf_Line ln, char **ret_linesrc, Dwarf_Error *error)
252*0a6a1f1dSLionel Sambuc {
253*0a6a1f1dSLionel Sambuc 	Dwarf_LineInfo li;
254*0a6a1f1dSLionel Sambuc 	Dwarf_LineFile lf;
255*0a6a1f1dSLionel Sambuc 	int i;
256*0a6a1f1dSLionel Sambuc 
257*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_linesrc == NULL) {
258*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
259*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
260*0a6a1f1dSLionel Sambuc 	}
261*0a6a1f1dSLionel Sambuc 
262*0a6a1f1dSLionel Sambuc 	li = ln->ln_li;
263*0a6a1f1dSLionel Sambuc 	assert(li != NULL);
264*0a6a1f1dSLionel Sambuc 
265*0a6a1f1dSLionel Sambuc 	for (i = 1, lf = STAILQ_FIRST(&li->li_lflist);
266*0a6a1f1dSLionel Sambuc 	     (Dwarf_Unsigned) i < ln->ln_fileno && lf != NULL;
267*0a6a1f1dSLionel Sambuc 	     i++, lf = STAILQ_NEXT(lf, lf_next))
268*0a6a1f1dSLionel Sambuc 		;
269*0a6a1f1dSLionel Sambuc 
270*0a6a1f1dSLionel Sambuc 	if (lf == NULL) {
271*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_LINE_FILE_NUM_BAD);
272*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
273*0a6a1f1dSLionel Sambuc 	}
274*0a6a1f1dSLionel Sambuc 
275*0a6a1f1dSLionel Sambuc 	if (lf->lf_fullpath) {
276*0a6a1f1dSLionel Sambuc 		*ret_linesrc = (char *) lf->lf_fullpath;
277*0a6a1f1dSLionel Sambuc 		return (DW_DLV_OK);
278*0a6a1f1dSLionel Sambuc 	}
279*0a6a1f1dSLionel Sambuc 
280*0a6a1f1dSLionel Sambuc 	*ret_linesrc = lf->lf_fname;
281*0a6a1f1dSLionel Sambuc 
282*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
283*0a6a1f1dSLionel Sambuc }
284*0a6a1f1dSLionel Sambuc 
285*0a6a1f1dSLionel Sambuc int
dwarf_lineblock(Dwarf_Line ln,Dwarf_Bool * ret_bool,Dwarf_Error * error)286*0a6a1f1dSLionel Sambuc dwarf_lineblock(Dwarf_Line ln, Dwarf_Bool *ret_bool, Dwarf_Error *error)
287*0a6a1f1dSLionel Sambuc {
288*0a6a1f1dSLionel Sambuc 
289*0a6a1f1dSLionel Sambuc 	if (ln == NULL || ret_bool == NULL) {
290*0a6a1f1dSLionel Sambuc 		DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
291*0a6a1f1dSLionel Sambuc 		return (DW_DLV_ERROR);
292*0a6a1f1dSLionel Sambuc 	}
293*0a6a1f1dSLionel Sambuc 
294*0a6a1f1dSLionel Sambuc 	*ret_bool = ln->ln_bblock;
295*0a6a1f1dSLionel Sambuc 
296*0a6a1f1dSLionel Sambuc 	return (DW_DLV_OK);
297*0a6a1f1dSLionel Sambuc }
298