OSDN Git Service

(LibGoblin)
[drdeamon64/drdeamon64.git] / libgoblin / drd64_libgoblin_dwarf_tag_function.c
index d44c57a..eea488d 100644 (file)
@@ -98,13 +98,15 @@ int
 
        int                                                     i_result;
        int                                                     i_cnt;
+       int                                                     i_srcid                 = NO_SRC;
        int                                                     i_objid                 = NO_OBJ;
        int                                                     i_objid_parent  = NO_OBJ;
        char                                            *pstr_filepath  = NULL;
-       char                                            *pstr_path   = NULL;
+       char                                            *pstr_path              = NULL;
        char                                            *pstr_filename;
        char                                            str_filename[DRD64_MAX_PATH+1];
        char                                            str_path[DRD64_MAX_PATH+1];
+       DWord                                           dw_srcline              = 0;
        DWord                                           dw_lineoffset;
        QWord                                           qw_low_pc;
        QWord                                           qw_high_pc;
@@ -143,6 +145,7 @@ int
        pval_inline             = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_inline );
        pval_declfile   = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_decl_file );
        pval_declline   = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_decl_line );
+       // UnImplement
        pval_prototyped = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_prototyped );
        pval_external   = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_external );
        pval_entry_pc   = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_entry_pc );
@@ -199,7 +202,19 @@ int
                t_ranges.ptr_high[0].value      = (PtrValue)pobj_parent->addr.ptr_addr.value;
        }
        
+       if( NULL != pval_declfile )     {
+               DWARF_AttrForm_ExtensionDIEValue( pval_declfile );
+               i_srcid = SrcFile_GetSrcFileTable_inBinaryInfo(
+                                                               p_binfo, (int)pval_declfile->value.qw_value );
+       }
+
+       if( NULL != pval_declline ) {
+               DWARF_AttrForm_ExtensionDIEValue( pval_declline );
+               dw_srcline      = (DWord)pval_declline->value.qw_value;
+       }
 
+
+       // Inset & Regist. ObjectInfo ------------------------------------
        for( i_cnt = 0; i_cnt < t_ranges.i_ranges; i_cnt++ )    {
                pobj_now        = ObjectInfo_InsetObject(
                                                p_pginfo, t_ranges.ptr_low[i_cnt].value,
@@ -208,51 +223,21 @@ int
                                                OBJINFO_INSETMODE_INSET | OBJINFO_INSETMODE_ADOPT | OBJINFO_INSETMODE_CHKNAME,
                                                OBJINFO_TYPE_FUNCTION, pval_name->value.pstr_value );
 
-               //p_obj->pstr_name      = pval_name->value.pstr_value;
-               //p_obj->dw_hash                = Common_CalcDJBhash( pval_name->value.pstr_value );
-
-               // XXX: TODO(2019/10/15) Backup & Restore  elf-symbol info.
+               pobj_now->i_srcid               = i_srcid;
+               pobj_now->dw_srcline    = dw_srcline;
 
                if( 0 == i_cnt )        {
                        pobj_parent     = pobj_now;
-                       //pobj_now->info.function.i_objid_parent        = NO_OBJ;
+                       pobj_now->info.function.i_objid_parent  = NO_OBJ;
                }
                else    {
-                       //pobj_now->info.function.i_objid_parent        = p_obj_parent->i_id;
+                       pobj_now->info.function.i_objid_parent  = pobj_parent->i_id;
                }
-               //p_obj->i_srcid        = p_srcfile->i_id;
        }
 
 /*
        p_bfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
        assert( NULL != p_bfile );
-
-
-       // (Phase3) Regist ObjInfo as ObjFile =========================================
-
-       for( i_cnt = 0; i_cnt < t_ranges.i_ranges; i_cnt++ )    {
-               p_obj   = ObjectInfo_InsetObject(
-                                                       p_pginfo, t_ranges.ptr_low[i_cnt].value,
-                                                       (QWord)(t_ranges.ptr_high[i_cnt].value - t_ranges.ptr_low[i_cnt].value),
-                                                       NULL, OBJINFO_INSETMODE_INSET | OBJINFO_INSETMODE_ADOPT,
-                                                       OBJINFO_TYPE_OBJFILE, NULL );
-
-               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;
-                       p_obj->info.objfile.i_objid_parent      = NO_OBJ;
-               }
-               else    {
-                       p_obj->info.objfile.i_objid_parent      = p_obj_parent->i_id;
-               }
-               p_obj->i_srcid  = p_srcfile->i_id;
-       }
-       i_objid = p_obj_parent->i_id;
-
-goto_DWARF_Tag_CompileUnit_compile_unit_post:
-
 */
 goto_DWARF_Tag_Function_subprogram_post:
        printf( "  UnImplement DW_TAG_subprogram: %s [%02xh]\n",