home *** CD-ROM | disk | FTP | other *** search
- /*
- dwarf_opaque.h
-
- This file defines all the opaque structures for which pointers
- are provided in libdwarf.h. In addition, it defines private
- structures that are used internally by libdwarf.
-
- $Revision: 1.42 $ $Date: 1994/06/06 20:11:00 $
- */
-
- /*
- Sgidefs included to define __uint32_t,
- a guaranteed 4-byte quantity.
- */
- #include <sgidefs.h>
-
- #define true 1
- #define false 0
-
- /* to identify a cie */
- #define DW_CIE_ID ~(0x0)
- #define DW_CIE_VERSION 1
- #define ABBREV_HASH_TABLE_SIZE 1000
-
-
- /*
- These are allocation type codes for structs that
- are internal to the Libdwarf Consumer library.
- */
- #define DW_DLA_ABBREV_LIST DW_DLA_ADDR + 1
- #define DW_DLA_CHAIN DW_DLA_ADDR + 2
- #define DW_DLA_CU_CONTEXT DW_DLA_ADDR + 3
- #define DW_DLA_FRAME DW_DLA_ADDR + 4
- #define DW_DLA_GLOBAL_CONTEXT DW_DLA_ADDR + 5
- #define DW_DLA_FILE_ENTRY DW_DLA_ADDR + 6
- #define DW_DLA_LINE_CONTEXT DW_DLA_ADDR + 7
- #define DW_DLA_LOC_CHAIN DW_DLA_ADDR + 8
- #define DW_DLA_HASH_TABLE DW_DLA_ADDR + 9
- #define DW_DLA_FUNC_CONTEXT DW_DLA_ADDR + 10
- #define DW_DLA_TYPENAME_CONTEXT DW_DLA_ADDR + 11
- #define DW_DLA_VAR_CONTEXT DW_DLA_ADDR + 12
- #define DW_DLA_WEAK_CONTEXT DW_DLA_ADDR + 13
-
- /* Maximum number of allocation types for allocation routines. */
- #define MAX_DW_DLA DW_DLA_WEAK_CONTEXT
-
-
- typedef __uint32_t Dwarf_Word;
- typedef signed char Dwarf_Sbyte;
- typedef unsigned char Dwarf_Ubyte;
- typedef signed short Dwarf_Shalf;
- typedef __int32_t Dwarf_Sword;
- typedef Dwarf_Small *Dwarf_Byte_Ptr;
-
-
- typedef struct Dwarf_Abbrev_List_s *Dwarf_Abbrev_List;
- typedef struct Dwarf_File_Entry_s *Dwarf_File_Entry;
- typedef struct Dwarf_CU_Context_s *Dwarf_CU_Context;
- typedef struct Dwarf_Hash_Table_s *Dwarf_Hash_Table;
-
-
- typedef struct Dwarf_Alloc_Hdr_s *Dwarf_Alloc_Hdr;
-
- struct Dwarf_Die_s {
- /*
- Points to the start of the portion corresponding
- to this Die in the .debug_info section.
- */
- Dwarf_Byte_Ptr di_debug_info_ptr;
-
- Dwarf_Abbrev_List di_abbrev_list;
-
- /* Points to cu context for this die. */
- Dwarf_CU_Context di_cu_context;
- };
-
- struct Dwarf_Attribute_s {
- Dwarf_Half ar_attribute; /* Attribute Value. */
- Dwarf_Half ar_attribute_form; /* Attribute Form. */
- Dwarf_CU_Context ar_cu_context;
- Dwarf_Small *ar_debug_info_ptr;
- Dwarf_Attribute ar_next;
- };
-
- /*
- This structure provides the context for a compilation unit.
- Thus, it contains the Dwarf_Debug, cc_dbg, that this cu
- belongs to. It contains the information in the compilation
- unit header, cc_length, cc_version_stamp, cc_abbrev_offset,
- and cc_address_size, in the .debug_info section for that cu.
- In addition, it contains the count, cc_count_cu, of the cu
- number of that cu in the list of cu's in the .debug_info.
- The count starts at 1, ie cc_count_cu is 1 for the first cu,
- 2 for the second and so on. This struct also contains a
- pointer, cc_abbrev_table, to a list of pairs of abbrev code
- and a pointer to the start of that abbrev
- in the .debug_abbrev section.
-
- Each die will also contain a pointer to such a struct to
- record the context for that die.
-
- **Updated by dwarf_next_cu_header in dwarf_die_deliv.c
- */
- struct Dwarf_CU_Context_s {
- Dwarf_Debug cc_dbg;
- Dwarf_Word cc_length;
- Dwarf_Half cc_version_stamp;
- Dwarf_Sword cc_abbrev_offset;
- Dwarf_Small cc_address_size;
- Dwarf_Word cc_debug_info_offset;
- Dwarf_Byte_Ptr cc_last_abbrev_ptr;
- Dwarf_Hash_Table cc_abbrev_hash_table;
- Dwarf_CU_Context cc_next;
- };
-
-
- struct Dwarf_Debug_s {
- Elf *de_elf;
-
- Dwarf_Unsigned de_access;
- Dwarf_Handler de_errhand;
- Dwarf_Ptr de_errarg;
-
- /*
- Context for the compilation_unit just
- read by a call to dwarf_next_cu_header.
- **Updated by dwarf_next_cu_header in
- dwarf_die_deliv.c
- */
- Dwarf_CU_Context de_cu_context;
-
- /*
- Points to linked list of CU Contexts
- for the CU's already read.
- */
- Dwarf_CU_Context de_cu_context_list;
-
- /* Points to the last CU Context added to list. */
- Dwarf_CU_Context de_cu_context_list_end;
-
- /* Offset of last byte of last CU read. */
- Dwarf_Word de_info_last_offset;
-
- /*
- Number of bytes in the length, address,
- and offset field in various .debug_*
- sections. Check that this is in agreement
- with the address size in those sections.
- This field is dervied from the Elf header.
- */
-
- Dwarf_Small de_length_size;
-
- /*
- Array of pointers to Dwarf_Alloc_Hdr_s structs
- used to manage chunks that are malloc'ed for
- each allocation type for structs. The extra
- element is to take care of the fact that C
- arrays start from 0, and DW_DLA_STRING is 1.
- */
- Dwarf_Alloc_Hdr de_alloc_hdr[MAX_DW_DLA + 1];
-
- /*
- These fields are used to process debug_frame
- section. **Updated by dwarf_get_fde_list
- in dwarf_frame.h
- */
- /*
- Points to contiguous block of pointers
- to Dwarf_Cie_s structs.
- */
- Dwarf_Cie *de_cie_data;
- /* Count of number of Dwarf_Cie_s structs. */
- Dwarf_Signed de_cie_count;
- /*
- Points to contiguous block of pointers
- to Dwarf_Fde_s structs.
- */
- Dwarf_Fde *de_fde_data;
- /* Count of number of Dwarf_Fde_s structs. */
- Dwarf_Signed de_fde_count;
-
- Dwarf_Small *de_debug_info;
- Dwarf_Small *de_debug_abbrev;
- Dwarf_Small *de_debug_line;
- Dwarf_Small *de_debug_loc;
- Dwarf_Small *de_debug_aranges;
- Dwarf_Small *de_debug_macinfo;
- Dwarf_Small *de_debug_pubnames;
- Dwarf_Small *de_debug_str;
- Dwarf_Small *de_debug_frame;
- Dwarf_Small *de_debug_funcnames;
- Dwarf_Small *de_debug_typenames;
- Dwarf_Small *de_debug_varnames;
- Dwarf_Small *de_debug_weaknames;
-
- Dwarf_Unsigned de_debug_info_size;
- Dwarf_Unsigned de_debug_abbrev_size;
- Dwarf_Unsigned de_debug_line_size;
- Dwarf_Unsigned de_debug_loc_size;
- Dwarf_Unsigned de_debug_aranges_size;
- Dwarf_Unsigned de_debug_macinfo_size;
- Dwarf_Unsigned de_debug_pubnames_size;
- Dwarf_Unsigned de_debug_str_size;
- Dwarf_Unsigned de_debug_frame_size;
- Dwarf_Unsigned de_debug_funcnames_size;
- Dwarf_Unsigned de_debug_typenames_size;
- Dwarf_Unsigned de_debug_varnames_size;
- Dwarf_Unsigned de_debug_weaknames_size;
- };
-
-
- typedef struct Dwarf_Chain_s *Dwarf_Chain;
- struct Dwarf_Chain_s {
- void *ch_item;
- Dwarf_Chain ch_next;
- };
-
- #define CURRENT_VERSION_STAMP 2
-
- /* Size of cu header version stamp field. */
- #define CU_VERSION_STAMP_SIZE sizeof(Dwarf_Half)
-
- /* Size of cu header address size field. */
- #define CU_ADDRESS_SIZE_SIZE sizeof(Dwarf_Small)
-