dwarf_arange.c revision 49d3bc91e27cd871b950d56c01398fa2f2e12ab4
/*
Copyright (C) 2000, 2002 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., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
For further information regarding this notice, see:
*/
#include "config.h"
#include "dwarf_incl.h"
#include <stdio.h>
#include "dwarf_arange.h"
/*
This function returns the count of the number of
aranges in the .debug_aranges section. It sets
aranges to point to a block of Dwarf_Arange's
describing the arange's. It returns DW_DLV_ERROR
on error.
Must be identical in most aspects to
dwarf_get_aranges_addr_offsets!
*/
int
Dwarf_Arange ** aranges,
{
/* Sweeps the .debug_aranges section. */
/*
Start of arange header. Used for rounding offset of arange_ptr
to twice the tuple size. Libdwarf requirement. */
/* Version of .debug_aranges header. */
/* Offset of current set of aranges into .debug_info. */
/* Size in bytes of addresses in target. */
/* Size in bytes of segment offsets in target. */
/* Count of total number of aranges. */
/* Start address of arange. */
/* Length of arange. */
/* Used to chain Dwarf_Aranges structs. */
int res;
/* ***** BEGIN CODE ***** */
return (DW_DLV_ERROR);
}
res =
error);
return res;
}
do {
/* Length of current set of aranges. */
int local_length_size;
/*REFERENCED*/ /* Not used in this instance of the macro */
int local_extension_size;
/* READ_AREA_LENGTH updates arange_ptr for consumed bytes */
arange_ptr, sizeof(Dwarf_Half));
arange_ptr += sizeof(Dwarf_Half);
if (version != CURRENT_VERSION_STAMP) {
return (DW_DLV_ERROR);
}
return (DW_DLV_ERROR);
}
/* Internal error of some kind */
return (DW_DLV_ERROR);
}
if (segment_size != 0) {
return (DW_DLV_ERROR);
}
/* Round arange_ptr offset to next multiple of address_size. */
(2 * address_size);
if (remainder != 0) {
}
do {
if (range_address != 0 || range_length != 0) {
arange = (Dwarf_Arange)
return (DW_DLV_ERROR);
}
arange_count++;
if (curr_chain == NULL) {
return (DW_DLV_ERROR);
}
if (head_chain == NULL)
else {
}
}
} while (range_address != 0 || range_length != 0);
/* A compiler could emit some padding bytes here.
dwarf2/3 (dwarf3 draft8 sec 7.20) does not clearly make
extra padding bytes illegal. */
if(arange_ptr_past_end < arange_ptr) {
return (DW_DLV_ERROR);
}
/* For most compilers, arange_ptr == arange_ptr_past_end
at this point. But not if there were padding bytes */
} while (arange_ptr <
if (arange_ptr !=
return (DW_DLV_ERROR);
}
arange_block = (Dwarf_Arange *)
if (arange_block == NULL) {
return (DW_DLV_ERROR);
}
for (i = 0; i < arange_count; i++) {
}
*aranges = arange_block;
*returned_count = (arange_count);
return DW_DLV_OK;
}
/*
This function returns DW_DLV_OK if it succeeds
and DW_DLV_ERR or DW_DLV_OK otherwise.
count is set to the number of addresses in the
.debug_aranges section.
For each address, the corresponding element in
an array is set to the address itself(aranges) and
the section offset (offsets).
Must be identical in most aspects to
dwarf_get_aranges!
*/
int
Dwarf_Addr ** addrs,
Dwarf_Error * error)
{
/* Sweeps the .debug_aranges section. */
/*
Start of arange header. Used for rounding offset of arange_ptr
to twice the tuple size. Libdwarf requirement. */
/* Length of current set of aranges. */
/* Version of .debug_aranges header. */
/* Offset of current set of aranges into .debug_info. */
/* Size in bytes of addresses in target. */
/* Size in bytes of segment offsets in target. */
/* Count of total number of aranges. */
/* Start address of arange. */
/* Length of arange. */
/* Used to chain Dwarf_Aranges structs. */
int res;
/* ***** BEGIN CODE ***** */
return (DW_DLV_ERROR);
}
res =
error);
return res;
}
do {
int local_length_size;
/*REFERENCED*/ /* not used in this instance of the macro */
int local_extension_size;
/* READ_AREA_LENGTH updates arange_ptr for consumed bytes */
arange_ptr, sizeof(Dwarf_Half));
arange_ptr += sizeof(Dwarf_Half);
if (version != CURRENT_VERSION_STAMP) {
return (DW_DLV_ERROR);
}
return (DW_DLV_ERROR);
}
if (segment_size != 0) {
return (DW_DLV_ERROR);
}
/* Round arange_ptr offset to next multiple of address_size. */
(2 * address_size);
if (remainder != 0) {
}
do {
if (range_address != 0 || range_length != 0) {
arange = (Dwarf_Arange)
return (DW_DLV_ERROR);
}
arange_count++;
if (curr_chain == NULL) {
return (DW_DLV_ERROR);
}
if (head_chain == NULL)
else {
}
}
} while (range_address != 0 || range_length != 0);
if (length != 0) {
return (DW_DLV_ERROR);
}
} while (arange_ptr <
if (arange_ptr !=
return (DW_DLV_ERROR);
}
arange_addrs = (Dwarf_Addr *)
if (arange_addrs == NULL) {
return (DW_DLV_ERROR);
}
arange_offsets = (Dwarf_Off *)
if (arange_offsets == NULL) {
return (DW_DLV_ERROR);
}
for (i = 0; i < arange_count; i++) {
}
*count = arange_count;
*addrs = arange_addrs;
return (DW_DLV_OK);
}
/*
This function takes a pointer to a block
of Dwarf_Arange's, and a count of the
length of the block. It checks if the
given address is within the range of an
address range in the block. If yes, it
returns the appropriate Dwarf_Arange.
Otherwise, it returns DW_DLV_ERROR.
*/
int
{
return (DW_DLV_ERROR);
}
for (i = 0; i < arange_count; i++) {
curr_arange = *(aranges + i);
address <
return (DW_DLV_OK);
}
}
return (DW_DLV_NO_ENTRY);
}
/*
This function takes an Dwarf_Arange,
and returns the offset of the first
die in the compilation-unit that the
arange belongs to. Returns DW_DLV_ERROR
on error.
*/
int
Dwarf_Error * error)
{
return (DW_DLV_ERROR);
}
if(!dbg->de_debug_info) {
return res;
}
}
return DW_DLV_OK;
}
/*
This function takes an Dwarf_Arange,
and returns the offset of the CU header
in the compilation-unit that the
arange belongs to. Returns DW_DLV_ERROR
on error.
*/
int
Dwarf_Error * error)
{
return (DW_DLV_ERROR);
}
return DW_DLV_OK;
}
/*
This function takes a Dwarf_Arange, and returns
true if it is not NULL. It also stores the start
address of the range in *start, the length of the
range in *length, and the offset of the first die
in the compilation-unit in *cu_die_offset. It
returns false on error.
*/
int
Dwarf_Addr * start,
{
return (DW_DLV_ERROR);
}
if (cu_die_offset != NULL) {
if(!dbg->de_debug_info) {
return res;
}
}
}
return (DW_DLV_OK);
}