|
Packit |
cdaae3 |
/*
|
|
Packit |
cdaae3 |
Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
|
|
Packit |
cdaae3 |
Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
|
|
Packit |
cdaae3 |
Portions Copyright 2009-2011 SN Systems Ltd. All rights reserved.
|
|
Packit |
cdaae3 |
Portions Copyright 2008-2011 David Anderson. All rights reserved.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
This program is free software; you can redistribute it and/or modify it
|
|
Packit |
cdaae3 |
under the terms of version 2 of the GNU General Public License as
|
|
Packit |
cdaae3 |
published by the Free Software Foundation.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
This program is distributed in the hope that it would be useful, but
|
|
Packit |
cdaae3 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
cdaae3 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
Further, this software is distributed without any warranty that it is
|
|
Packit |
cdaae3 |
free of the rightful claim of any third person regarding infringement
|
|
Packit |
cdaae3 |
or the like. Any license provided herein, whether implied or
|
|
Packit |
cdaae3 |
otherwise, applies only to this software file. Patent licenses, if
|
|
Packit |
cdaae3 |
any, provided herein do not apply to combinations of this program with
|
|
Packit |
cdaae3 |
other software, or any other product whatsoever.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
You should have received a copy of the GNU General Public License along
|
|
Packit |
cdaae3 |
with this program; if not, write the Free Software Foundation, Inc., 51
|
|
Packit |
cdaae3 |
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
*/
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
#include "globals.h"
|
|
Packit |
cdaae3 |
#include "naming.h"
|
|
Packit |
cdaae3 |
#include "dwconf.h"
|
|
Packit |
cdaae3 |
#include "esb.h"
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
#include "print_sections.h"
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
/* Get all the data in .debug_weaknames */
|
|
Packit |
cdaae3 |
extern void
|
|
Packit |
cdaae3 |
print_weaknames(Dwarf_Debug dbg)
|
|
Packit |
cdaae3 |
{
|
|
Packit |
cdaae3 |
Dwarf_Weak *weaknamebuf = NULL;
|
|
Packit |
cdaae3 |
Dwarf_Signed count = 0;
|
|
Packit |
cdaae3 |
Dwarf_Signed i = 0;
|
|
Packit |
cdaae3 |
Dwarf_Off die_off = 0;
|
|
Packit |
cdaae3 |
Dwarf_Off cu_off = 0;
|
|
Packit |
cdaae3 |
char *name = NULL;
|
|
Packit |
cdaae3 |
int wkres = 0;
|
|
Packit |
cdaae3 |
Dwarf_Error err = 0;
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
current_section_id = DEBUG_WEAKNAMES;
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
if (!glflags.gf_do_print_dwarf) {
|
|
Packit |
cdaae3 |
return;
|
|
Packit |
cdaae3 |
}
|
|
Packit |
cdaae3 |
/* No need to get the real section name, this
|
|
Packit |
cdaae3 |
section not used in modern compilers. */
|
|
Packit |
cdaae3 |
printf("\n.debug_weaknames\n");
|
|
Packit |
cdaae3 |
wkres = dwarf_get_weaks(dbg, &weaknamebuf, &count, &err;;
|
|
Packit |
cdaae3 |
if (wkres == DW_DLV_ERROR) {
|
|
Packit |
cdaae3 |
print_error(dbg, "dwarf_get_weaks", wkres, err);
|
|
Packit |
cdaae3 |
} else if (wkres == DW_DLV_NO_ENTRY) {
|
|
Packit |
cdaae3 |
/* no weaknames */
|
|
Packit |
cdaae3 |
} else {
|
|
Packit |
cdaae3 |
Dwarf_Unsigned maxoff = get_info_max_offset(dbg);
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
for (i = 0; i < count; i++) {
|
|
Packit |
cdaae3 |
int tnres = 0;
|
|
Packit |
cdaae3 |
int cures3 = 0;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned global_cu_off = 0;
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
tnres = dwarf_weak_name_offsets(weaknamebuf[i],
|
|
Packit |
cdaae3 |
&name, &die_off, &cu_off,
|
|
Packit |
cdaae3 |
&err;;
|
|
Packit |
cdaae3 |
deal_with_name_offset_err(dbg,
|
|
Packit |
cdaae3 |
"dwarf_weak_name_offsets",
|
|
Packit |
cdaae3 |
name, die_off, tnres, err);
|
|
Packit |
cdaae3 |
cures3 = dwarf_weak_cu_offset(weaknamebuf[i],
|
|
Packit |
cdaae3 |
&global_cu_off, &err;;
|
|
Packit |
cdaae3 |
if (cures3 != DW_DLV_OK) {
|
|
Packit |
cdaae3 |
print_error(dbg, "dwarf_weakname_cu_offset",
|
|
Packit |
cdaae3 |
cures3, err);
|
|
Packit |
cdaae3 |
}
|
|
Packit |
cdaae3 |
print_pubname_style_entry(dbg,
|
|
Packit |
cdaae3 |
"weakname",
|
|
Packit |
cdaae3 |
name, die_off, cu_off,
|
|
Packit |
cdaae3 |
global_cu_off, maxoff);
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
/* print associated die too? */
|
|
Packit |
cdaae3 |
}
|
|
Packit |
cdaae3 |
dwarf_weaks_dealloc(dbg, weaknamebuf, count);
|
|
Packit |
cdaae3 |
}
|
|
Packit |
cdaae3 |
} /* print_weaknames() */
|