/*
Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved.
Portions Copyright 2002-2010 Sun Microsystems, 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:
*/
#include <stddef.h>
/*
Sgidefs included to define __uint32_t,
a guaranteed 4-byte quantity.
*/
#include "libdwarfdefs.h"
#define true 1
#define false 0
/* to identify a cie */
/*Dwarf_Word is unsigned word usable for index, count in memory */
/*Dwarf_Sword is signed word usable for index, count in memory */
/* The are 32 or 64 bits depending if 64 bit longs or not, which
** fits the ILP32 and LP64 models
** These work equally well with ILP64.
*/
typedef unsigned long Dwarf_Word;
typedef long Dwarf_Sword;
typedef signed char Dwarf_Sbyte;
typedef unsigned char Dwarf_Ubyte;
typedef signed short Dwarf_Shalf;
/*
On any change that makes libdwarf producer
incompatible, increment this number.
1->2->3 ...
*/
/* these 2 are fixed sizes which must not vary with the
*/
/*
producer:
This struct is used to hold information about all
debug* sections. On creating a new section, section
names and indices are added to this struct
definition in pro_section.h
*/
/*
producer:
This struct is used to hold entries in the include directories
part of statement prologue. Definition in pro_line.h
*/
/*
producer:
This struct holds file entries for the statement prologue.
Defined in pro_line.h
*/
/*
producer:
This struct holds information for each cie. Defn in pro_frame.h
*/
/*
producer:
Struct to hold line number information, different from
Dwarf_Line opaque type.
*/
/*
producer:
Struct to hold information about address ranges.
*/
/* Defined to get at the elf section numbers and section name
indices in symtab for the dwarf sections
Must match .rel.* names in _dwarf_rel_section_names
exactly.
*/
#define DEBUG_INFO 0
/* number of debug_* sections not including the relocations */
struct Dwarf_P_Die_s {
/* The last child field makes linking up children an O(1) operation,
See pro_die.c. */
};
/* producer fields */
struct Dwarf_P_Attribute_s {
relocatable value, holds
index of symbol in SYMTAB */
applies to. 4 or 8. Unused and may
be 0 if if ar_rel_type is
R_MIPS_NONE */
};
/* A block of .debug_macinfo data: this forms a series of blocks.
** Each macinfo input is compressed immediately and put into
** the current block if room, else a newblock allocated.
** The space allocation is such that the block and the macinfo
** data are one malloc block: free with a pointer to this and the
** mb_data is freed automatically.
** Like the struct hack, but legal ANSI C.
*/
struct dw_macinfo_block_s {
unsigned long mb_avail_len;
unsigned long mb_used_len;
unsigned long mb_macinfo_data_space_len;
};
/* dwarf_sn_kind is for the array of similarly-treated
name -> cu ties
*/
};
/* The calls to add a varname etc use a list of
these as the list.
*/
struct Dwarf_P_Simple_nameentry_s {
char *sne_name;
int sne_name_len;
};
/* An array of these, each of which heads a list
of Dwarf_P_Simple_nameentry
*/
struct Dwarf_P_Simple_name_header_s {
/* length that will be generated, not counting fixed header or
trailer */
};
int sec_index,
enum Dwarf_Rel_Type type,
int reltarget_length);
enum Dwarf_Rel_Type type,
int reltarget_length);
/*
Each slot in a block of slots could be:
a binary stream relocation entry (32 or 64bit relocation data)
a SYMBOLIC relocation entry.
During creation sometimes we create multiple chained blocks,
but sometimes we create a single long block.
Before returning reloc data to caller,
we switch to a single, long-enough,
block.
We make counters here Dwarf_Unsigned so that we
get sufficient alignment. Since we use space after
the struct (at malloc time) for user data which
must have Dwarf_Unsigned alignment, this
struct must have that alignment too.
*/
struct Dwarf_P_Relocation_Block_s {
end, depending on
rb_next_slot_to_use) */
};
/* One of these per potential relocation section
So one per actual dwarf section.
Left zeroed when not used (some sections have
no relocations).
*/
struct Dwarf_P_Per_Reloc_Sect_s {
across all blocks */
is the default number of slots to use */
de_callback_func() or de_callback_func_b() call, this is the sect
number of the relocation section. */
/* singly-linked list. add at and ('last') with count of blocks */
unsigned long pr_block_count;
};
typedef struct memory_list_s {
struct Dwarf_P_Per_Sect_String_Attrs_s {
unsigned sect_sa_n_alloc;
unsigned sect_sa_n_used;
};
/* Fields used by producer */
struct Dwarf_P_Debug_s {
/* used to catch dso passing dbg to another DSO with incompatible
version of libdwarf See PRO_VERSION_MAGIC */
/* Call back function, used to create .debug* sections. Provided
by user. Only of these used per dbg. */
/* Flags from producer_init call */
/* This holds information on debug section stream output, including
the stream data */
/* Pointer to the 'current active' section */
/* Number of debug data streams globs. */
/* File entry information, null terminated singly-linked list */
/* Has the directories used to search for source files */
/* Has all the line number info for the stmt program */
/* List of cie's for the debug unit */
/* Singly-linked list of fde's for the debug unit */
/* First die, leads to all others */
/* Pointer to list of strings */
char *de_strings;
/* Pointer to chain of aranges */
/* macinfo controls. */
/* first points to beginning of the list during creation */
/* current points to the current, unfilled, block */
/* Pointer to the first section, to support reset_section_bytes */
/* handles pubnames, weaknames, etc. See dwarf_sn_kind in
pro_opaque.h */
struct Dwarf_P_Simple_name_header_s
/* relocation data. not all sections will actally have relocation
info, of course */
(SYMBOLIC output) */
/* used in remembering sections */
the section itself, DEBUG_LINE for example */
name index or handle for the name of the symbol for
DEBUG_LINE for example */
example. Specific to the ABI being
produced. Relocates offset size
field */
table relocs. */
example. Specific to the ABI being
produced. relocates pointer size
field */
avoid test of abi in macro
at run time MIPS -n32 4,
-64 8. */
Here to avoid test of abi in
macro at run time MIPS -n32
4, -64 is 8. */
used for passing this info as a flag
*/
varies by ABI and
relocation-output
method (stream or
symbolic) */
offsets using dwarf2-99
extension proposal */
/* simple name relocations */
/* relocations for a length, requiring a pair of symbols */
/* following used for macro buffers */
unsigned long de_compose_avail;
unsigned long de_compose_used_len;
unsigned char de_same_endian;
/* Add new fields at the END of this struct to preserve some hope
of sensible behavior on dbg passing between DSOs linked with
mismatched libdwarf producer versions. */
unsigned de_marker_n_alloc;
unsigned de_marker_n_used;
/* String attributes data of each section. */
};
char *entry_name,
enum dwarf_sn_kind
Dwarf_Error * error);