home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / libdwarf / dwarf_opaque.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  6.8 KB  |  226 lines

  1. /* 
  2.     dwarf_opaque.h
  3.  
  4.     This file defines all the opaque structures for which pointers
  5.     are provided in libdwarf.h.  In addition, it defines private
  6.     structures that are used internally by libdwarf.
  7.  
  8.     $Revision: 1.42 $ $Date: 1994/06/06 20:11:00 $
  9. */
  10.  
  11. /* 
  12.     Sgidefs included to define __uint32_t, 
  13.     a guaranteed 4-byte quantity.            
  14. */
  15. #include <sgidefs.h>
  16.  
  17. #define true                    1
  18. #define false                   0
  19.  
  20. /* to identify a cie */
  21. #define DW_CIE_ID         ~(0x0)
  22. #define DW_CIE_VERSION        1
  23. #define ABBREV_HASH_TABLE_SIZE    1000
  24.  
  25.  
  26. /* 
  27.     These are allocation type codes for structs that
  28.     are internal to the Libdwarf Consumer library.
  29. */
  30. #define DW_DLA_ABBREV_LIST    DW_DLA_ADDR + 1
  31. #define DW_DLA_CHAIN        DW_DLA_ADDR + 2
  32. #define DW_DLA_CU_CONTEXT    DW_DLA_ADDR + 3
  33. #define DW_DLA_FRAME        DW_DLA_ADDR + 4
  34. #define DW_DLA_GLOBAL_CONTEXT    DW_DLA_ADDR + 5
  35. #define DW_DLA_FILE_ENTRY    DW_DLA_ADDR + 6
  36. #define DW_DLA_LINE_CONTEXT    DW_DLA_ADDR + 7
  37. #define DW_DLA_LOC_CHAIN    DW_DLA_ADDR + 8
  38. #define DW_DLA_HASH_TABLE    DW_DLA_ADDR + 9
  39. #define DW_DLA_FUNC_CONTEXT    DW_DLA_ADDR + 10
  40. #define DW_DLA_TYPENAME_CONTEXT    DW_DLA_ADDR + 11
  41. #define DW_DLA_VAR_CONTEXT    DW_DLA_ADDR + 12
  42. #define DW_DLA_WEAK_CONTEXT    DW_DLA_ADDR + 13
  43.  
  44. /* Maximum number of allocation types for allocation routines. */
  45. #define MAX_DW_DLA        DW_DLA_WEAK_CONTEXT
  46.  
  47.  
  48. typedef __uint32_t                  Dwarf_Word;
  49. typedef signed char                 Dwarf_Sbyte;
  50. typedef unsigned char               Dwarf_Ubyte;
  51. typedef signed short            Dwarf_Shalf;
  52. typedef __int32_t            Dwarf_Sword;
  53. typedef Dwarf_Small             *Dwarf_Byte_Ptr;
  54.  
  55.  
  56. typedef struct Dwarf_Abbrev_List_s    *Dwarf_Abbrev_List;
  57. typedef struct Dwarf_File_Entry_s    *Dwarf_File_Entry;
  58. typedef struct Dwarf_CU_Context_s    *Dwarf_CU_Context;
  59. typedef struct Dwarf_Hash_Table_s    *Dwarf_Hash_Table;
  60.  
  61.  
  62. typedef struct Dwarf_Alloc_Hdr_s    *Dwarf_Alloc_Hdr;
  63.  
  64. struct Dwarf_Die_s {
  65.     /* 
  66.         Points to the start of the portion corresponding 
  67.         to this Die in the .debug_info section.  
  68.     */
  69.     Dwarf_Byte_Ptr       di_debug_info_ptr;
  70.  
  71.     Dwarf_Abbrev_List     di_abbrev_list;
  72.  
  73.     /* Points to cu context for this die.  */
  74.     Dwarf_CU_Context     di_cu_context;
  75. };
  76.  
  77. struct Dwarf_Attribute_s {
  78.     Dwarf_Half          ar_attribute;        /* Attribute Value. */
  79.     Dwarf_Half          ar_attribute_form;    /* Attribute Form. */
  80.     Dwarf_CU_Context    ar_cu_context;
  81.     Dwarf_Small        *ar_debug_info_ptr;
  82.     Dwarf_Attribute    ar_next;
  83. };
  84.  
  85. /*
  86.     This structure provides the context for a compilation unit.  
  87.     Thus, it contains the Dwarf_Debug, cc_dbg, that this cu
  88.     belongs to.  It contains the information in the compilation 
  89.     unit header, cc_length, cc_version_stamp, cc_abbrev_offset,
  90.     and cc_address_size, in the .debug_info section for that cu.  
  91.     In addition, it contains the count, cc_count_cu, of the cu 
  92.     number of that cu in the list of cu's in the .debug_info.  
  93.     The count starts at 1, ie cc_count_cu is 1 for the first cu, 
  94.     2 for the second and so on.  This struct also contains a 
  95.     pointer, cc_abbrev_table, to a list of pairs of abbrev code 
  96.     and a pointer to the start of that abbrev 
  97.     in the .debug_abbrev section.
  98.  
  99.     Each die will also contain a pointer to such a struct to 
  100.     record the context for that die.  
  101.     
  102.     **Updated by dwarf_next_cu_header in dwarf_die_deliv.c
  103. */
  104. struct Dwarf_CU_Context_s {
  105.     Dwarf_Debug            cc_dbg;
  106.     Dwarf_Word            cc_length;
  107.     Dwarf_Half            cc_version_stamp;
  108.     Dwarf_Sword            cc_abbrev_offset;
  109.     Dwarf_Small            cc_address_size;
  110.     Dwarf_Word            cc_debug_info_offset;
  111.     Dwarf_Byte_Ptr        cc_last_abbrev_ptr;
  112.     Dwarf_Hash_Table        cc_abbrev_hash_table;
  113.     Dwarf_CU_Context        cc_next;
  114. };
  115.  
  116.  
  117. struct Dwarf_Debug_s {
  118.     Elf                 *de_elf;
  119.  
  120.     Dwarf_Unsigned      de_access;
  121.     Dwarf_Handler       de_errhand;
  122.     Dwarf_Ptr           de_errarg;
  123.     
  124.     /* 
  125.         Context for the compilation_unit just
  126.         read by a call to dwarf_next_cu_header.
  127.         **Updated by dwarf_next_cu_header in
  128.         dwarf_die_deliv.c
  129.     */
  130.     Dwarf_CU_Context    de_cu_context;
  131.  
  132.         /*
  133.         Points to linked list of CU Contexts
  134.         for the CU's already read.
  135.     */
  136.     Dwarf_CU_Context    de_cu_context_list;
  137.  
  138.         /* Points to the last CU Context added to list. */
  139.     Dwarf_CU_Context    de_cu_context_list_end;
  140.  
  141.     /* Offset of last byte of last CU read. */
  142.     Dwarf_Word        de_info_last_offset;
  143.  
  144.     /* 
  145.         Number of bytes in the length, address,
  146.         and offset field in various .debug_* 
  147.         sections.  Check that this is in agreement 
  148.         with the address size in those sections.  
  149.         This field is dervied from the Elf header.
  150.     */
  151.  
  152.     Dwarf_Small        de_length_size;
  153.  
  154.     /* 
  155.         Array of pointers to Dwarf_Alloc_Hdr_s structs 
  156.         used to manage chunks that are malloc'ed for 
  157.         each allocation type for structs.  The extra
  158.         element is to take care of the fact that C
  159.         arrays start from 0, and DW_DLA_STRING is 1.
  160.     */
  161.     Dwarf_Alloc_Hdr    de_alloc_hdr[MAX_DW_DLA + 1];
  162.  
  163.     /* 
  164.     These fields are used to process debug_frame
  165.         section.  **Updated by dwarf_get_fde_list
  166.         in dwarf_frame.h
  167.     */
  168.     /* 
  169.         Points to contiguous block of pointers 
  170.         to Dwarf_Cie_s structs.
  171.     */
  172.     Dwarf_Cie           *de_cie_data;
  173.     /* Count of number of Dwarf_Cie_s structs. */
  174.     Dwarf_Signed        de_cie_count;
  175.     /* 
  176.         Points to contiguous block of pointers
  177.         to Dwarf_Fde_s structs.
  178.     */
  179.     Dwarf_Fde           *de_fde_data;
  180.     /* Count of number of Dwarf_Fde_s structs. */
  181.     Dwarf_Signed        de_fde_count;
  182.  
  183.     Dwarf_Small         *de_debug_info;
  184.     Dwarf_Small         *de_debug_abbrev;
  185.     Dwarf_Small         *de_debug_line;
  186.     Dwarf_Small         *de_debug_loc;
  187.     Dwarf_Small         *de_debug_aranges;
  188.     Dwarf_Small         *de_debug_macinfo;
  189.     Dwarf_Small         *de_debug_pubnames;
  190.     Dwarf_Small         *de_debug_str;
  191.     Dwarf_Small         *de_debug_frame;
  192.     Dwarf_Small        *de_debug_funcnames;
  193.     Dwarf_Small        *de_debug_typenames;
  194.     Dwarf_Small        *de_debug_varnames;
  195.     Dwarf_Small        *de_debug_weaknames;
  196.  
  197.     Dwarf_Unsigned      de_debug_info_size;
  198.     Dwarf_Unsigned      de_debug_abbrev_size;
  199.     Dwarf_Unsigned      de_debug_line_size;
  200.     Dwarf_Unsigned      de_debug_loc_size;
  201.     Dwarf_Unsigned      de_debug_aranges_size;
  202.     Dwarf_Unsigned      de_debug_macinfo_size;
  203.     Dwarf_Unsigned      de_debug_pubnames_size;
  204.     Dwarf_Unsigned      de_debug_str_size;
  205.     Dwarf_Unsigned      de_debug_frame_size;
  206.     Dwarf_Unsigned    de_debug_funcnames_size;
  207.     Dwarf_Unsigned    de_debug_typenames_size;
  208.     Dwarf_Unsigned    de_debug_varnames_size;
  209.     Dwarf_Unsigned    de_debug_weaknames_size;
  210. };
  211.  
  212.  
  213. typedef struct Dwarf_Chain_s    *Dwarf_Chain;
  214. struct Dwarf_Chain_s {
  215.     void        *ch_item;
  216.     Dwarf_Chain        ch_next;
  217. };
  218.  
  219. #define CURRENT_VERSION_STAMP        2
  220.  
  221.     /* Size of cu header version stamp field. */
  222. #define CU_VERSION_STAMP_SIZE   sizeof(Dwarf_Half)
  223.  
  224.     /* Size of cu header address size field. */
  225. #define CU_ADDRESS_SIZE_SIZE    sizeof(Dwarf_Small)
  226.