OSDN Git Service

(LibGoblin)
[drdeamon64/drdeamon64.git] / libgoblin / drd64_libgoblin_type.h
index 4e4e346..99cbe01 100644 (file)
@@ -39,16 +39,18 @@ Comment:
 
 
 /*=====================================================================*/
-#define        DWARF_ABBREV_MAXITEMS   30
+/*
+typedef union  {
+       int             i_obj_id;
+       Byte    *pb_info;
+} LibGoblin_ObjInfo_Link;
+*/
 
-typedef struct {
-       DWord   dw_id;
-       DWord   dw_tag;
-       Byte    b_children;
-       int             i_items;
-       DWord   dw_attribute[ DWARF_ABBREV_MAXITEMS ];
-       DWord   dw_format[ DWARF_ABBREV_MAXITEMS ];
-} DWARF_AbbrevEntry;
+/*=====================================================================*/
+typedef        struct  {
+       Byte    *pb_dwinfo;
+       int             i_obj_id;
+} LibGoblin_Index_DWARFInfo;
 
 
 /*=====================================================================*/
@@ -84,19 +86,25 @@ typedef struct      {
 #define        OBJINFO_STATUS_VALID    0x00000001      // bit 0
 #define        OBJINFO_STATUS_DYNAMIC  0x00000002      // bit 1
 #define        OBJINFO_STATUS_RESOLV1  0x00000004      // bit 2 (Specified BinaryInfo & Index)
-#define        OBJINFO_STATUS_RESOLV2  0x00000008      // bit 3 (Loaded .so)
+//#define      OBJINFO_STATUS_RESOLV2  0x00000008      // bit 3 (Loaded .so)
 #define        OBJINFO_STATUS_REL              0x00000100
-
-#define        OBJINFO_TYPE_NULL               0x00
-#define        OBJINFO_TYPE_PROGRAM    0x01
-#define        OBJINFO_TYPE_MASTER             0x02
-#define        OBJINFO_TYPE_PROGHDR    0x03
-#define        OBJINFO_TYPE_SECTION    0x04
-#define        OBJINFO_TYPE_FUNCTION   0x05
-#define        OBJINFO_TYPE_OBJECT             0x06
-#define        OBJINFO_TYPE_COMMON             0x07
-#define        OBJINFO_TYPE_TLS                0x08
-#define        OBJINFO_TYPE_REL                0x09
+#define        OBJINFO_STATUS_SOLVED   0x00001000
+
+#define        OBJINFO_TYPE_NULL                       0x00
+#define        OBJINFO_TYPE_MASTER                     0x01
+#define        OBJINFO_TYPE_PROGRAM            0x02
+#define        OBJINFO_TYPE_PROGHDR            0x03
+#define        OBJINFO_TYPE_SECTION            0x04
+#define        OBJINFO_TYPE_OBJFILE            0x05
+#define        OBJINFO_TYPE_TYPE_MULTI         0x06
+#define        OBJINFO_TYPE_TYPE_SINGLE        0x07
+#define        OBJINFO_TYPE_TYPEDEF            0x08
+#define        OBJINFO_TYPE_FUNCTION           0x09
+#define        OBJINFO_TYPE_OBJECT                     0x0a
+#define        OBJINFO_TYPE_COMMON                     0x0b
+#define        OBJINFO_TYPE_TLS                        0x0c
+#define        OBJINFO_TYPE_REL                        0x0d
+#define        OBJINFO_TYPE_NONE                       0x7f
 
 typedef        struct  {
        int             i_id;
@@ -112,6 +120,12 @@ typedef    struct  {
                //   [Symbol ] st_size - Size of associated object.
        } addr;
 
+       // Address Order Link ---
+       struct  {
+               int             i_next_id;              // Next Address ObjectInfo
+               int             i_prev_id;              // Prev Address ObjectInfo
+       } addrlink;
+
        // Group(Parent-Child) Order Link ---
        struct  {
                int             i_parent_id;    // Parent ObjectInfo
@@ -120,11 +134,11 @@ typedef   struct  {
                int             i_next_id;              // Next 
        } grplink;
 
-       // Address Order Link ---
+       // Type Link ---
        struct  {
-               int             i_next_id;              // Next Address ObjectInfo
-               int             i_prev_id;              // Prev Address ObjectInfo
-       } addrlink;
+               int             i_prev_id;
+               int             i_next_id;
+       } typelink;
 
        // File Info ---
        struct  {
@@ -143,10 +157,12 @@ typedef   struct  {
        union   {
                Byte            b_data[128];
 
+               // for OBJINFO_TYPE_PROGRAM
                struct  {
                        int             i_binfo_id;
                } program;
 
+               // for OBJINFO_TYPE_PROGHDR
                struct  {
                        DWord   dw_type;                // Entry type.
                        DWord   dw_flags;               // Access permission flags.
@@ -154,6 +170,7 @@ typedef     struct  {
                        void    *pv_proghdr;    // Program Header Pointer
                } proghdr;
 
+               // for OBJINFO_TYPE_SECTION
                struct  {
                        QWord   qw_flag;                // sh_flags - Section flags.
                        QWord   qw_align;               // sh_addralign - Alignment in bytes.
@@ -164,16 +181,41 @@ typedef   struct  {
                        void    *pv_sechdr;
                } section;
 
+               // for OBJINFO_TYPE_OBJFILE
+               struct  {
+                       int             i_objid_parent;
+                       int             i_abbrevs;
+                       DWARF_AbbrevEntry                               *p_abbrev;
+                       LibGoblin_DWARF_Info_CUHeader   t_cuheader;
+               } objfile;
+
                struct  {
-                       Byte    b_type;                 // st_info - Type and binding information.
-                       Byte    b_binding;              // st_info - Type and binding information.
-                       Byte    b_visibility;   // st_other - Reserved (not used).
-                       Word    w_secindex;             // st_shndx - Section index of symbol.
-               } symbol;
+                       DWord   dw_size;
+                       Byte    b_encoding;
+                       Byte    b_bit_offset;
+                       Byte    b_bit_size;
+                       Byte    b_endianity;
+                       Byte    b_addr_class;
+                       Byte    b_prototyped;
+               } type;
 
+               struct  {
+                       int             i_objid_parent;
+                       Byte    b_prototyped;
+                       Byte    b_external;
+                       Byte    b_inline;
+
+               } function;
        } info;
 
        struct  {
+               Byte    b_type;                 // st_info - Type and binding information.
+               Byte    b_binding;              // st_info - Type and binding information.
+               Byte    b_visibility;   // st_other - Reserved (not used).
+               Word    w_secindex;             // st_shndx - Section index of symbol.
+       } elfsym;
+
+       struct  {
                int             i_binfo_origin;
                int             i_dynsym_index;
 
@@ -184,8 +226,16 @@ typedef    struct  {
                int             i_objid_origin;
        } rel;
 
+       struct  {
+               Byte    *pb_info;
+
+               int             i_objid_type;
+               Byte    *pb_dwinfo_type;
+       } dwarf;
+
        int             i_secid;
        int             i_srcid;                // SourceInfo struct ID
+       DWord   dw_srcline;
 
        Byte    b_elf_flags;
        Word    w_secid;                // ==OLD== SectionInfo ItemIndex belong with this object.
@@ -202,10 +252,12 @@ typedef struct    {
 /*=====================================================================*/
 typedef struct {
        int             i_id;
-       DWord   dw_hash;
+       DWord   dw_hash_filename;
+       DWord   dw_hash_localpath;
        char    str_filename[DRD64_MAX_PATH];
        char    str_localpath[DRD64_MAX_PATH];
-       char    str_remotepath[DRD64_MAX_PATH];
+       char    str_srcpath[DRD64_MAX_PATH];    // for DW_AT_name
+       //char  str_buildpath[DRD64_MAX_PATH];  // for DW_AT_comp_dir (Optional)
 
        int             i_bfile_id;
        struct  {
@@ -269,8 +321,13 @@ typedef struct     {
                DWARF_AbbrevEntry       *p_abbrev;
                QWord                           qw_abbrev_unreadsz;
 
-               int                                     i_srcfiles;
-               
+               LibGoblin_Index_DWARFInfo       *p_offset;
+               int                                     i_alloced_offset;
+               int                                     i_max_offset;
+
+               int                                     i_objfiles;
+
+               int                                     i_maxvals;
        } dwarf;
 
        /* Binary-Format Depending Info. (ELF)*/
@@ -319,6 +376,10 @@ typedef struct     {
 #define        LIBGOBLIN_BINFO_FILE_DEBUG              2
 #define        LIBGOBLIN_BINFO_FILE_LIBRARY    -1
 
+#define        LIBGOBLIN_DWARF_ATTR_DEF_MAX    0x6f
+#define        LIBGOBLIN_DWARF_ATTR_EXT_MAX    53
+#define        LIBGOBLIN_DWARF_ATTR_MAX                (LIBGOBLIN_DWARF_ATTR_DEF_MAX + LIBGOBLIN_DWARF_ATTR_EXT_MAX)
+
 typedef struct {
        /* BinaryInfo Struct ID */
        int                     i_id;
@@ -357,6 +418,18 @@ typedef struct     {
        /* Binary-Format Depending Info. (ELF)*/
        //void          *p_format;
 
+       struct  {
+               int                                                     i_maxvals;
+               LibGoblin_DWARF_DIEValue        *p_infoval;
+
+               int                                                     i_extattrs;
+               LibGoblin_DWARF_Attribute       t_attr[LIBGOBLIN_DWARF_ATTR_MAX+1];
+
+               int                                                     i_alloc_srctbl;
+               int                                                     i_max_srctbl;
+               int                                                     *pi_srctbl; 
+       } dwarf;
+
 
 }      LibGoblin_BinaryInfo;
 
@@ -373,11 +446,11 @@ typedef   struct  {
                int                                             i_alloced;      // Alloced ObjectInfo
                int                                             i_used;         // ObjectInfo Items
                int                                             i_topid;        // Top-Ptr ObjectInfo
+
        } objinfo;
        LibGoblin_AddressInfo   *p_addrinfo;
        
        Word                                    dw_flag;
-
        int             i_binfo_id;
        int             i_binfo_id_core;