/*
Copyright (C) 2000-2004 Silicon Graphics, Inc. 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:
*/
/* This code used by SGI-IRIX rqs processing, not needed by
any other system or application.
*/
#include "config.h"
#include "libdwarfdefs.h"
#ifdef HAVE_ELF_H
#include <elf.h>
#endif
#include <dwarf.h>
#include <libdwarf.h>
#include "dwarf_base_types.h"
#include "dwarf_alloc.h"
#include "dwarf_opaque.h"
#include "dwarf_arange.h"
#include "dwarf_line.h"
#include "dwarf_frame.h"
#include <cmplrs/dwarf_addr_finder.h>
#include "dwarf_error.h"
typedef unsigned long long ull;
int *errval);
static int
static int
static int
static int
handle_debug_line(Dwarf_Debug dbg, Dwarf_Die cu_die, Dwarf_addr_callback_func cb_func, int *errval);
static int
handle_debug_loc(void);
int
{
int res = 0;
int errval = 0;
int sections_found = 0;
if (res == DW_DLV_ERROR) {
return errv;
}
if (res == DW_DLV_NO_ENTRY) {
return res;
}
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
return res;
}
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
return res;
}
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
return res;
}
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
/* IMPOSSIBLE : handle_debug_loc cannot return this */
return res;
}
*dwerr = 0;
if (res == DW_DLV_ERROR) {
return DW_DLV_ERROR;
}
if (sections_found == 0) {
return DW_DLV_NO_ENTRY;
}
return DW_DLV_OK;
}
/*
Return DW_DLV_OK, ERROR, or NO_ENTRY.
*/
static int
{
int terminate_now = 0;
int res = 0;
int sibres;
) {
/* try to get the compilation unit die */
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
return DW_DLV_ERROR;
}
} else if (sibres == DW_DLV_ERROR) {
return DW_DLV_ERROR;
} else {
/* NO ENTRY! */
/* impossible? */
}
}
if (nres == DW_DLV_ERROR) {
return DW_DLV_ERROR;
}
return DW_DLV_OK;
}
static int
might_have_addr[] = {
};
static int
might_have_locdesc[] = {
};
/*
Return DW_DLV_OK if handling this went ok.
*/
static int
Dwarf_Error * perr)
{
int ares;
switch (formres) {
case DW_DLV_OK:
break;
case DW_DLV_ERROR:
case DW_DLV_NO_ENTRY: /* impossible. */
return formres;
}
switch (form) {
case DW_FORM_ref_addr:
case DW_FORM_addr:
} else if (ares == DW_DLV_ERROR) {
return ares;
} /* no entry: ok. */
} else {
}
break;
default:
/* surprising! An error? */
; /* do nothing */
}
} else {
}
return res;
}
/*
Return DW_DLV_OK if handling this went ok.
*/
static int
Dwarf_Error * perr)
{
Dwarf_Signed i;
unsigned int entindx;
int res;
int ares;
switch (form) {
case DW_FORM_block1:
case DW_FORM_block2:
case DW_FORM_block4:
/* must be location description */
llbuf = 0;
return lres;
}
if (count != 1) {
/* this cannot happen! */
/* perr? */
return retval;
}
for (i = 0; i < count; ++i) {
/* The offset is the
offset of the atom,
** and we know the
addr is 1 past it. */
}
}
}
if (count > 0) {
for (i = 0; i < count; ++i) {
}
}
} else {
}
break;
default:
/* must be a const offset in debug_loc */
; /* do nothing */
}
} /* else error or no entry */
} else {
}
return retval;
}
/*
Return DW_DLV_OK, or DW_DLV_ERROR
Handle the addrs in a single die.
*/
static int
{
Dwarf_Half i;
int res;
int tres;
if (doffres == DW_DLV_ERROR) {
}
return doffres;
}
return tres;
}
if (DW_TAG_compile_unit == ltag) {
/* because of the way the dwarf_line code works, we do lines
only per compile unit. This may turn out to be wrong if
we have lines left unconnected to a CU. of course such
lines will not, at present, be used by gnome. This is
not ideal as coded due to the dwarf_line.c issue. */
if (lres == DW_DLV_ERROR) {
return lres;
}
}
for (i = 0; i < sizeof(might_have_addr) / sizeof(int); i++) {
int resattr;
newattrnum = might_have_addr[i];
err = 0;
if (hasattr) {
return DW_DLV_ERROR;
}
}
} else {
if (resattr == DW_DLV_ERROR) {
return resattr;
}
}
}
for (i = 0; i < sizeof(might_have_locdesc) / sizeof(int); i++) {
int resattr;
newattrnum = might_have_locdesc[i];
err = 0;
if (hasattr) {
res =
return DW_DLV_ERROR;
}
}
} else {
if (resattr == DW_DLV_ERROR) {
return resattr;
}
}
}
return DW_DLV_OK;
}
/*
Handle siblings as a list,
Do children by recursing.
Effectively this is walking the tree preorder.
This dealloc's any die passed to it, so the
caller should not do that dealloc.
It seems more logical to have the one causing
the alloc to do the dealloc, but that way this
routine became a mess.
*/
static int
{
int res = 0;
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
if (prevdie) {
prevdie = 0;
}
return DW_DLV_ERROR;
}
switch (res) {
case DW_DLV_OK:
break;
case DW_DLV_NO_ENTRY:
break;
default:
case DW_DLV_ERROR:
if (prevdie) {
prevdie = 0;
}
return DW_DLV_ERROR;
}
} else if (tres == DW_DLV_ERROR) {
/* An error! */
if (prevdie) {
prevdie = 0;
}
return DW_DLV_ERROR;
} /* else was NO ENTRY */
sibdie = 0;
if (prevdie) {
prevdie = 0;
}
}
if (sibres == DW_DLV_NO_ENTRY) {
return DW_DLV_OK;
}
/* error. */
if (prevdie) {
prevdie = 0;
}
return DW_DLV_ERROR;
}
static int
int *errval)
{
int res;
int i;
res =
for (i = 0; i < count; i++) {
}
} else if (res == DW_DLV_NO_ENTRY) {
} else {
}
return retval;
}
static int
int *errval)
{
int indx;
retval =
&err);
if (count == 0) {
} else {
}
}
} else if (retval == DW_DLV_NO_ENTRY) {
; /* do nothing */
} else {
}
return retval;
}
static int
{
int res;
res =
for (i = 0; i < count; i++) {
}
} else if (res == DW_DLV_NO_ENTRY) {
} else {
}
return retval;
}
/*
We need to add support for this. Currently we do not
generate this section.
FIX!
*/
static int
handle_debug_loc(void)
{
return retval;
}