3 Copyright (C) 2000,2002,2004,2005 Silicon Graphics, Inc. All Rights Reserved.
4 Portions Copyright (C) 2009-2010 David Anderson. All Rights Reserved.
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.
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.
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.
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,
26 Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
27 Mountain View, CA 94043, or:
31 For further information regarding this notice, see:
33 http://oss.sgi.com/projects/GenInfo/NoticeExplan
40 #include "dwarf_incl.h"
42 #include "dwarf_vars.h"
43 #include "dwarf_global.h"
46 dwarf_get_vars(Dwarf_Debug dbg
,
48 Dwarf_Signed
* ret_var_count
, Dwarf_Error
* error
)
50 int res
= _dwarf_load_section(dbg
, &dbg
->de_debug_varnames
,error
);
51 if (res
!= DW_DLV_OK
) {
55 return _dwarf_internal_get_pubnames_like_data(dbg
,
56 dbg
->de_debug_varnames
.dss_data
,
57 dbg
->de_debug_varnames
.dss_size
,
58 (Dwarf_Global
**) vars
, /* Type punning for sections
59 with identical format. */
64 DW_DLE_DEBUG_VARNAMES_LENGTH_BAD
,
65 DW_DLE_DEBUG_VARNAMES_VERSION_ERROR
);
68 /* Deallocating fully requires deallocating the list
69 and all entries. But some internal data is
70 not exposed, so we need a function with internal knowledge.
74 dwarf_vars_dealloc(Dwarf_Debug dbg
, Dwarf_Var
* dwgl
,
77 _dwarf_internal_globals_dealloc(dbg
, (Dwarf_Global
*) dwgl
,
80 DW_DLA_VAR
, DW_DLA_LIST
);
86 dwarf_varname(Dwarf_Var var_in
, char **ret_varname
, Dwarf_Error
* error
)
88 Dwarf_Global var
= (Dwarf_Global
) var_in
;
91 _dwarf_error(NULL
, error
, DW_DLE_VAR_NULL
);
92 return (DW_DLV_ERROR
);
95 *ret_varname
= (char *) (var
->gl_name
);
101 dwarf_var_die_offset(Dwarf_Var var_in
,
102 Dwarf_Off
* returned_offset
, Dwarf_Error
* error
)
104 Dwarf_Global var
= (Dwarf_Global
) var_in
;
106 return dwarf_global_die_offset(var
, returned_offset
, error
);
112 dwarf_var_cu_offset(Dwarf_Var var_in
,
113 Dwarf_Off
* returned_offset
, Dwarf_Error
* error
)
115 Dwarf_Global var
= (Dwarf_Global
) var_in
;
117 return dwarf_global_cu_offset(var
, returned_offset
, error
);
122 dwarf_var_name_offsets(Dwarf_Var var_in
,
123 char **returned_name
,
124 Dwarf_Off
* die_offset
,
125 Dwarf_Off
* cu_offset
, Dwarf_Error
* error
)
127 Dwarf_Global var
= (Dwarf_Global
) var_in
;
130 dwarf_global_name_offsets(var
,
131 returned_name
, die_offset
, cu_offset
,