From 10ca0c35bb42e8f40536d363096c774a2781b3da Mon Sep 17 00:00:00 2001 From: "Koine Yuusuke(koinec)" Date: Wed, 21 Aug 2019 14:44:41 +0900 Subject: [PATCH] (LibGoblin) * WorkBackup --- libgoblin/drd64_libgoblin_dwarf_line.c | 82 +---------------------- libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c | 27 +++----- 2 files changed, 10 insertions(+), 99 deletions(-) diff --git a/libgoblin/drd64_libgoblin_dwarf_line.c b/libgoblin/drd64_libgoblin_dwarf_line.c index 9762b64..d98a7e2 100644 --- a/libgoblin/drd64_libgoblin_dwarf_line.c +++ b/libgoblin/drd64_libgoblin_dwarf_line.c @@ -40,100 +40,22 @@ Comment: /*---------------------------------------------------------------------- ----------------------------------------------------------------------*/ -/* -Byte * - LibGoblin_DwarfLine_Read_LineHeader_FileNameData( - LibGoblin_Dwarf_LineSection *pt_line, - Byte *pb_data, - QWord *pqw_remain, - int i_files ) -{ - QWord qw_qword; - Byte b_byte; - - // Read FileName --- - b_byte = *pb_data; - pt_line->t_filename[ i_files ].pstr_srcfilename - = (char *)(pb_data - 1); - while( ( 0 < *pqw_remain) && ('\0' != b_byte) ) { - (*pqw_remain)--; - b_byte = *pb_data++; - } - - // Read Directory Index --- - pb_data = DWARF_Common_DecodeULEB128( - &qw_qword, pb_data, pqw_remain ); - if( NULL == pb_data ) { return NULL; } - pt_line->t_filename[ i_files ].dw_dirindex = (DWord)qw_qword; - - // Read File-Date --- - pb_data = DWARF_Common_DecodeULEB128( - &qw_qword, pb_data, pqw_remain ); - if( NULL == pb_data ) { return NULL; } - pt_line->t_filename[ i_files ].qw_date = qw_qword; - - // Read File-Size --- - pb_data = DWARF_Common_DecodeULEB128( - &qw_qword, pb_data, pqw_remain ); - if( NULL == pb_data ) { return NULL; } - pt_line->t_filename[ i_files ].qw_filesize = qw_qword; - - return pb_data; -} -*/ - -/*---------------------------------------------------------------------- -----------------------------------------------------------------------*/ -/* -Byte * - LibGoblin_DwarfLine_Read_LineHeader_FileNames( - LibGoblin_Dwarf_LineSection *pt_line, - Byte *pb_data, - QWord *pqw_remain ) -{ - int i_files; - Byte b_byte; - - i_files = 0; - - if( 1 > (*pqw_remain)-- ) { return NULL; } - b_byte = *pb_data++; - - while( '\0' != b_byte) { - pb_data = LibGoblin_DwarfLine_Read_LineHeader_FileNameData( - pt_line, pb_data, pqw_remain, i_files ); - - if( 1 > (*pqw_remain)-- ) { return NULL; } - b_byte = *pb_data++; - - i_files++; - } - - pt_line->i_num_filename = i_files; - - return pb_data; -} -*/ - -/*---------------------------------------------------------------------- -----------------------------------------------------------------------*/ char * DWARF_Line_GetPath_fromLineHeader( Byte *pb_path, DWord dw_dirindex ) { char *pstr_path; - DWord dw_cnt; if( 0 == dw_dirindex ) { return NULL; } dw_dirindex--; - pstr_path = pb_path; + pstr_path = (char *)pb_path; while(( '\0' != *pb_path ) && ( 0 < dw_dirindex )) { while( '\0' != *pb_path++ ); - pstr_path = pb_path; + pstr_path = (char *)pb_path; dw_dirindex--; } diff --git a/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c b/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c index 5ce8f8c..cfaf5ca 100644 --- a/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c +++ b/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c @@ -76,7 +76,7 @@ int int i_cnt; int i_objid = NO_OBJ; char *pstr_filepath = NULL; - char *pstr_srcpath = NULL; + char *pstr_path = NULL; char str_filename[DRD64_MAX_PATH+1]; char str_path[DRD64_MAX_PATH+1]; DWord dw_lineoffset; @@ -113,8 +113,11 @@ int strncpy( str_path, pval_name->value.pstr_value, DRD64_MAX_PATH ); dirname( str_path ); - if(( '.' == str_path[0] ) && ( '\0' == str_path[1] )) - { str_path[0] = '\0'; } + pstr_path = str_path; + if(( '.' == str_path[0] ) && ( '\0' == str_path[1] )) { + str_path[0] = '\0'; + pstr_path = NULL; + } // Data Extract (location)--- [MUST] @@ -183,25 +186,11 @@ int // (Phase3) Regist SrcFile from .dwarf_line =================================== + p_srcfile = SrcFile_DispenseSrcFile( p_bfile, str_filename, pstr_path); + dw_lineoffset = pval_linestmt->value.dw_value; i_result = DWARF_Line_ReadSrcFile( p_binfo, dw_lineoffset ); -/* - p_val = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_name ); - if( NULL != p_val ) { pstr_srcpath = p_val->value.pstr_value; } - if( NULL == pstr_srcpath ) { - return 0x00; - } - - strncpy( str_temp, pstr_srcpath, DRD64_MAX_PATH ); - p_srcfile = SrcFile_DispenseSrcFile( p_bfile, basename( str_temp ), NULL ); - if( NULL == p_srcfile ) { - return 0x00; - } - - strncpy( p_srcfile->str_srcpath, dirname( str_temp ), DRD64_MAX_PATH ); -*/ - goto_DWARF_Tag_CompileUnit_compile_unit_post: return i_objid; } -- 2.11.0