pro_section.c revision 49d3bc91e27cd871b950d56c01398fa2f2e12ab4
/*
Copyright (C) 2000 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 "libdwarfdefs.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_ELFACCESS_H
#include <elfaccess.h>
#endif
#include "pro_incl.h"
#include "pro_section.h"
#include "pro_line.h"
#include "pro_frame.h"
#include "pro_die.h"
#include "pro_macinfo.h"
#include "pro_types.h"
#ifndef SHF_MIPS_NOSTRIP
/* if this is not defined, we probably don't need it: just use 0 */
#define SHF_MIPS_NOSTRIP 0
#endif
#ifndef R_MIPS_NONE
#define R_MIPS_NONE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/* must match up with pro_section.h defines of DEBUG_INFO etc
and sectnames (below)
*/
char *_dwarf_rel_section_names[] = {
".rel.debug_info",
".rel.debug_line",
".rel.debug_abbrev", /* no relocations on this, really */
".rel.debug_frame",
".rel.debug_aranges",
".rel.debug_pubnames",
".rel.debug_str",
".rel.debug_funcnames", /* sgi extension */
".rel.debug_typenames", /* sgi extension */
".rel.debug_varnames", /* sgi extension */
".rel.debug_weaknames", /* sgi extension */
".rel.debug_macinfo",
".rel.debug_loc"
};
/* names of sections. Ensure that it matches the defines
in pro_section.h, in the same order
Must match also _dwarf_rel_section_names above
*/
char *_dwarf_sectnames[] = {
".debug_info",
".debug_line",
".debug_abbrev",
".debug_frame",
".debug_aranges",
".debug_pubnames",
".debug_str",
".debug_funcnames", /* sgi extension */
".debug_typenames", /* sgi extension */
".debug_varnames", /* sgi extension */
".debug_weaknames", /* sgi extension */
".debug_macinfo",
".debug_loc"
};
1, /* DW_LNS_advance_pc */
1, /* DW_LNS_advance_line */
1, /* DW_LNS_set_file */
1, /* DW_LNS_set_column */
0, /* DW_LNS_negate_stmt */
0, /* DW_LNS_set_basic_block */
0, /* DW_LNS_const_add_pc */
1, /* DW_LNS_fixed_advance_pc */
};
/* struct to hold relocation entries. Its mantained as a linked
list of relocation structs, and will then be written at as a
whole into the relocation section. Whether its 32 bit or
64 bit will be obtained from Dwarf_Debug pointer.
*/
typedef struct Dwarf_P_Rel_s *Dwarf_P_Rel;
struct Dwarf_P_Rel_s {
void *dr_rel_datap;
};
typedef struct Dwarf_P_Rel_Head_s *Dwarf_P_Rel_Head;
struct Dwarf_P_Rel_Head_s {
struct Dwarf_P_Rel_s *drh_head;
struct Dwarf_P_Rel_s *drh_tail;
};
Dwarf_Error * error);
Dwarf_Error * error);
Dwarf_Error * error);
static int _dwarf_pro_match_attr
/* these macros used as return value for below functions */
#define OPC_INCS_ZERO -1
#define OPC_OUT_OF_RANGE -2
#define LINE_OUT_OF_RANGE -3
/*
Return TRUE if we need the section, FALSE otherwise
If any of the 'line-data-related' calls were made
including file or directory entries,
produce .debug_line .
*/
static int
{
return FALSE;
}
return TRUE;
}
/*
Convert debug information to a format such that
it can be written on disk.
Called exactly once per execution.
*/
{
/*
Section data in written out in a number of buffers. Each
_generate_*() function returns a cumulative count of buffers for
all the sections. get_section_bytes() returns pointers to these
buffers one at a time. */
int nbufs;
int sect;
int name_idx;
int err;
}
/* Create dwarf section headers */
long flags = 0;
switch (sect) {
case DEBUG_INFO:
continue;
break;
case DEBUG_LINE:
continue;
}
break;
case DEBUG_ABBREV:
continue;
break;
case DEBUG_FRAME:
continue;
break;
case DEBUG_ARANGES:
continue;
break;
case DEBUG_PUBNAMES:
continue;
break;
case DEBUG_STR:
continue;
break;
case DEBUG_FUNCNAMES:
continue;
break;
case DEBUG_TYPENAMES:
continue;
break;
case DEBUG_VARNAMES:
continue;
break;
case DEBUG_WEAKNAMES:
continue;
break;
case DEBUG_MACINFO:
continue;
break;
case DEBUG_LOC:
/* not handled yet */
continue;
default:
/* logic error: missing a case */
}
{
int new_base_elf_sect;
/* rec size */ 1,
} else {
dbg->
SHN_UNDEF, 0,
}
if (new_base_elf_sect == -1) {
}
}
}
nbufs = 0;
/*
Changing the order in which the sections are generated may
cause problems because of relocations. */
if (nbufs < 0) {
}
}
if (dbg->de_frame_cies) {
if (nbufs < 0) {
}
}
if (dbg->de_first_macinfo) {
if (nbufs < 0) {
}
}
if (nbufs < 0) {
}
}
if (nbufs < 0) {
}
}
error);
if (nbufs < 0) {
}
}
error);
if (nbufs < 0) {
}
}
error);
if (nbufs < 0) {
}
}
error);
if (nbufs < 0) {
}
}
error);
if (nbufs < 0) {
}
}
{
int res;
}
}
return nbufs;
}
/*---------------------------------------------------------------
Generate debug_line section
---------------------------------------------------------------*/
static int
{
/* all data named cur* are used to loop thru linked lists */
int sum_bytes;
int prolog_size;
unsigned char *data; /* holds disk form data */
int elfsectno;
unsigned char *start_line_sec; /* pointer to the buffer at
section start */
/* temps for memcpy */
int res;
char buff1[ENCODE_SPACE_NEEDED];
sum_bytes = 0;
/* statement prologue information */
prolog_size = 0;
/* include directories */
while (curdir) {
}
prolog_size++; /* last null following last directory
entry. */
/* file entries */
while (curentry) {
prolog_size +=
}
prolog_size++; /* last null byte */
uwordb_size + /* prologue length */
/* length of table specifying # of opnds */
prolog_size += sizeof(std_opcode_len);
/* copy over the data */
/* total_length */
du = 0;
if (extension_size) {
sizeof(x), extension_size);
data += extension_size;
}
sizeof(du), uwordb_size);
data += uwordb_size;
sizeof(dh), sizeof(Dwarf_Half));
data += sizeof(Dwarf_Half);
/* prologue length */
{
sizeof(du), uwordb_size);
data += uwordb_size;
}
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
db = LINE_RANGE;
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
db = OPCODE_BASE;
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sizeof(std_opcode_len), sizeof(std_opcode_len));
data += sizeof(std_opcode_len);
/* copy over include directories */
while (curdir) {
}
data++;
/* copy file entries */
while (curentry) {
/* copies of leb numbers, no endian issues */
}
*data = '\0';
data++;
sum_bytes += prolog_size;
prevline = (Dwarf_P_Line)
}
/* generate opcodes for line numbers */
while (curline) {
int nbytes;
char *arg;
int opc;
int no_lns_copy; /* if lns copy opcode doesnt need to be
generated, if special opcode or end
sequence */
int line_adv; /* supposed to be a reasonably small
number, so the size should not be a
problem. ? */
no_lns_copy = 0;
int inst_bytes; /* no of bytes in extended opcode */
char *str; /* hold leb encoded inst_bytes */
int str_nbytes; /* no of bytes in str */
case DW_LNE_end_sequence:
/* Advance pc to end of text section. */
if (addr_adv > 0) {
res =
sizeof(buff1));
}
sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
/* leb, no endianness issue */
}
/* first null byte */
db = 0;
error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
/* write length of extended opcode */
inst_bytes = sizeof(Dwarf_Ubyte);
res =
}
data += str_nbytes;
sum_bytes += str_nbytes;
/* write extended opcode */
error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
/* reset value to original values */
no_lns_copy = 1;
/* this is set only for end_sequence, so that a
dw_lns_copy is not generated */
break;
case DW_LNE_set_address:
/* first null byte */
db = 0;
error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
/* write length of extended opcode */
res =
}
/* leb number, no endian issue */
data += str_nbytes;
sum_bytes += str_nbytes;
/* write extended opcode */
sizeof(Dwarf_Ubyte), error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
/* reloc for address */
*/
}
/* write offset (address) */
sizeof(du), upointer_size);
data += upointer_size;
no_lns_copy = 1;
break;
}
} else {
res =
sizeof(buff1));
}
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
}
&nbytes,
}
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
}
error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
}
if (curline->dpl_basic_block == true &&
prevline->dpl_basic_block == false) {
error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
}
if ((addr_adv % MIN_INST_LENGTH) != 0) {
}
no_lns_copy = 1;
error);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
prevline->dpl_basic_block = false;
} else {
if (addr_adv > 0) {
res =
sizeof(buff1));
}
(const void *) &db,
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
prevline->dpl_basic_block = false;
}
if (line_adv != 0) {
&nbytes,
sizeof
(buff1));
}
sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
prevline->dpl_basic_block = false;
}
}
} /* ends else for opc != 0 */
if (no_lns_copy == 0) { /* if not a special or dw_lne_end_seq
generate a matrix line */
db = DW_LNS_copy;
(const void *) &db,
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sum_bytes += sizeof(Dwarf_Ubyte);
prevline->dpl_basic_block = false;
}
}
/* write total length field */
length field
*/
{
}
return (int) dbg->de_n_debug_sect;
}
/*---------------------------------------------------------------
Generate debug_frame section
---------------------------------------------------------------*/
static int
{
int elfsectno;
int i;
int firsttime = 1;
int pad; /* pad for padding to align cies and
fdes */
unsigned char *data;
long *cie_offs; /* holds byte offsets for links to
fde's */
unsigned long cie_length;
int cie_no;
held for relocation info */
cie_length = 0;
cur_off = 0;
cie_offs = (long *)
}
/* generate cie number as we go along */
cie_no = 1;
while (curcie) {
char *code_al;
int c_bytes;
char *data_al;
int d_bytes;
int res;
char buff1[ENCODE_SPACE_NEEDED];
char buff2[ENCODE_SPACE_NEEDED];
char buff3[ENCODE_SPACE_NEEDED];
char *augmentation;
char *augmented_al;
long augmented_fields_length;
int a_bytes;
&c_bytes,
}
/* Before April 1999, the following was using an unsigned
encode. That worked ok even though the decoder used the
correct signed leb read, but doing the encode correctly
(according to the dwarf spec) saves space in the output file
and is completely compatible.
Note the actual stored amount on MIPS was 10 bytes (!) to
store the value -4. (hex)fc ffffffff ffffffff 01 The
libdwarf consumer consumed all 10 bytes too!
old version res =
_dwarf_pro_encode_leb128_nm(curcie->cie_data_align,
below is corrected signed version. */
&d_bytes,
}
/* get the correct offset */
if (firsttime) {
firsttime = 0;
} else {
}
cie_no++;
sizeof(buff3));
}
sizeof(Dwarf_Ubyte) + /* cie version */
c_bytes + /* code alignment factor */
d_bytes + /* data alignment factor */
sizeof(Dwarf_Ubyte) + /* return reg address */
a_bytes + /* augmentation length */
} else {
sizeof(Dwarf_Ubyte) + /* cie version */
reg
address
*/
}
cie_length += pad;
+ extension_size, error);
if (extension_size) {
(const void *) &x,
sizeof(x), extension_size);
data += extension_size;
}
du = cie_length;
/* total length of cie */
data += uwordb_size;
/* cie-id is a special value. */
sizeof(du), uwordb_size);
data += uwordb_size;
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
}
for (i = 0; i < pad; i++) {
*data = DW_CFA_nop;
data++;
}
}
/* calculate current offset */
/* write out fde's */
while (curfde) {
long fde_length;
int pad;
int v0_augmentation = 0;
#if 0
unsigned char *fde_start_point;
#endif
char afl_buff[ENCODE_SPACE_NEEDED];
/* Find the CIE associated with this fde. */
not 0. */
index++;
}
}
v0_augmentation = 1;
oet_length = sizeof(Dwarf_sfixed);
/* encode the length of augmented fields. */
sizeof(afl_buff));
}
pointer
*/
upointer_size + /* initial loc */
upointer_size + /* address range */
afl_length + /* augmented field length */
oet_length; /* exception_table offset */
} else {
pointer
*/
upointer_size + /* initial loc */
upointer_size; /* address range */
}
/* using fde offset, generate DW_AT_MIPS_fde attribute for the
die corresponding to this fde */
< 0)
return -1;
/* store relocation for cie pointer */
*/
}
/* store relocation information for initial location */
*/
}
/* Store the relocation information for the
offset_into_exception_info field, if the offset is valid (0
is a valid offset). */
if (v0_augmentation &&
curfde->fde_offset_into_exception_tables >= 0) {
/* r_offset, where in cie this
field starts */
sizeof(Dwarf_sfixed));
}
}
/* adjust for padding */
fde_length += pad;
/* write out fde */
#if 0
#endif
du = fde_length;
{
if (extension_size) {
(const void *) &x,
sizeof(x), extension_size);
data += extension_size;
}
/* length */
(const void *) &du,
sizeof(du), uwordb_size);
data += uwordb_size;
/* offset to cie */
(const void *) &du,
sizeof(du), uwordb_size);
data += uwordb_size;
(const void *) &du,
sizeof(du), upointer_size);
data += upointer_size;
if (dbg->de_reloc_pair &&
curfde->fde_end_symbol != 0 &&
curfde->fde_addr_range == 0) {
/* symbolic reloc, need reloc for length What if we
really know the length? If so, should use the other
part of 'if'. */
/* DEBUG_ARANGES, */
*/
{
return (0);
}
}
/* arrange pre-calc so assem text can do .word end -
begin + val (gets val from stream) */
(const void *) &val,
sizeof(val), upointer_size);
data += upointer_size;
} else {
(const void *) &du,
sizeof(du), upointer_size);
data += upointer_size;
}
}
if (v0_augmentation) {
/* write the encoded augmented field length. */
data += afl_length;
/* write the offset_into_exception_tables field. */
dsw =
sizeof(dsw), sizeof(Dwarf_sfixed));
data += sizeof(Dwarf_sfixed);
}
while (curinst) {
sizeof(db), sizeof(Dwarf_Ubyte));
data += sizeof(Dwarf_Ubyte);
#if 0
if (curinst->dfp_sym_index) {
int res;
(data - fde_start_point)
*/
{
return (0);
}
}
}
#endif
}
/* padding */
for (i = 0; i < pad; i++) {
*data = DW_CFA_nop;
data++;
}
}
return (int) dbg->de_n_debug_sect;
}
/*---------------------------------------------------------------
Generate debug_info and debug_abbrev sections
---------------------------------------------------------------*/
static int
{
int abbrevsectno;
unsigned char *data;
int cu_header_size;
int n_abbrevs;
int res;
/* write cu header */
info section
*/
sizeof(Dwarf_Half) + /* version stamp */
uword_size + /* offset into abbrev table */
sizeof(Dwarf_Ubyte); /* size of target address */
error);
if (extension_size) {
data += extension_size;
}
du = 0; /* length of debug_info, not counting
this field itself (unknown at this
point). */
data += uword_size;
change */
sizeof(version), sizeof(Dwarf_Half));
data += sizeof(Dwarf_Half);
du = 0; /* offset into abbrev table, not yet
known. */
data += uword_size;
sizeof(db), 1);
/* We have filled the chunk we got with GET_CHUNK. At this point we
no longer dare use "data" or "start_info_sec" as a pointer any
longer except to refer to that first small chunk for the cu
header. */
/* create AT_macro_info if appropriate */
return -1;
}
/* create AT_stmt_list attribute if necessary */
return -1;
/*
Relocation for abbrev offset in cu header store relocation
record in linked list */
res = dbg->de_reloc_name(dbg, DEBUG_INFO, extension_size + uword_size + sizeof(Dwarf_Half), /* r_offset
*/
}
/* pass 0: only top level dies, add at_sibling attribute to those
dies with children */
if (first_child->di_child)
}
/* pass 1: create abbrev info, get die offsets, calc relocations */
int nbytes;
char *space;
int res;
char buff1[ENCODE_SPACE_NEEDED];
}
if (abbrev_head == NULL) {
n_abbrevs = 1;
} else {
/* check if its a new abbreviation, if yes, add to tail */
n_abbrevs++;
}
}
&nbytes,
}
}
while (curattr) {
switch (curattr->ar_attribute) {
case DW_AT_stmt_list:
break;
case DW_AT_MIPS_fde:
break;
case DW_AT_macro_info:
break;
default:
break;
}
*/
}
}
}
/* depth first search */
else {
die_off++; /* since we are writing a null die at
the end of each sibling chain */
}
}
}
/* Pass 2: Write out the die information Here 'data' is a
temporary, one block for each GET_CHUNK. 'data' is overused. */
/* index to abbreviation table */
/* Attribute values - need to fill in all form attributes */
while (curattr) {
switch (curattr->ar_attribute_form) {
case DW_FORM_ref1:
{
(unsigned) 0xff) {
}
(const void *) &db,
sizeof(db), sizeof(Dwarf_Ubyte));
break;
}
case DW_FORM_ref2:
{
(unsigned) 0xffff) {
}
(const void *) &dh,
sizeof(dh), sizeof(Dwarf_Half));
break;
}
case DW_FORM_ref_addr:
{
{
/* ref to offset of die */
(const void *) &du,
sizeof(du), uword_size);
}
break;
}
case DW_FORM_ref4:
{
(unsigned) 0xffffffff) {
}
(const void *) &dw,
sizeof(dw), sizeof(Dwarf_ufixed));
break;
}
case DW_FORM_ref8:
(const void *) &du,
sizeof(du), sizeof(Dwarf_Unsigned));
break;
case DW_FORM_ref_udata:
{ /* unsigned leb128 offset */
int nbytes;
char buff1[ENCODE_SPACE_NEEDED];
res =
sizeof(buff1));
}
break;
}
default:
break;
}
}
/* depth first search */
else {
*data = '\0';
}
}
}
/* Write out debug_info size */
/* Dont include length field or extension bytes */
data = 0; /* Emphasise not usable now */
/* Write out debug_abbrev section */
while (curabbrev) {
char *val;
int nbytes;
int idx;
int res;
char buff1[ENCODE_SPACE_NEEDED];
}
}
sizeof(db), sizeof(Dwarf_Ubyte));
/* add attributes and forms */
&nbytes,
}
&nbytes,
}
}
for last
entry, see dwarf2 sec 7.5.3 */
*data = 0;
data++;
*data = 0;
}
for end of cu, see dwarf2 sec 7.5.3 */
*data = 0;
return (int) dbg->de_n_debug_sect;
}
/*---------------------------------------------------------------------
Get a buffer of section data.
section_idx is the elf-section number that this data applies to.
length shows length of returned data
----------------------------------------------------------------------*/
/*ARGSUSED*/ /* pretend all args used */
{
}
if (dbg->de_debug_sects == 0) {
/* no more data !! */
return NULL;
}
/* no data ever entered !! */
return NULL;
}
/* We may want to call the section stuff more than once: see
dwarf_reset_section_bytes() do not do: dbg->de_n_debug_sect--; */
return buf;
}
/*
No errors possible.
*/
void
{
/* No need to reset; commented out decrement. dbg->de_n_debug_sect
= ???; */
dbg->de_reloc_next_to_return = 0;
}
/*
Storage handler. Gets either a new chunk of memory, or
a pointer in existing memory, from the linked list attached
to dbg at de_debug_sects, depending on size of nbytes
Assume dbg not null, checked in top level routine
Returns a pointer to the allocated buffer space for the
lib to fill in, predincrements next-to-use count so the
space requested is already counted 'used'
when this returns (ie, reserved).
*/
{
/* By using MAGIC_SECT_NO we allow the following MAGIC_SECT_NO must
not match any legit section number. test to have just two
clauses (no NULL pointer test) See dwarf_producer_init(). */
) {
/* Either the elf section has changed or there is not enough
space in the current section.
Create a new Dwarf_P_Section_Data_s for the chunk. and have
space 'on the end' for the buffer itself so we just do one
malloc (not two).
*/
if (nbytes < CHUNK_SIZE)
space = CHUNK_SIZE;
sizeof(struct Dwarf_P_Section_Data_s)
+ space);
return (NULL);
/* _dwarf_p_get_alloc zeroes the space... */
sizeof(struct Dwarf_P_Section_Data_s);
of space for caller to fill
in */
/* Now link on the end of the list, and mark this one as the
current one */
/* the only entry is the special one for 'no entry' so
delete that phony one while adding this initial real
one. */
} else {
}
dbg->de_n_debug_sect++;
}
/* There is enough space in the current buffer */
{
return space_for_caller;
}
}
/*------------------------------------------------------------
Given address advance and line advance, it gives
either special opcode, or a number < 0
------------------------------------------------------------*/
static int
{
int opc;
return OPC_INCS_ZERO;
opc =
if (opc > 255)
return OPC_OUT_OF_RANGE;
return opc;
} else
return LINE_OUT_OF_RANGE;
}
/*-----------------------------------------------------------------------
Handles abbreviations. It takes a die, searches through
current list of abbreviations for matching one. If it
finds one, it returns a pointer to it, and if it doesnt,
it returns a new one. Upto the user of this function to
link it up to the abbreviation head. If its a new one,
abb_idx has 0.
-----------------------------------------------------------------------*/
static Dwarf_P_Abbrev
{
int res1;
int nattrs;
int match;
Dwarf_ufixed *forms = 0;
Dwarf_ufixed *attrs = 0;
while (curabbrev) {
/* There is a chance of a match. */
(int) curabbrev->
if (res1 == 0)
match = 0;
}
if (match == 1)
return curabbrev;
}
}
/* no match, create new abbreviation */
forms = (Dwarf_ufixed *)
return NULL;
attrs = (Dwarf_ufixed *)
return NULL;
}
nattrs = 0;
while (curattr) {
nattrs++;
}
return NULL;
else
return curabbrev;
}
/*------------------------------------------------------------------
Tries to see if given attribute and form combination
exists in the given abbreviation
-------------------------------------------------------------------*/
static int
{
int i;
int found = 0;
for (i = 0; i < no_attr; i++) {
found = 1;
break;
}
}
return found;
}