/*
Copyright (C) 2000,2002,2003,2004,2005 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright (C) 2008-2010 Arxan Technologies, Inc. All Rights Reserved.
Portions Copyright (C) 2009-2010 David Anderson. All Rights Reserved.
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
USA.
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
Mountain View, CA 94043, or:
For further information regarding this notice, see:
*/
#include "config.h"
#include "dwarf_incl.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "dwarf_incl.h"
#include "malloc_check.h"
#define FALSE 0
/* This static is copied to the dbg on dbg init
so that the static need not be referenced at
run time, preserving better locality of
reference.
Value is 0 means do the string check.
Value non-zero means do not do the check.
*/
/* Call this after calling dwarf_init but before doing anything else.
* It applies to all objects, not just the current object.
*/
int
{
return oldval;
}
int
{
return oldval;
}
* data setting to one place. */
static int
struct Dwarf_Section_s *secdata,
struct Dwarf_Obj_Access_Section_s *doas,
{
}
if (emptyerr == 0 ) {
/* Allow empty section. */
return DW_DLV_OK;
}
/* Know no reason to allow section */
}
return DW_DLV_OK;
}
static void
struct Dwarf_Obj_Access_Section_s *doas,
{
}
/*
Given an Elf ptr, set up dbg with pointers
to all the Dwarf data sections.
Return NULL on error.
This function is also responsible for determining
whether the given object contains Dwarf information
or not. The test currently used is that it contains
either a .debug_info or a .debug_frame section. If
not, it returns DW_DLV_NO_ENTRY causing dwarf_init() also to
return DW_DLV_NO_ENTRY. Earlier, we had thought of using only
added .debug_frame since there could be stripped objects
that have only a .debug_frame section for exception
processing.
DW_DLV_NO_ENTRY or DW_DLV_OK or DW_DLV_ERROR
*/
static int
{
const char *scn_name = 0;
int foundDwarf = 0;
foundDwarf = FALSE;
#ifdef WORDS_BIGENDIAN
if (endianness == DW_OBJECT_LSB ) {
dbg->de_same_endian = 0;
dbg->de_big_endian_object = 0;
}
#else /* little endian */
dbg->de_big_endian_object = 0;
if (endianness == DW_OBJECT_MSB ) {
dbg->de_same_endian = 0;
}
#endif /* !WORDS_BIGENDIAN */
/* The following de_length_size is Not Too Significant. Only used
one calculation, and an approximate one at that. */
/* We can skip index 0 when considering ELF files, but not other
object types. */
++section_index) {
int err;
if(res == DW_DLV_ERROR){
}
continue;
}
return res;
}
foundDwarf = TRUE;
}
return res;
}
}
return res;
}
}
return res;
}
}
return res;
}
foundDwarf = TRUE;
/* gnu egcs-1.1.2 data */
return res;
}
foundDwarf = TRUE;
}
return res;
}
}
return res;
}
}
return res;
}
}
/* SGI IRIX-only. */
return res;
}
}
/* SGI IRIX-only, created years before DWARF3. Content
essentially identical to .debug_pubtypes. */
return res;
}
/* Section new in DWARF3. */
return res;
}
}
/* SGI IRIX-only. */
return res;
}
}
/* SGI IRIX-only. */
return res;
}
return res;
}
}
return res;
}
foundDwarf = TRUE;
}
return res;
}
}
return res;
}
}
}
}
}
if (foundDwarf) {
return DW_DLV_OK;
}
return DW_DLV_NO_ENTRY;
}
/*
Use a Dwarf_Obj_Access_Interface to kick things off. All other
init routines eventually use this one.
The returned Dwarf_Debug contains a copy of *obj
the callers copy of *obj may be freed whenever the caller
wishes.
*/
int
{
dbg = _dwarf_get_debug();
}
#ifdef HAVE_OLD_FRAME_CFA_COL
/* DW_FRAME_CFA_COL is really only suitable for old libdwarf frame
interfaces and its value of 0 there is only usable where
(as in MIPS) register 0 has no value other than 0 so
we can use the frame table column 0 for the CFA value
(and rely on client software to know when 'register 0'
is the cfa and when to just use a value 0 for register 0).
*/
#else
#endif
if (setup_result != DW_DLV_OK) {
/* The status we want to return here is of _dwarf_setup,
not of the _dwarf_free_all_of_one_debug(dbg) call.
So use a local status variable for the free. */
if (freeresult == DW_DLV_ERROR) {
}
dwarf_malloc_check_complete("After Final free");
return setup_result;
}
/* This call cannot fail: allocates nothing, releases nothing */
return DW_DLV_OK;
}
/*
A finish routine that is completely unaware of ELF.
Frees all memory that was not previously freed by
dwarf_dealloc.
Aside frmo certain categories.
*/
int
{
if (res == DW_DLV_ERROR) {
}
dwarf_malloc_check_complete("After Final free");
return res;
}
/*
Load the ELF section with the specified index and set the
pointer pointed to by section_data to the memory where it
was loaded.
*/
int
struct Dwarf_Section_s *section,
Dwarf_Error * error)
{
int err = 0;
struct Dwarf_Obj_Access_Interface_s *o = 0;
/* check to see if the section is already loaded */
return DW_DLV_OK;
}
o = dbg->de_obj_file;
if(res == DW_DLV_ERROR){
}
if(_dwarf_apply_relocs == 0) {
return res;
}
if(section->dss_reloc_size == 0) {
return res;
}
if(!o->methods->relocate_a_section) {
return res;
}
/*apply relocations */
if(res == DW_DLV_ERROR) {
}
return res;
}
/* This is a hack so clients can verify offsets.
Added April 2005 so that debugger can detect broken offsets
(which happened in an IRIX -64 executable larger than 2GB
using MIPSpro 7.3.1.3 compilers. A couple .debug_pubnames
offsets were wrong.).
*/
int
{
return DW_DLV_OK;
}