xref: /illumos-gate/usr/src/lib/libdwarf/common/pro_pubnames.c (revision 90f7985f020eb82d06bd0d75396ff794105f7528)
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_error.h"
41 #include "pro_section.h"
42 
43 
44 /*  This function adds another public name to the
45     list of public names for the given Dwarf_P_Debug.
46     It returns 0 on error, and 1 otherwise.  */
47 
48 Dwarf_Unsigned
49 dwarf_add_pubname(Dwarf_P_Debug dbg,
50     Dwarf_P_Die die,
51     char *pubname_name, Dwarf_Error * error)
52 {
53     int res = 0;
54 
55     res =  _dwarf_add_simple_name_entry(dbg, die, pubname_name,
56         dwarf_snk_pubname, error);
57     if (res != DW_DLV_OK) {
58         return 0;
59     }
60     return 1;
61 }
62 
63 int
64 dwarf_add_pubname_a(Dwarf_P_Debug dbg,
65     Dwarf_P_Die die,
66     char *pubname_name, Dwarf_Error * error)
67 {
68     int res = 0;
69 
70     res = _dwarf_add_simple_name_entry(dbg, die,
71         pubname_name,
72         dwarf_snk_pubname, error);
73     return res;
74 }
75 
76 
77 
78 Dwarf_Unsigned
79 dwarf_add_pubtype(Dwarf_P_Debug dbg,
80     Dwarf_P_Die die,
81     char *pubtype_name, Dwarf_Error * error)
82 {
83     int res  = 0;
84 
85     res = _dwarf_add_simple_name_entry(dbg, die, pubtype_name,
86         dwarf_snk_pubtype, error);
87     if (res != DW_DLV_OK) {
88         return 0;
89     }
90     return 1;
91 }
92 int
93 dwarf_add_pubtype_a(Dwarf_P_Debug dbg,
94     Dwarf_P_Die die,
95     char *pubtype_name,
96     Dwarf_Error * error)
97 {
98     int res = 0;
99 
100     res =    _dwarf_add_simple_name_entry(dbg, die, pubtype_name,
101         dwarf_snk_pubtype, error);
102     return res;
103 }
104