|
1 /* |
|
2 |
|
3 Copyright (C) 2000,2002,2004,2005 Silicon Graphics, Inc. All Rights Reserved. |
|
4 |
|
5 This program is free software; you can redistribute it and/or modify it |
|
6 under the terms of version 2.1 of the GNU Lesser General Public License |
|
7 as published by the Free Software Foundation. |
|
8 |
|
9 This program is distributed in the hope that it would be useful, but |
|
10 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
12 |
|
13 Further, this software is distributed without any warranty that it is |
|
14 free of the rightful claim of any third person regarding infringement |
|
15 or the like. Any license provided herein, whether implied or |
|
16 otherwise, applies only to this software file. Patent licenses, if |
|
17 any, provided herein do not apply to combinations of this program with |
|
18 other software, or any other product whatsoever. |
|
19 |
|
20 You should have received a copy of the GNU Lesser General Public |
|
21 License along with this program; if not, write the Free Software |
|
22 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301, |
|
23 USA. |
|
24 |
|
25 Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane, |
|
26 Mountain View, CA 94043, or: |
|
27 |
|
28 http://www.sgi.com |
|
29 |
|
30 For further information regarding this notice, see: |
|
31 |
|
32 http://oss.sgi.com/projects/GenInfo/NoticeExplan |
|
33 |
|
34 */ |
|
35 |
|
36 |
|
37 |
|
38 #include "config.h" |
|
39 #include "dwarf_incl.h" |
|
40 #include <stdio.h> |
|
41 #include "dwarf_funcs.h" |
|
42 #include "dwarf_global.h" |
|
43 |
|
44 int |
|
45 dwarf_get_funcs(Dwarf_Debug dbg, |
|
46 Dwarf_Func ** funcs, |
|
47 Dwarf_Signed * ret_func_count, Dwarf_Error * error) |
|
48 { |
|
49 int res; |
|
50 |
|
51 res = |
|
52 _dwarf_load_section(dbg, |
|
53 dbg->de_debug_funcnames_index, |
|
54 &dbg->de_debug_funcnames, error); |
|
55 if (res != DW_DLV_OK) { |
|
56 return res; |
|
57 } |
|
58 |
|
59 return _dwarf_internal_get_pubnames_like_data(dbg, dbg->de_debug_funcnames, dbg->de_debug_funcnames_size, (Dwarf_Global **) funcs, /* type |
|
60 punning, |
|
61 Dwarf_Type |
|
62 is |
|
63 never |
|
64 a |
|
65 completed |
|
66 type |
|
67 */ |
|
68 ret_func_count, |
|
69 error, |
|
70 DW_DLA_FUNC_CONTEXT, |
|
71 DW_DLA_FUNC, |
|
72 DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD, |
|
73 DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR); |
|
74 |
|
75 } |
|
76 |
|
77 /* Deallocating fully requires deallocating the list |
|
78 and all entries. But some internal data is |
|
79 not exposed, so we need a function with internal knowledge. |
|
80 */ |
|
81 |
|
82 void |
|
83 dwarf_funcs_dealloc(Dwarf_Debug dbg, Dwarf_Func * dwgl, |
|
84 Dwarf_Signed count) |
|
85 { |
|
86 _dwarf_internal_globals_dealloc(dbg, (Dwarf_Global *) dwgl, |
|
87 count, |
|
88 DW_DLA_FUNC_CONTEXT, |
|
89 DW_DLA_FUNC, DW_DLA_LIST); |
|
90 return; |
|
91 } |
|
92 |
|
93 |
|
94 |
|
95 int |
|
96 dwarf_funcname(Dwarf_Func func_in, char **ret_name, Dwarf_Error * error) |
|
97 { |
|
98 Dwarf_Global func = (Dwarf_Global) func_in; |
|
99 |
|
100 if (func == NULL) { |
|
101 _dwarf_error(NULL, error, DW_DLE_FUNC_NULL); |
|
102 return (DW_DLV_ERROR); |
|
103 } |
|
104 |
|
105 *ret_name = (char *) (func->gl_name); |
|
106 return DW_DLV_OK; |
|
107 } |
|
108 |
|
109 int |
|
110 dwarf_func_die_offset(Dwarf_Func func_in, |
|
111 Dwarf_Off * return_offset, Dwarf_Error * error) |
|
112 { |
|
113 Dwarf_Global func = (Dwarf_Global) func_in; |
|
114 |
|
115 return dwarf_global_die_offset(func, return_offset, error); |
|
116 } |
|
117 |
|
118 |
|
119 int |
|
120 dwarf_func_cu_offset(Dwarf_Func func_in, |
|
121 Dwarf_Off * return_offset, Dwarf_Error * error) |
|
122 { |
|
123 Dwarf_Global func = (Dwarf_Global) func_in; |
|
124 |
|
125 return dwarf_global_cu_offset(func, return_offset, error); |
|
126 } |
|
127 |
|
128 |
|
129 int |
|
130 dwarf_func_name_offsets(Dwarf_Func func_in, |
|
131 char **ret_func_name, |
|
132 Dwarf_Off * die_offset, |
|
133 Dwarf_Off * cu_die_offset, Dwarf_Error * error) |
|
134 { |
|
135 Dwarf_Global func = (Dwarf_Global) func_in; |
|
136 |
|
137 return dwarf_global_name_offsets(func, |
|
138 ret_func_name, |
|
139 die_offset, cu_die_offset, error); |
|
140 } |