OSDN Git Service

*** empty log message ***
authorkoinec <>
Sun, 30 Oct 2011 10:52:26 +0000 (10:52 +0000)
committerkoinec <>
Sun, 30 Oct 2011 10:52:26 +0000 (10:52 +0000)
libgoblin/drd64_libgoblin_dwarf_line.c

index e76828f..de876a5 100644 (file)
@@ -289,7 +289,7 @@ Byte *
                                        pt_line, pb_data, &qw_remain );
        if( NULL == pb_data )   { return NULL; }
        
-/*
+
        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 );
@@ -311,7 +311,7 @@ Byte *
                                                pt_line->t_filename[i_cnt].qw_date,
                                                pt_line->t_filename[i_cnt].qw_date );
        }
-*/
+
        *pqw_size_linesec       = qw_remain;
 
        return pb_data;
@@ -358,6 +358,29 @@ Int64
 /*----------------------------------------------------------------------
 ----------------------------------------------------------------------*/
 int    
+       LibGoblin_DwarfLine_DebugPrint_Register(
+               LibGoblin_Dwarf_Line_Register   *pt_reg )
+{
+       if( NULL == pt_reg )    {
+               puts(" Error: DebugRegister is NULL ");
+               return 0xff;
+       }
+
+       printf("  [Line] File:%3d, PC:%08lx, Line:%5ld, Col:%2ld, ISA:%2ld, Option: %s%s%s%s\n",
+                       pt_reg->dw_file, pt_reg->qw_address, pt_reg->qw_line,
+               pt_reg->qw_column,pt_reg->qw_isa,
+                       ((pt_reg->b_is_stmt != 0x00 ) ? "Stmt : " : "" ),
+                       ((pt_reg->b_basic_block != 0x00 ) ? "BasicBlk : " : "" ),
+                       ((pt_reg->b_prologue_end != 0x00 ) ? "PrologueEnd : " : "" ),
+                       ((pt_reg->b_epilogue_begin != 0x00 ) ? "EpilogueBegin" : "" ));
+
+       return 0x00;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+int    
        LibGoblin_DwarfLine_InitRegister(
                LibGoblin_Dwarf_Line_Register   *pt_reg, 
                LibGoblin_Dwarf_LineSection     *pt_line )
@@ -418,6 +441,7 @@ Byte *
                        /* dispatch for Extendee Opcode */
                        if( DW_LNE_end_sequence == b_opcode )   {
                                /* No Operand */
+                               puts("  DW_LNE_end_sequence <NoOperand>");
                                break;
                        }
                        else if( DW_LNE_set_address == b_opcode )       {
@@ -432,6 +456,7 @@ Byte *
                                                                        &dw_value, pb_data, pqw_remain );
                                        t_reg.qw_address        = (QWord)dw_value;
                                }
+                               printf("  DW_LNE_set_address %08lx\n", t_reg.qw_address );
                        }
                        else if( DW_LNE_define_file == b_opcode )       {
                                /* Operand: Filename Data Struct(Line Header) */
@@ -439,6 +464,7 @@ Byte *
                                                                pt_line, pb_data, pqw_remain,
                                                                pt_line->i_num_filename );
                                pt_line->i_num_filename++;
+                               printf("  DW_LNE_define_file \n");
                        }
                
                }
@@ -450,6 +476,7 @@ Byte *
                                        t_reg.b_basic_block             = 0x00;
                                        t_reg.b_prologue_end    = 0x00;
                                        t_reg.b_epilogue_begin  = 0x00;
+                                       puts("  DW_LNS_copy <NoOperand>");
                                        break;
 
                                case DW_LNS_advance_pc:                 /* 0x02 */
@@ -458,6 +485,7 @@ Byte *
                                                                        &qw_qword, pb_data, pqw_remain );
                                        t_reg.qw_address
                                                += pt_line->b_minimum_inst_length * qw_qword;
+                                       printf("  DW_LNS_advance_pc %08lx\n", qw_qword);
                                        
                                        break;
 
@@ -467,6 +495,7 @@ Byte *
                                                                        &ii_value, pb_data, pqw_remain );
                                        t_reg.qw_line
                                                = (QWord)((Int64)(t_reg.qw_line) + ii_value);
