OSDN Git Service

(LibGoblin)
[drdeamon64/drdeamon64.git] / libgoblin / drd64_libgoblin_type.h
index f5b04c4..99cbe01 100644 (file)
@@ -39,54 +39,18 @@ Comment:
 
 
 /*=====================================================================*/
-#define        DWARF_ABBREV_MAXITEMS   30
-
-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;
-
-
-/*=====================================================================*/
-#define        LIBGOBLIN_DWARF_INFO_TYPE_NONE          0x00
-#define        LIBGOBLIN_DWARF_INFO_TYPE_BYTE          0x01
-#define        LIBGOBLIN_DWARF_INFO_TYPE_WORD          0x02
-#define        LIBGOBLIN_DWARF_INFO_TYPE_DWORD         0x03
-#define        LIBGOBLIN_DWARF_INFO_TYPE_QWORD         0x04
-#define        LIBGOBLIN_DWARF_INFO_TYPE_INT64         0x05
-#define        LIBGOBLIN_DWARF_INFO_TYPE_POINTER       0x06
-#define        LIBGOBLIN_DWARF_INFO_TYPE_STRING        0x07
-#define        LIBGOBLIN_DWARF_INFO_TYPE_BLOCK         0x08
-#define        LIBGOBLIN_DWARF_INFO_TYPE_LINK          0x09
-
-typedef struct {
-       Byte    b_type;
-       QWord   qw_size;
-
-       union   {
-               Byte    b_value;
-               Word    w_value;
-               DWord   dw_value;
-               QWord   qw_value;
-               QWord   qw_link;
-               Int64   ii_value;
-               void    *p_value;
-               Byte    *pb_link;
-               char    *pstr_value;
-               Byte    *pb_data;               // for BlockData
-       } value;
-} LibGoblin_DWARF_DIEValue;
-
+/*
+typedef union  {
+       int             i_obj_id;
+       Byte    *pb_info;
+} LibGoblin_ObjInfo_Link;
+*/
 
 /*=====================================================================*/
-typedef struct {
-       DWord                           dw_attribute;
-       LibGoblin_DWARF_DIEValue        *p_val;
-} LibGoblin_DWARF_Attribute;
+typedef        struct  {
+       Byte    *pb_dwinfo;
+       int             i_obj_id;
+} LibGoblin_Index_DWARFInfo;
 
 
 /*=====================================================================*/
@@ -122,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;
@@ -150,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
@@ -158,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  {
@@ -181,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.
@@ -192,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.
@@ -202,16 +181,41 @@ typedef   struct  {
                        void    *pv_sechdr;
                } section;
 
+               // for OBJINFO_TYPE_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;
+                       int             i_objid_parent;
+                       int             i_abbrevs;
+                       DWARF_AbbrevEntry                               *p_abbrev;
+                       LibGoblin_DWARF_Info_CUHeader   t_cuheader;
+               } objfile;
 
+               struct  {
+                       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;
 
@@ -222,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.
@@ -245,7 +257,7 @@ typedef struct      {
        char    str_filename[DRD64_MAX_PATH];
        char    str_localpath[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)
+       //char  str_buildpath[DRD64_MAX_PATH];  // for DW_AT_comp_dir (Optional)
 
        int             i_bfile_id;
        struct  {
@@ -309,10 +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;
-               LibGoblin_DWARF_DIEValue        *p_infoval;
        } dwarf;
 
        /* Binary-Format Depending Info. (ELF)*/
@@ -361,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;
@@ -402,6 +421,13 @@ typedef struct     {
        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;
 
 
@@ -420,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;