1 /* 2 3 Copyright (C) 2000, 2002 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., 59 Temple Place - Suite 330, Boston MA 02111-1307, 23 USA. 24 25 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 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_weaks.h" 42 #include "dwarf_global.h" 43 44 int 45 dwarf_get_weaks(Dwarf_Debug dbg, 46 Dwarf_Weak ** weaks, 47 Dwarf_Signed * ret_weak_count, Dwarf_Error * error) 48 { 49 int res; 50 51 res = 52 _dwarf_load_section(dbg, 53 dbg->de_debug_weaknames_index, 54 &dbg->de_debug_weaknames, 55 error); 56 if (res != DW_DLV_OK) { 57 return res; 58 } 59 60 return _dwarf_internal_get_pubnames_like_data(dbg, dbg->de_debug_weaknames, dbg->de_debug_weaknames_size, (Dwarf_Global **) weaks, /* type 61 punning, 62 Dwarf_Type 63 is never 64 a 65 completed 66 type */ 67 ret_weak_count, 68 error, 69 DW_DLA_WEAK_CONTEXT, 70 DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD, 71 DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR); 72 73 } 74 75 76 77 int 78 dwarf_weakname(Dwarf_Weak weak_in, char **ret_name, Dwarf_Error * error) 79 { 80 Dwarf_Global weak = (Dwarf_Global) weak_in; 81 82 if (weak == NULL) { 83 _dwarf_error(NULL, error, DW_DLE_WEAK_NULL); 84 return (DW_DLV_ERROR); 85 } 86 *ret_name = (char *) (weak->gl_name); 87 return DW_DLV_OK; 88 } 89 90 91 int 92 dwarf_weak_die_offset(Dwarf_Weak weak_in, 93 Dwarf_Off * weak_off, Dwarf_Error * error) 94 { 95 Dwarf_Global weak = (Dwarf_Global) weak_in; 96 97 return dwarf_global_die_offset(weak, weak_off, error); 98 } 99 100 101 int 102 dwarf_weak_cu_offset(Dwarf_Weak weak_in, 103 Dwarf_Off * weak_off, Dwarf_Error * error) 104 { 105 Dwarf_Global weak = (Dwarf_Global) weak_in; 106 107 return dwarf_global_cu_offset(weak, weak_off, error); 108 } 109 110 111 int 112 dwarf_weak_name_offsets(Dwarf_Weak weak_in, 113 char **weak_name, 114 Dwarf_Off * die_offset, 115 Dwarf_Off * cu_offset, Dwarf_Error * error) 116 { 117 Dwarf_Global weak = (Dwarf_Global) weak_in; 118 119 return dwarf_global_name_offsets(weak, 120 weak_name, 121 die_offset, cu_offset, error); 122 } 123