+                                       printf("  DW_LNS_advance_line %8ld\n", ii_value);
                                        break;
 
                                case DW_LNS_set_file:                   /* 0x04 */
@@ -474,7 +503,7 @@ Byte *
                                        pb_data = LibGoblin_DwarfCommon_Decode_ULEB128(
                                                                        &qw_qword, pb_data, pqw_remain );
                                        t_reg.dw_file   = (DWord)qw_qword;
-                                       
+                                       printf("  DW_LNS_set_file %ld\n", qw_qword);
                                        break;
 
                                case DW_LNS_set_column:                 /* 0x05 */
@@ -482,24 +511,27 @@ Byte *
                                        pb_data = LibGoblin_DwarfCommon_Decode_ULEB128(
                                                                        &qw_qword, pb_data, pqw_remain );
                                        t_reg.qw_column = qw_qword;
-                                       
+                                       printf("  DW_LNS_set_column %ld\n", qw_qword);
                                        break;
 
                                case DW_LNS_negate_stmt:                /* 0x06 */
                                        /* No Operand */
                                        t_reg.b_is_stmt
                                                = ((t_reg.b_is_stmt == 0x00) ? 0x01 : 0x00 );
+                                       puts("  DW_LNS_negate_stmt");
                                        break;
 
                                case DW_LNS_set_basic_block:    /* 0x07 */
                                        /* No Operand */
                                        t_reg.b_basic_block     = 0x01;
+                                       puts("  DW_LNS_set_basic_block");
                                        break;
 
                                case DW_LNS_const_add_pc:               /* 0x08 */
                                        qw_qword
                                                = LibGoblin_DwarfLine_CalcAddress( 0xff, pt_line);
                                        t_reg.qw_address        += qw_qword;
+                                       printf("  DW_LNS_const_add_pc %08lx\n", qw_qword);
                                        break;
 
                                case DW_LNS_fixed_advance_pc:   /* 0x09 */
@@ -507,14 +539,17 @@ Byte *
                                        pb_data = LibGoblin_DwarfCommon_Read_Word(
                                                                &w_value, pb_data, pqw_remain );
                                        t_reg.qw_address += (QWord)w_value;
+                                       printf("  DW_LNS_fixed_advance_pc %08lx\n", (QWord)w_value);
                                        break;
 
                                case DW_LNS_set_prologue_end:   /* 0x0a */
                                        t_reg.b_prologue_end    = 0x01;
+                                       puts("  DW_LNS_set_prologue_end");
                                        break;
 
                                case DW_LNS_set_epilogue_begin: /* 0x0b */
                                        t_reg.b_epilogue_begin  = 0x01;
+                                       puts("  DW_LNS_set_epilogue_begin");
                                        break;
 
                                case DW_LNS_set_isa:                    /* 0x0c */
@@ -522,6 +557,7 @@ Byte *
                                        pb_data = LibGoblin_DwarfCommon_Decode_ULEB128(
                                                                        &qw_qword, pb_data, pqw_remain );
                                        t_reg.qw_isa    += qw_qword;
+                                       printf("  DW_LNS_set_isa %08lx\n", qw_qword);
                                        break;
 
                                default:
@@ -533,11 +569,17 @@ Byte *
                        qw_qword = LibGoblin_DwarfLine_CalcAddress( b_opcode, pt_line);
                        ii_value = LibGoblin_DwarfLine_CalcLine( b_opcode, pt_line);
 
-                       t_reg.qw_address        += qw_qword;
+                       t_reg.qw_address        += (qw_qword * pt_line->b_minimum_inst_length);
                        t_reg.qw_line           = (QWord)((Int64)t_reg.qw_line + ii_value);
 
+                       t_reg.b_basic_block             = 0x00;
+                       t_reg.b_prologue_end    = 0x00;
+                       t_reg.b_epilogue_begin  = 0x00;
+
                }
 
+               LibGoblin_DwarfLine_DebugPrint_Register( &t_reg );
+
        }while( 0 != *pqw_remain );
 
        return pb_data;