{
int i_childlv;
int i_result;
+ int i_objid;
int i_objfiles;
int i_abbrevs;
Byte *pb_info;
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;
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 ---
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;
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 ----
/*
*/
goto_DWARF_Tag_CompileUnit_compile_unit_post:
- i_objid = 0;
return i_objid;
}
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)(
{ 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;
}
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.
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.
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.