blob: 6259b9f157a37af3001df6373a856eb3095abbaa [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001/* Get line number of beginning of given function.
2 Copyright (C) 2005 Red Hat, Inc.
3 Written by Ulrich Drepper <drepper@redhat.com>, 2005.
4
5 This program is Open Source software; you can redistribute it and/or
6 modify it under the terms of the Open Software License version 1.0 as
7 published by the Open Source Initiative.
8
9 You should have received a copy of the Open Software License along
10 with this program; if not, you may obtain a copy of the Open Software
11 License version 1.0 from http://www.opensource.org/licenses/osl.php or
12 by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
13 3001 King Ranch Road, Ukiah, CA 95482. */
14
15#ifdef HAVE_CONFIG_H
16# include <config.h>
17#endif
18
19#include <assert.h>
20#include <dwarf.h>
21#include <limits.h>
22#include "libdwP.h"
23
24
25int
26dwarf_func_line (Dwarf_Func *func, int *linep)
27{
28 return __libdw_func_intval (func, linep, DW_AT_decl_line);
29}
30
31
32int internal_function
33__libdw_func_intval (Dwarf_Func *func, int *linep, int attval)
34{
35 Dwarf_Attribute attr_mem;
36 Dwarf_Sword line;
37
38 int res = INTUSE(dwarf_formsdata) (INTUSE(dwarf_attr) (func->die, attval,
39 &attr_mem), &line);
40 if (res == 0)
41 {
42 assert (line >= 0 && line <= INT_MAX);
43 *linep = line;
44 }
45
46 return res;
47}