Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 265

Show
Ignore:
Timestamp:
11/22/09 19:52:11 (15 years ago)
Author:
walter
Message:

bugzilla 3540

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/backend/dwarf.c

    r220 r265  
    619619        ; 
    620620    } 
    621621    } 
    622622    linebuf->writeByte(0);      // end of file_names 
    623623 
    624624    debugline.prologue_length = linebuf->size() - 10; 
    625625 
    626626    for (unsigned seg = 1; seg <= seg_count; seg++) 
    627627    { 
    628628    seg_data *sd = SegData[seg]; 
    629629    unsigned addressmax = 0; 
    630630    unsigned linestart = ~0; 
    631631 
    632632    if (!sd->SDlinnum_count) 
    633633        continue; 
    634634#if ELFOBJ 
    635635    if (!sd->SDsym) // gdb ignores line number data without a DW_AT_name 
    636636        continue; 
    637637#endif 
    638638 
    639     // Set address to start of segment with DW_LNE_set_address 
    640     linebuf->writeByte(0); 
    641     linebuf->writeByte(5); 
    642     linebuf->writeByte(2); 
    643     dwarf_addrel(lineseg,linebuf->size(),seg); 
    644     linebuf->write32(0); 
    645  
    646639    //printf("sd = %x, SDlinnum_count = %d\n", sd, sd->SDlinnum_count); 
    647640    for (int i = 0; i < sd->SDlinnum_count; i++) 
    648641    {   linnum_data *ld = &sd->SDlinnum_data[i]; 
     642 
     643        // Set address to start of segment with DW_LNE_set_address 
     644        linebuf->writeByte(0); 
     645        linebuf->writeByte(5); 
     646        linebuf->writeByte(2); 
     647        dwarf_addrel(lineseg,linebuf->size(),seg); 
     648        linebuf->write32(0); 
    649649 
    650650        // Dwarf2 6.2.2 State machine registers 
    651651        unsigned address = 0;   // instruction address 
    652652        unsigned file = ld->filenumber; 
    653653        unsigned line = 1;      // line numbers beginning with 1 
    654654        unsigned column = 0;    // column number, leftmost column is 1 
    655655        int is_stmt = debugline.default_is_stmt;    // TRUE if beginning of a statement 
    656656        int basic_block = FALSE;  // TRUE if start of basic block 
    657657        int end_sequence = FALSE; // TRUE if address is after end of sequence 
    658658 
    659659        linebuf->writeByte(DW_LNS_set_file); 
    660660        linebuf->writeuLEB128(file); 
    661661 
    662662        for (int j = 0; j < ld->linoff_count; j++) 
    663663        {   int lininc = ld->linoff[j][0] - line; 
    664664        int addinc = ld->linoff[j][1] - address; 
    665665 
    666666        //printf("\tld[%d] line = %d offset = x%x lininc = %d addinc = %d\n", j, ld->linoff[j][0], ld->linoff[j][1], lininc, addinc); 
    667667 
    668668        //assert(addinc >= 0); 
     
    682682                    debugline.opcode_base; 
    683683 
    684684            if (opcode <= 255) 
    685685            {   linebuf->writeByte(opcode); 
    686686            continue; 
    687687            } 
    688688        } 
    689689        if (lininc) 
    690690        { 
    691691            linebuf->writeByte(DW_LNS_advance_line); 
    692692            linebuf->writesLEB128((long)lininc); 
    693693        } 
    694694        if (addinc) 
    695695        { 
    696696            linebuf->writeByte(DW_LNS_advance_pc); 
    697697            linebuf->writeuLEB128((unsigned long)addinc); 
    698698        } 
    699699        if (lininc || addinc) 
    700700            linebuf->writeByte(DW_LNS_copy); 
    701701        } 
     702 
     703        // Write DW_LNE_end_sequence 
     704        linebuf->writeByte(0); 
     705        linebuf->writeByte(1); 
     706        linebuf->writeByte(1); 
    702707    } 
    703  
    704     // Write DW_LNE_end_sequence 
    705     linebuf->writeByte(0); 
    706     linebuf->writeByte(1); 
    707     linebuf->writeByte(1); 
    708708    } 
    709709 
    710710    debugline.total_length = linebuf->size() - 4; 
    711711    memcpy(linebuf->buf, &debugline, sizeof(debugline)); 
    712712 
    713713    /* ================================================= */ 
    714714 
    715715    abbrevbuf->writeByte(0); 
    716716 
    717717    /* ================================================= */ 
    718718 
    719719    infobuf->writeByte(0);  // ending abbreviation code 
    720720 
    721721    debuginfo.total_length = infobuf->size() - 4; 
    722722    memcpy(infobuf->buf, &debuginfo, sizeof(debuginfo)); 
    723723 
    724724    /* ================================================= */ 
    725725 
    726726    // Terminate by offset field containing 0 
    727727    debug_pubnames_buf->write32(0); 
  • trunk/src/backend/dwarf.c

    r218 r265  
    619619        ; 
    620620    } 
    621621    } 
    622622    linebuf->writeByte(0);      // end of file_names 
    623623 
    624624    debugline.prologue_length = linebuf->size() - 10; 
    625625 
    626626    for (unsigned seg = 1; seg <= seg_count; seg++) 
    627627    { 
    628628    seg_data *sd = SegData[seg]; 
    629629    unsigned addressmax = 0; 
    630630    unsigned linestart = ~0; 
    631631 
    632632    if (!sd->SDlinnum_count) 
    633633        continue; 
    634634#if ELFOBJ 
    635635    if (!sd->SDsym) // gdb ignores line number data without a DW_AT_name 
    636636        continue; 
    637637#endif 
    638638 
    639     // Set address to start of segment with DW_LNE_set_address 
    640     linebuf->writeByte(0); 
    641     linebuf->writeByte(5); 
    642     linebuf->writeByte(2); 
    643     dwarf_addrel(lineseg,linebuf->size(),seg); 
    644     linebuf->write32(0); 
    645  
    646639    //printf("sd = %x, SDlinnum_count = %d\n", sd, sd->SDlinnum_count); 
    647640    for (int i = 0; i < sd->SDlinnum_count; i++) 
    648641    {   linnum_data *ld = &sd->SDlinnum_data[i]; 
     642 
     643        // Set address to start of segment with DW_LNE_set_address 
     644        linebuf->writeByte(0); 
     645        linebuf->writeByte(5); 
     646        linebuf->writeByte(2); 
     647        dwarf_addrel(lineseg,linebuf->size(),seg); 
     648        linebuf->write32(0); 
    649649 
    650650        // Dwarf2 6.2.2 State machine registers 
    651651        unsigned address = 0;   // instruction address 
    652652        unsigned file = ld->filenumber; 
    653653        unsigned line = 1;      // line numbers beginning with 1 
    654654        unsigned column = 0;    // column number, leftmost column is 1 
    655655        int is_stmt = debugline.default_is_stmt;    // TRUE if beginning of a statement 
    656656        int basic_block = FALSE;  // TRUE if start of basic block 
    657657        int end_sequence = FALSE; // TRUE if address is after end of sequence 
    658658 
    659659        linebuf->writeByte(DW_LNS_set_file); 
    660660        linebuf->writeuLEB128(file); 
    661661 
    662662        for (int j = 0; j < ld->linoff_count; j++) 
    663663        {   int lininc = ld->linoff[j][0] - line; 
    664664        int addinc = ld->linoff[j][1] - address; 
    665665 
    666666        //printf("\tld[%d] line = %d offset = x%x lininc = %d addinc = %d\n", j, ld->linoff[j][0], ld->linoff[j][1], lininc, addinc); 
    667667 
    668668        //assert(addinc >= 0); 
     
    682682                    debugline.opcode_base; 
    683683 
    684684            if (opcode <= 255) 
    685685            {   linebuf->writeByte(opcode); 
    686686            continue; 
    687687            } 
    688688        } 
    689689        if (lininc) 
    690690        { 
    691691            linebuf->writeByte(DW_LNS_advance_line); 
    692692            linebuf->writesLEB128((long)lininc); 
    693693        } 
    694694        if (addinc) 
    695695        { 
    696696            linebuf->writeByte(DW_LNS_advance_pc); 
    697697            linebuf->writeuLEB128((unsigned long)addinc); 
    698698        } 
    699699        if (lininc || addinc) 
    700700            linebuf->writeByte(DW_LNS_copy); 
    701701        } 
     702 
     703        // Write DW_LNE_end_sequence 
     704        linebuf->writeByte(0); 
     705        linebuf->writeByte(1); 
     706        linebuf->writeByte(1); 
    702707    } 
    703  
    704     // Write DW_LNE_end_sequence 
    705     linebuf->writeByte(0); 
    706     linebuf->writeByte(1); 
    707     linebuf->writeByte(1); 
    708708    } 
    709709 
    710710    debugline.total_length = linebuf->size() - 4; 
    711711    memcpy(linebuf->buf, &debugline, sizeof(debugline)); 
    712712 
    713713    /* ================================================= */ 
    714714 
    715715    abbrevbuf->writeByte(0); 
    716716 
    717717    /* ================================================= */ 
    718718 
    719719    infobuf->writeByte(0);  // ending abbreviation code 
    720720 
    721721    debuginfo.total_length = infobuf->size() - 4; 
    722722    memcpy(infobuf->buf, &debuginfo, sizeof(debuginfo)); 
    723723 
    724724    /* ================================================= */ 
    725725 
    726726    // Terminate by offset field containing 0 
    727727    debug_pubnames_buf->write32(0);