xref: /illumos-gate/usr/src/lib/libdwarf/common/pro_funcs.c (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
1 /*
2 
3   Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
4   Portions Copyright 2011  David Anderson. All Rights Reserved.
5 
6   This program is free software; you can redistribute it and/or modify it
7   under the terms of version 2.1 of the GNU Lesser General Public License
8   as published by the Free Software Foundation.
9 
10   This program is distributed in the hope that it would be useful, but
11   WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14   Further, this software is distributed without any warranty that it is
15   free of the rightful claim of any third person regarding infringement
16   or the like.  Any license provided herein, whether implied or
17   otherwise, applies only to this software file.  Patent licenses, if
18   any, provided herein do not apply to combinations of this program with
19   other software, or any other product whatsoever.
20 
21   You should have received a copy of the GNU Lesser General Public
22   License along with this program; if not, write the Free Software
23   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
24   USA.
25 
26 */
27 
28 #include "config.h"
29 #include "libdwarfdefs.h"
30 #include <stdio.h>
31 #include <string.h>
32 #ifdef HAVE_ELFACCESS_H
33 #include <elfaccess.h>
34 #endif
35 #include "pro_incl.h"
36 #include <stddef.h>
37 #include "dwarf.h"
38 #include "libdwarf.h"
39 #include "pro_opaque.h"
40 #include "pro_section.h"
41 
42 /*  This function adds another function name to the
43     list of function names for the given Dwarf_P_Debug.
44     It returns 0 on error, and 1 otherwise. */
45 Dwarf_Unsigned
46 dwarf_add_funcname(Dwarf_P_Debug dbg,
47    Dwarf_P_Die die,
48    char *function_name, Dwarf_Error * error)
49 {
50     int res = 0;
51 
52     res = _dwarf_add_simple_name_entry(dbg, die, function_name,
53         dwarf_snk_funcname, error);
54     if (res != DW_DLV_OK) {
55         return 0;
56     }
57     return 1;
58 }
59 int
60 dwarf_add_funcname_a(Dwarf_P_Debug dbg,
61    Dwarf_P_Die die,
62    char *function_name, Dwarf_Error * error)
63 {
64     int res = 0;
65 
66     res = _dwarf_add_simple_name_entry(dbg, die, function_name,
67         dwarf_snk_funcname, error);
68     return res;
69 }
70