OSDN Git Service

(LibGoblin)
authorKoine Yuusuke(koinec) <koinec@users.osdn.me>
Tue, 20 Aug 2019 11:43:20 +0000 (20:43 +0900)
committerKoine Yuusuke(koinec) <koinec@users.osdn.me>
Tue, 20 Aug 2019 11:43:20 +0000 (20:43 +0900)
  * WorkBackup

libgoblin/drd64_libgoblin_dwarf_info.c
libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c
libgoblin/drd64_libgoblin_dwarf_tag_dispatch.c
libgoblin/drd64_libgoblin_type.h

index 45f8478..5a5d18e 100644 (file)
@@ -217,6 +217,7 @@ int
 {
        int                                                     i_childlv;
        int                                                     i_result;
+       int                                                     i_objid;
        int                                                     i_objfiles;
        int                                                     i_abbrevs;
        Byte                                            *pb_info;
@@ -228,6 +229,8 @@ int
        QWord                                           qw_size_info;
        LibGoblin_SectionInfo           *psec_info;
        LibGoblin_BinaryFile            *p_bfile;
+       LibGoblin_ObjectInfo            *p_obj;
+       LibGoblin_ProgramInfo           *p_pginfo;
        DWARF_AbbrevEntry                       *p_abbrev;
        DWARF_AbbrevEntry                       *p_arvnow;
        LibGoblin_DWARF_Info_CUHeader   t_cuheader;
@@ -239,6 +242,9 @@ int
        p_bfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
        assert( NULL != p_bfile );
 
+       p_pginfo        = ProgInfo_GetProgInfo( p_binfo->i_pginfo );
+       assert( NULL != p_pginfo );
+
        i_objfiles      = p_bfile->dwarf.i_objfiles;
 
        // Get section Info ---
@@ -306,7 +312,17 @@ int
                                                        pb_info, &qw_size_cu, p_arvnow, p_binfo, &t_cuheader );
 
                        // Dispatch for generate Rapid-Access Table by DIE-tag
-                       i_result        = DWARF_Tag_Dispatch( p_binfo, p_arvnow, i_childlv, t_ancestry, &t_cuheader );
+                       i_objid = DWARF_Tag_Dispatch( p_binfo, p_arvnow, i_childlv, t_ancestry, &t_cuheader );
+
+                       // Set Compile-Unit data with  DW_TAG_compile_unit ---
+                       if(( DW_TAG_compile_unit == p_arvnow->dw_tag ) && ( NO_OBJ < i_objid )) {
+                               p_obj   = ObjectInfo_GetObjectInfo( p_pginfo, i_objid );
+                               assert( NULL != p_obj );
+                               assert( OBJINFO_TYPE_OBJFILE == p_obj->b_type );
+
+                               p_obj->info.objfile.i_abbrevs   = i_abbrevs;
+                               p_obj->info.objfile.p_abbrev    = p_abbrev;
+                       }
 
                        t_ancestry[i_childlv].pb_dwinfo = pb_now;
                        t_ancestry[i_childlv].i_objid   = i_result;
index 87cd77c..8957e71 100644 (file)
@@ -163,15 +163,17 @@ int
 
                p_obj->pstr_name        = pval_name->value.pstr_value;
                p_obj->dw_hash          = Common_CalcDJBhash( pval_name->value.pstr_value );
-               
-               if( 0 == i_cnt )        { p_obj_parent  = p_obj; }
-/*
-               printf("  DEBUG: [%d] %xh (%xh) %s\n", p_obj->i_id,
-                                                       t_ranges.ptr_low[i_cnt].value,
-                                                       (QWord)(t_ranges.ptr_high[i_cnt].value - t_ranges.ptr_low[i_cnt].value),
-                                                       pval_name->value.pstr_value );
-*/     
+
+               if( 0 == i_cnt )        {
+                       p_obj_parent    = p_obj;
+                       p_obj->info.objfile.i_objid_parent      = NO_OBJ;
+               }
+               else    {
+                       p_obj->info.objfile.i_objid_parent      = p_obj_parent->i_id;
+               }
        }
+       i_objid = p_obj_parent->i_id;
+
 
        // Regist SrcFile from .dwarf_line ----
 /*
@@ -191,7 +193,6 @@ int
 */
 
 goto_DWARF_Tag_CompileUnit_compile_unit_post:
-       i_objid = 0;
        return i_objid;
 }
 
index 8135f55..de9a5b3 100644 (file)
@@ -65,7 +65,7 @@ int
                LibGoblin_DWARF_Info_Ancestry   *p_ancestry,
                LibGoblin_DWARF_Info_CUHeader   *p_cuheader )
 {
-       int             i_result;
+       int             i_objid = NO_OBJ;
        DWord   dw_cnt;
        DWord   dw_tag;
        int     (* DWARF_Tag_Proc)(
@@ -91,9 +91,9 @@ int
                { DWARF_Tag_Proc        = DWARF_Tag_Dispatch_UnknownTag; }
 
        assert( NULL != DWARF_Tag_Proc );
-       i_result        = DWARF_Tag_Proc( dw_tag, p_binfo, i_childlv, p_ancestry, p_cuheader );
+       i_objid = DWARF_Tag_Proc( dw_tag, p_binfo, i_childlv, p_ancestry, p_cuheader );
 
-       return 0x00;
+       return i_objid;
 }
 
 
index 2c8c709..9f5975a 100644 (file)
@@ -155,10 +155,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.
@@ -166,6 +168,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.
@@ -176,6 +179,14 @@ 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.