p_binfile->dwarf.i_abbrevs_max = 0;
}
+ if( NULL != p_binfile->dwarf.p_offset )
+ { Index_DWARFInfo_Term( p_binfile ); }
+
memset( p_binfile, 0x00, sizeof( LibGoblin_BinaryFile ) );
p_binfile->i_id = -0x01;
p_binfile->srcfile.p_srcfile = NULL;
p_binfile->dwarf.p_abbrev = NULL;
+ p_binfile->dwarf.p_offset = NULL;
BinaryFile_ClearBinaryFile( p_binfile );
p_binfile->i_id = i_id_now;
p_binfile = BINFILE( i_cnt );
p_binfile->srcfile.p_srcfile = NULL;
p_binfile->dwarf.p_abbrev = NULL;
+ p_binfile->dwarf.p_offset = NULL;
BinaryFile_ClearBinaryFile( p_binfile );
}
psec_info = Section_GetSectionInfo( p_binfo, LIBGOBLIN_SECTION_ID_DEBUG_INFO );
assert( NULL != psec_info );
if( NULL == psec_info->pb_data ) {
- return 0x01;
+ return -0x01;
}
pb_info = psec_info->pb_data;
qw_size_info = psec_info->qw_size;
pb_custart = pb_info;
pb_info = DWARF_Info_ReadCUHeader( &t_cuheader, pb_info, &qw_size_info );
if( NULL == pb_info ) {
- return 0x02;
+ return -0x02;
}
t_cuheader.pb_custart = pb_custart;
memcpy( &(p_obj->info.objfile.t_cuheader), &t_cuheader,
sizeof( LibGoblin_DWARF_Info_CUHeader ) );
}
+
+ i_result = Index_DWARFInfo_RegistObjectInfo( p_binfo, p_obj, pb_now );
+ if( 0x00 != i_result ) {
+ return -0x03;
+ }
}
t_ancestry[i_childlv].pb_dwinfo = pb_now;
t_ancestry[i_childlv].i_objid = i_objid;
+
Debug_DWARF_PrintDIE( p_binfo, p_abbrev, dw_arvid, i_childlv );
DW_AT_name
DW_AT_encoding
DW_AT_byte_size
+ DW_AT_bit_size
+ DW_AT_bit_offset
+ DW_AT_start_scope
+ DW_AT_endianity
----------------------------------------------------------------------*/
LIBGOBLIN_DWARF_TAG_TYPE_EXTERN
int
LibGoblin_DWARF_DIEValue *pval_name;
LibGoblin_DWARF_DIEValue *pval_byte_size;
LibGoblin_DWARF_DIEValue *pval_encoding;
+ LibGoblin_DWARF_DIEValue *pval_bit_size;
+ LibGoblin_DWARF_DIEValue *pval_bit_offset;
+ LibGoblin_DWARF_DIEValue *pval_endianity;
+ LibGoblin_DWARF_DIEValue *pval_start_scope;
// Data Extract
- pval_name = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_name );
+ pval_name = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_name );
pval_byte_size = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_byte_size );
pval_encoding = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_encoding );
+ pval_bit_size = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_bit_size );
+ pval_bit_offset = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_bit_offset );
+ pval_endianity = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_endianity );
+ pval_start_scope= DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_start_scope );
i_obj_parent = p_ancestry[i_childlv - 1].i_objid;
p_pginfo = ProgInfo_GetProgInfo( p_binfo->i_pginfo );
assert( NULL != p_pginfo );
- pobj_parent = ObjectInfo_GetObjectInfo( p_pginfo, i_obj_parent );
- ptrval_start = pobj_parent->addr.ptr_addr.value;
+ if( NULL != pval_start_scope ) {
+ ptrval_start = pval_start_scope->value.qw_value;
+ pobj_parent = NULL;
+ }
+ else {
+ pobj_parent = ObjectInfo_GetObjectInfo( p_pginfo, i_obj_parent );
+ ptrval_start = pobj_parent->addr.ptr_addr.value;
+ }
pobj_now = ObjectInfo_InsetObject(
p_pginfo, ptrval_start, (QWord)0, pobj_parent,
return NO_OBJ;
}
- pobj_now->pstr_name = pval_name->value.pstr_value;
+ pobj_now->pstr_name = pval_name->value.pstr_value;
pobj_now->info.type.dw_size = (DWord)pval_byte_size->value.b_value;
pobj_now->info.type.b_encoding = pval_encoding->value.b_value;
+ if( NULL != pval_bit_size )
+ { pobj_now->info.type.b_bit_size = pval_bit_size->value.b_value; }
+ if( NULL != pval_bit_offset )
+ { pobj_now->info.type.b_bit_offset = pval_bit_offset->value.b_value; }
+ if( NULL != pval_endianity )
+ { pobj_now->info.type.b_endianity = pval_endianity->value.b_value; }
+
return pobj_now->i_id;
}
-
/* EOF of drd64_.c ----------------------------------- */
int i_start;
int i_end;
int i_now;
- LibGoblin_ProgramInfo *p_pginfo;
+ LibGoblin_BinaryFile *p_bfile;
LibGoblin_Index_DWARFInfo *p_offset;
LibGoblin_Index_DWARFInfo *p_offbase;
- p_pginfo = ProgInfo_GetProgInfo( p_binfo->i_pginfo );
- assert( NULL != p_pginfo );
+ p_bfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
+ assert( NULL != p_bfile );
- p_offbase = p_pginfo->objinfo.p_offset;
+ p_offbase = p_bfile->dwarf.p_offset;
i_start = 0;
- i_end = p_pginfo->objinfo.i_max_offset;
+ i_end = p_bfile->dwarf.i_max_offset;
do {
i_now = (i_start + i_end) / 2;
{
int i_result;
int i_items;
- LibGoblin_ProgramInfo *p_pginfo;
+ LibGoblin_BinaryFile *p_bfile;
LibGoblin_Index_DWARFInfo *p_offset;
LibGoblin_SectionInfo *psec_dwinfo;
- p_pginfo = ProgInfo_GetProgInfo( p_binfo->i_pginfo );
- assert( NULL != p_pginfo );
+ p_bfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
+ assert( NULL != p_bfile );
- if(( 0 < p_pginfo->objinfo.i_alloced_offset)
- && ( p_pginfo->objinfo.i_max_offset < p_pginfo->objinfo.i_alloced_offset)) {
- p_offset = p_pginfo->objinfo.p_offset;
+ if(( 0 < p_bfile->dwarf.i_alloced_offset)
+ && ( p_bfile->dwarf.i_max_offset < p_bfile->dwarf.i_alloced_offset)) {
+ p_offset = p_bfile->dwarf.p_offset;
}
else {
p_offset = NULL;
// Init. Alloced Offset Table Memory ---
- if( 0 == p_pginfo->objinfo.i_alloced_offset) {
+ if( 0 == p_bfile->dwarf.i_alloced_offset) {
psec_dwinfo = Section_GetSectionInfo( p_binfo, LIBGOBLIN_SECTION_ID_DEBUG_INFO );
assert( NULL != psec_dwinfo );
p_offset = (LibGoblin_Index_DWARFInfo *)
malloc( sizeof( LibGoblin_Index_DWARFInfo ) * i_items );
}
- else if( p_pginfo->objinfo.i_max_offset
- == p_pginfo->objinfo.i_alloced_offset) {
- i_items = p_pginfo->objinfo.i_alloced_offset
- + ( p_pginfo->objinfo.i_alloced_offset / 2 );
+ else if( p_bfile->dwarf.i_max_offset
+ == p_bfile->dwarf.i_alloced_offset) {
+ i_items = p_bfile->dwarf.i_alloced_offset
+ + ( p_bfile->dwarf.i_alloced_offset / 2 );
p_offset = (LibGoblin_Index_DWARFInfo *)
- realloc( p_pginfo->objinfo.p_offset, i_items );
+ realloc( p_bfile->dwarf.p_offset, i_items );
}
if( NULL == p_offset ) {
goto goto_Index_DWARFInfo_RegistObjectInfo_post;
}
- p_pginfo->objinfo.p_offset = p_offset;
- p_pginfo->objinfo.i_alloced_offset = i_items;
+ p_bfile->dwarf.p_offset = p_offset;
+ p_bfile->dwarf.i_alloced_offset = i_items;
}
- p_offset += p_pginfo->objinfo.i_max_offset;
+ p_offset += p_bfile->dwarf.i_max_offset;
p_offset->i_obj_id = p_objinfo->i_id;
p_offset->pb_dwinfo = pb_dwinfo;
- p_pginfo->objinfo.i_max_offset++;
+ p_bfile->dwarf.i_max_offset++;
goto_Index_DWARFInfo_RegistObjectInfo_post:
return 0x00;
LIBGOBLIN_INDEX_DWARFINFO_EXTERN
int
Index_DWARFInfo_Term(
- LibGoblin_ProgramInfo *p_pginfo,
- LibGoblin_ObjectInfo *p_objinfo )
+ LibGoblin_BinaryFile *p_bfile )
{
- if( NULL != p_pginfo->objinfo.p_offset ) {
- free( p_pginfo->objinfo.p_offset );
+ if( NULL != p_bfile->dwarf.p_offset ) {
+ free( p_bfile->dwarf.p_offset );
- p_pginfo->objinfo.p_offset = NULL;
- p_pginfo->objinfo.i_max_offset = 0;
- p_pginfo->objinfo.i_alloced_offset = 0;
+ p_bfile->dwarf.p_offset = NULL;
+ p_bfile->dwarf.i_max_offset = 0;
+ p_bfile->dwarf.i_alloced_offset = 0;
}
return 0x00;
LibGoblin_ObjectInfo *p_objinfo,
Byte *pb_dwinfo );
LIBGOBLIN_INDEX_DWARFINFO_EXTERN
- int Index_DWARFInfo_Term(
- LibGoblin_ProgramInfo *p_pginfo,
- LibGoblin_ObjectInfo *p_objinfo );
+ int Index_DWARFInfo_Term( LibGoblin_BinaryFile *p_bfile );
#endif /* DRD64_HEADER_LIBGOBLIN_BINFO */
struct {
DWord dw_size;
Byte b_encoding;
+ Byte b_bit_offset;
+ Byte b_bit_size;
+ Byte b_endianity;
LibGoblin_ObjInfo_Link t_link;
} type;
DWARF_AbbrevEntry *p_abbrev;
QWord qw_abbrev_unreadsz;
+ LibGoblin_Index_DWARFInfo *p_offset;
+ int i_alloced_offset;
+ int i_max_offset;
+
int i_objfiles;
int i_maxvals;
int i_used; // ObjectInfo Items
int i_topid; // Top-Ptr ObjectInfo
- LibGoblin_Index_DWARFInfo *p_offset;
- int i_alloced_offset;
- int i_max_offset;
} objinfo;
LibGoblin_AddressInfo *p_addrinfo;