From: Koine Yuusuke(koinec) Date: Wed, 21 Aug 2019 02:06:20 +0000 (+0900) Subject: (LibGoblin) X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=160c39f86bf6b633162e21c79d38365aa85d19b8;p=drdeamon64%2Fdrdeamon64.git (LibGoblin) * CreateFile: NEW drd64_libgoblin_dwarf_line.[ch] --- diff --git a/libgoblin/Makefile b/libgoblin/Makefile index 9b717f2..7207e45 100644 --- a/libgoblin/Makefile +++ b/libgoblin/Makefile @@ -73,6 +73,7 @@ OBJS = drd64_libgoblin_api.o \ drd64_libgoblin_dwarf_ranges.o \ drd64_libgoblin_dwarf_attrform.o \ drd64_libgoblin_dwarf_info.o \ + drd64_libgoblin_dwarf_line.o \ drd64_libgoblin_dwarf_oldline.o \ drd64_libgoblin_dwarf_tag_compileunit.o \ drd64_libgoblin_dwarf_tag_type.o \ @@ -118,6 +119,7 @@ HEADER = drd64_libgoblin.h \ drd64_libgoblin_dwarf_ranges.h \ drd64_libgoblin_dwarf_attrform.h \ drd64_libgoblin_dwarf_info.h \ + drd64_libgoblin_dwarf_line.h \ drd64_libgoblin_dwarf_oldline.h \ drd64_libgoblin_dwarf_tag_compileunit.h \ drd64_libgoblin_dwarf_tag_type.h \ @@ -252,6 +254,10 @@ drd64_libgoblin_dwarf_info.o: \ drd64_libgoblin_dwarf_info.c $(HEADER) $(CC) -c -o drd64_libgoblin_dwarf_info.o $(FLAGS_DEBUG) \ drd64_libgoblin_dwarf_info.c +drd64_libgoblin_dwarf_line.o: \ + drd64_libgoblin_dwarf_line.c $(HEADER) + $(CC) -c -o drd64_libgoblin_dwarf_line.o $(FLAGS_DEBUG) \ + drd64_libgoblin_dwarf_line.c drd64_libgoblin_dwarf_oldline.o: \ drd64_libgoblin_dwarf_oldline.c $(HEADER) $(CC) -c -o drd64_libgoblin_dwarf_oldline.o $(FLAGS_DEBUG) \ diff --git a/libgoblin/drd64_libgoblin.h b/libgoblin/drd64_libgoblin.h index 1302696..0ee9247 100644 --- a/libgoblin/drd64_libgoblin.h +++ b/libgoblin/drd64_libgoblin.h @@ -98,6 +98,7 @@ Comment: #include"drd64_libgoblin_dwarf_ranges.h" #include"drd64_libgoblin_dwarf_attrform.h" #include"drd64_libgoblin_dwarf_info.h" +#include"drd64_libgoblin_dwarf_line.h" #include"drd64_libgoblin_dwarf_oldline.h" #include"drd64_libgoblin_dwarf_tag_compileunit.h" #include"drd64_libgoblin_dwarf_tag_type.h" diff --git a/libgoblin/drd64_libgoblin_dwarf_info.c b/libgoblin/drd64_libgoblin_dwarf_info.c index 49bd2ef..a05e1b5 100644 --- a/libgoblin/drd64_libgoblin_dwarf_info.c +++ b/libgoblin/drd64_libgoblin_dwarf_info.c @@ -226,16 +226,21 @@ int // Dispatch for generate Rapid-Access Table by DIE-tag 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 )) { + // Set Compile-Unit data --- + if( 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; - memcpy( &(p_obj->info.objfile.t_cuheader), &t_cuheader, + p_obj->dwarf.pb_info = pb_now; + + if( DW_TAG_compile_unit == p_arvnow->dw_tag ) { + assert( OBJINFO_TYPE_OBJFILE == p_obj->b_type ); + + p_obj->info.objfile.i_abbrevs = i_abbrevs; + p_obj->info.objfile.p_abbrev = p_abbrev; + memcpy( &(p_obj->info.objfile.t_cuheader), &t_cuheader, sizeof( LibGoblin_DWARF_Info_CUHeader ) ); + } } t_ancestry[i_childlv].pb_dwinfo = pb_now; diff --git a/libgoblin/drd64_libgoblin_dwarf_line.c b/libgoblin/drd64_libgoblin_dwarf_line.c new file mode 100644 index 0000000..2f2d6e0 --- /dev/null +++ b/libgoblin/drd64_libgoblin_dwarf_line.c @@ -0,0 +1,372 @@ +/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64 + + D r . D e a m o n 6 4 + for INTEL64(R), AMD64(R) + + Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/ + +/* File Info ----------------------------------------------------------- +File: drd64_.c +Function: +Comment: +----------------------------------------------------------------------*/ + +#define DRD64_SRC_LIBGOBLIN_DWARF_LINE +#include"drd64_libgoblin.h" + + +/*---------------------------------------------------------------------- +----------------------------------------------------------------------*/ +/* +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; +} +*/ + +/*---------------------------------------------------------------------- +----------------------------------------------------------------------*/ +/* +Byte * + LibGoblin_DwarfLine_Read_LineHeader_IncludePath( + LibGoblin_Dwarf_LineSection *pt_line, + Byte *pb_data, + QWord *qw_remain ) +{ + int i_cnt; + Byte b_byte; + + i_cnt = 0; + + if( 1 > (*qw_remain)-- ) { return NULL; } + pt_line->pstr_includepath = (char *)pb_data; + b_byte = *pb_data++; + + while( '\0' != b_byte ) { + if( 1 > (*qw_remain)-- ) { return NULL; } + b_byte = *pb_data++; + + if( '\0' == b_byte ) { + if( 1 > (*qw_remain)-- ) { return NULL; } + b_byte = *pb_data++; + i_cnt++; + } + } + pt_line->i_num_includepath = i_cnt; + + return pb_data; +} +*/ + +/*---------------------------------------------------------------------- +----------------------------------------------------------------------*/ +Byte * + DWARF_Line_Read_LineHeader( + LibGoblin_DWARF_Line_Header *pt_line, + Byte *pb_data, + QWord *pqw_size_linesec ) +{ + int i_bitflag; + int i_cnt; + Byte b_byte; + DWord dw_dword; + QWord qw_qword; + QWord qw_remain; + + assert( NULL != pt_line ); + assert( NULL != pb_data ); + + i_bitflag = 32; + pt_line->b_bits = 32; + qw_remain = *pqw_size_linesec; + + // Read unit_length (4Byte(32bit) or 8Byte(64bit)) --- + pb_data = DWARF_Common_Read_DWord( &dw_dword, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + if( ((DWord)0xffffffff) == dw_dword ) { + pb_data = DWARF_Common_Read_QWord( &qw_qword, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + i_bitflag = 64; + pt_line->b_bits = 64; + qw_remain = qw_qword; + } + else { + qw_remain = (QWord)dw_dword; + } + + // Read version (2Byte) --- + pb_data = DWARF_Common_Read_Word( &(pt_line->w_version), pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + // Read Header Length (4Byte(32bit), 8Byte(64bit)) --- + if( 64 == i_bitflag ) { + pb_data = DWARF_Common_Read_QWord( &qw_qword, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + pt_line->qw_headerlength = qw_qword; + } + else { + pb_data = DWARF_Common_Read_DWord( &dw_dword, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + pt_line->qw_headerlength = (QWord)dw_dword; + } + + // Read minimum Instruction Length (1Byte) --- + pb_data = DWARF_Common_Read_Byte( + &(pt_line->b_minimum_inst_length), pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + // Read default isStatement (1Byte) --- + pb_data = DWARF_Common_Read_Byte( + &(pt_line->b_default_is_stmt), pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + // Read LineBase (1Byte) --- + pb_data = DWARF_Common_Read_Byte( &b_byte, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + pt_line->i_line_base = (INT)((char)b_byte); + + // Read LineRange (1Byte) --- + pb_data = DWARF_Common_Read_Byte( &b_byte, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + pt_line->i_line_range = (INT)((DWord)b_byte); + + // Read Opcode Base (1Byte) --- + pb_data = DWARF_Common_Read_Byte( + &(pt_line->b_opcode_base), pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } + + // Read Operand length of the Standard Opecode --- + for( i_cnt = 1; i_cnt < (pt_line->b_opcode_base); i_cnt++) { + pb_data = DWARF_Common_DecodeULEB128( &qw_qword, pb_data, &qw_remain ); + pt_line->dw_stdoperand_length[i_cnt] = (int)((DWord)qw_qword); + } + + // Read FileNames --- +/* + pb_data = LibGoblin_DwarfLine_Read_LineHeader_FileNames( + pt_line, pb_data, &qw_remain ); + if( NULL == pb_data ) { return NULL; } +*/ + + printf(" Length: %ld \n", qw_remain ); + printf(" version: %d \n", pt_line->w_version ); + printf(" header length: %ld\n", pt_line->qw_headerlength ); + printf(" min. Inst. length: %d\n", pt_line->b_minimum_inst_length ); + printf(" default isStmt: %x\n", pt_line->b_default_is_stmt ); + printf(" line_base: %d\n", pt_line->i_line_base ); + printf(" line_range: %d\n", pt_line->i_line_range ); + printf(" opcode_base: %d\n", pt_line->b_opcode_base ); + for( i_cnt = 1; i_cnt < pt_line->b_opcode_base; i_cnt++ ) { + printf(" Std.Operand(%x) : %d \n", i_cnt, + pt_line->dw_stdoperand_length[i_cnt] ); + } +/* + printf(" include path nums: %d\n", pt_line->i_num_includepath ); + printf(" include file nums: %d\n", pt_line->i_num_filename ); + for( i_cnt = 0; i_cnt < pt_line->i_num_filename; i_cnt++ ) { + printf(" SrcFile[%d] filename: %s Dir.Index: %d Date: %ld Size: %ld \n", + i_cnt, + pt_line->t_filename[i_cnt].pstr_srcfilename, + pt_line->t_filename[i_cnt].dw_dirindex, + pt_line->t_filename[i_cnt].qw_date, + pt_line->t_filename[i_cnt].qw_date ); + } +*/ + *pqw_size_linesec = qw_remain; + + return pb_data; +} + + +/*---------------------------------------------------------------------- +----------------------------------------------------------------------*/ +LIBGOBLIN_DWARF_LINE_EXTERN +int + DWARF_Line_ReadSrcFile( + LibGoblin_BinaryInfo *p_binfo, + DWord dw_offset ) +{ + int i_pos; + int i_path; + int i_files; + Byte b_byte; + Byte *pb_line; + DWord dw_dirindex; + QWord qw_qword; + QWord qw_date; + QWord qw_filesize; + QWord qw_remain; + char str_filename[DRD64_MAX_PATH + 1]; + LibGoblin_SectionInfo *psec_line; + LibGoblin_DWARF_Line_Header t_linehdr; + + psec_line = Section_GetSectionInfo( p_binfo, LIBGOBLIN_SECTION_ID_DEBUG_LINE ); + assert( NULL != psec_line ); + + pb_line = psec_line->pb_data + dw_offset; + qw_remain = psec_line->qw_size - dw_offset; + + // (Phase1) Read .debug_line Header =============================== + pb_line = DWARF_Line_Read_LineHeader( &t_linehdr, pb_line, &qw_remain ); + t_linehdr.pb_path = pb_line; + + + // (Phase2) Skip Path Section in .debug_line Header =============== + i_path = 0; + + if( 1 > qw_remain-- ) { return NULL; } + b_byte = *pb_line++; + + while( '\0' != b_byte ) { + if( 1 > qw_remain-- ) { return NULL; } + b_byte = *pb_line++; + + if( '\0' == b_byte ) { + if( 1 > qw_remain-- ) { return NULL; } + b_byte = *pb_line++; + i_path++; + } + } + t_linehdr.i_path = i_path; + //printf(" path nums: %d\n", t_linehdr.i_path ); + + + // (Phase3) Read FileName Section in .debug_line Header =========== + if( 1 > qw_remain-- ) { return NULL; } + b_byte = *pb_line++; + + i_files = 0; + while( '\0' != b_byte) { + // Read FileName --- + i_pos = 0; + while( ( 0 < qw_remain) && ('\0' != b_byte) ) { + str_filename[i_pos++] = (char)b_byte; + b_byte = *pb_line++; + qw_remain--; + } + str_filename[i_pos++] = (char)b_byte; + + // Read Directory Index --- + pb_line = DWARF_Common_DecodeULEB128( &qw_qword, pb_line, &qw_remain ); + if( NULL == pb_line ) { return NULL; } + dw_dirindex = (DWord)qw_qword; + + // Read File-Date --- + pb_line = DWARF_Common_DecodeULEB128( &qw_qword, pb_line, &qw_remain ); + if( NULL == pb_line ) { return NULL; } + qw_date = qw_qword; + + // Read File-Size --- + pb_line = DWARF_Common_DecodeULEB128( &qw_qword, pb_line, &qw_remain ); + if( NULL == pb_line ) { return NULL; } + qw_filesize = qw_qword; + + printf(" SrcFile[%2d] %30s Dir.Index: %d Date: %ld Size: %ld \n", + i_files, str_filename, dw_dirindex, qw_date, qw_filesize ); + + i_files++; + + if( 1 > qw_remain-- ) { return NULL; } + b_byte = *pb_line++; + } + + return 0x00; +} + + +/* EOF of drd64_.c ----------------------------------- */ diff --git a/libgoblin/drd64_libgoblin_dwarf_line.h b/libgoblin/drd64_libgoblin_dwarf_line.h new file mode 100644 index 0000000..a272a21 --- /dev/null +++ b/libgoblin/drd64_libgoblin_dwarf_line.h @@ -0,0 +1,54 @@ +/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64 + + D r . D e a m o n 6 4 + for INTEL64(R), AMD64(R) + + Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/ + +/* File Info ----------------------------------------------------------- +File: drd64_.h +Function: Header +Comment: +----------------------------------------------------------------------*/ + +#ifndef DRD64_HEADER_LIBGOBLIN_DWARF_LINE +#define DRD64_HEADER_LIBGOBLIN_DWARF_LINE + +#include"drd64_libgoblin.h" + +#ifdef DRD64_SRC_LIBGOBLIN_DWARF_LINE + #define LIBGOBLIN_DWARF_LINE_EXTERN +#else + #define LIBGOBLIN_DWARF_LINE_EXTERN extern +#endif + +LIBGOBLIN_DWARF_LINE_EXTERN + int DWARF_Line_ReadSrcFile( LibGoblin_BinaryInfo *p_binfo, DWord dw_offset ); + + +#endif /* DRD64_HEADER_LIBGOBLIN_DWARF_LINE */ + +/* EOF of drd64_.h ----------------------------------- */ diff --git a/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c b/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c index 8957e71..5ce8f8c 100644 --- a/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c +++ b/libgoblin/drd64_libgoblin_dwarf_tag_compileunit.c @@ -79,11 +79,12 @@ int char *pstr_srcpath = NULL; char str_filename[DRD64_MAX_PATH+1]; char str_path[DRD64_MAX_PATH+1]; + DWord dw_lineoffset; QWord qw_low_pc; QWord qw_high_pc; LibGoblin_SrcFile *p_srcfile; LibGoblin_BinaryFile *p_bfile; - LibGoblin_DWARF_DIEValue *p_val; + LibGoblin_DWARF_DIEValue *pval_linestmt; LibGoblin_DWARF_DIEValue *pval_name; LibGoblin_DWARF_DIEValue *pval_lowpc; LibGoblin_DWARF_DIEValue *pval_highpc; @@ -98,6 +99,7 @@ int p_bfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile ); assert( NULL != p_bfile ); + // (Phase1) Data Extract from .debug_info =============================== // Data Extract (DW_AT_name)--- [MUST] pval_name = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_name ); @@ -149,8 +151,13 @@ int else { goto goto_DWARF_Tag_CompileUnit_compile_unit_post; } + // Data Extract (stmt_list)--- + pval_linestmt = DWARF_AttrForm_GetDIEValue( p_binfo, DW_AT_stmt_list ); + if( NULL == pval_linestmt ) + { goto goto_DWARF_Tag_CompileUnit_compile_unit_post; } + - // Regist ObjInfo as ObjFile --- + // (Phase2) Regist ObjInfo as ObjFile ========================================= p_pginfo = ProgInfo_GetProgInfo( p_binfo->i_pginfo ); assert( NULL != p_pginfo ); @@ -175,7 +182,10 @@ int i_objid = p_obj_parent->i_id; - // Regist SrcFile from .dwarf_line ---- + // (Phase3) Regist SrcFile from .dwarf_line =================================== + 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; } diff --git a/libgoblin/drd64_libgoblin_dwarf_tag_dispatch.c b/libgoblin/drd64_libgoblin_dwarf_tag_dispatch.c index de9a5b3..3971b12 100644 --- a/libgoblin/drd64_libgoblin_dwarf_tag_dispatch.c +++ b/libgoblin/drd64_libgoblin_dwarf_tag_dispatch.c @@ -73,7 +73,6 @@ int int i_childlv, LibGoblin_DWARF_Info_Ancestry *p_ancestry, LibGoblin_DWARF_Info_CUHeader *p_cuheader ); -//printf("debug: %d\n", (p_ancestry + 10)->i_objid); DWARF_Tag_Proc = NULL; dw_tag = p_abbrev->dw_tag; diff --git a/libgoblin/drd64_libgoblin_type.h b/libgoblin/drd64_libgoblin_type.h index 9f5975a..c40c244 100644 --- a/libgoblin/drd64_libgoblin_type.h +++ b/libgoblin/drd64_libgoblin_type.h @@ -212,7 +212,10 @@ typedef struct { int i_objid_origin; } rel; - Byte *pb_dwarf_info; + struct { + Byte *pb_info; + + } dwarf; int i_secid; int i_srcid; // SourceInfo struct ID diff --git a/libgoblin/drd64_libgoblin_type_dwarf.h b/libgoblin/drd64_libgoblin_type_dwarf.h index 6ac3d5b..1f59f1b 100644 --- a/libgoblin/drd64_libgoblin_type_dwarf.h +++ b/libgoblin/drd64_libgoblin_type_dwarf.h @@ -39,6 +39,58 @@ Comment: /*=====================================================================*/ +/* +typedef struct { + QWord qw_address; + QWord qw_line; + DWord dw_file; + Byte b_is_stmt; + Byte b_basic_block; + Byte b_prologue_end; + Byte b_epilogue_begin; + QWord qw_column; + QWord qw_isa; +} LibGoblin_Dwarf_Line_Register; +*/ + +/*=====================================================================*/ +/* +typedef struct { + char *pstr_srcfilename; + DWord dw_dirindex; + QWord qw_date; + QWord qw_filesize; +} LibGoblin_Dwarf_Line_FileNames; +*/ + +/*=====================================================================*/ +#define DWARF_LINE_MAX_STDOPERANDS 32 +//#define LIBGOBLIN_DWARF_OLDLINE_MAX_SRCFILES 512 + +typedef struct { + Word w_version; + Byte b_bits; + QWord qw_headerlength; + Byte b_minimum_inst_length; + Byte b_default_is_stmt; + INT i_line_base; + INT i_line_range; + Byte b_opcode_base; + DWord dw_stdoperand_length[DWARF_LINE_MAX_STDOPERANDS]; + + int i_path; + Byte *pb_path; + + + //int i_num_includepath; + //char *pstr_includepath; + //int i_num_filename; + //LibGoblin_Dwarf_Line_FileNames t_filename[LIBGOBLIN_DWARF_OLDLINE_MAX_SRCFILES]; + +} LibGoblin_DWARF_Line_Header; + + +/*=====================================================================*/ #define DWARF_RANGES_MAX 32 typedef struct {