This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
DWARF2 Regression
- To: gcc at gcc dot gnu dot org
- Subject: DWARF2 Regression
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 03 May 2001 19:32:57 -0700
- Cc: Jim Wilson <wilson at cygnus dot com>, Daniel Berlin <dan at cgsoftware dot com>, Jason Merrill <jason at cygnus dot com>
- Organization: CodeSourcery, LLC
GDB 5.0 works on IRIX 6.5 with GCC 2.95.2, but not at all with GCC
3.0. Somehow, the DWARF2 information is just not right.
Here is a simple program:
int main() {
return 3;
}
Attached, you'll find two files, compiled like this:
> ~/dev/install/gcc-2.95.2/bin/gcc -dA -S -g test.c -o test.good.s
> ~/dev/install/gcc-3.0/bin/gcc -dA -S -g test.c -o test.bad.s
The first works; the second doesn't:
> gcc test.good.s
> ~mitchell/mips-sgi-irix6.5/bin/gdb ~/tmp/a.out
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) break main
Breakpoint 1 at 0x10000f1c: file test.c, line 2.
(gdb) quit
> gcc test.bad.s
> ~mitchell/mips-sgi-irix6.5/bin/gdb ~/tmp/a.out
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) break main
Breakpoint 1 at 0x10000f10
(gdb) quit
Note that in the second case the line number information does not seem
to be working.
Can one of you DWARF2 folks figure out what has gone wrong?
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
=== test.good.s ===
#.file 1 "test.c"
.option pic2
.section .text
.section .debug_abbrev,0x7000001e,0,0,1
.Ldebug_abbrev0:
.section .text
.Ltext0:
.section .debug_info,0x7000001e,0,0,1
.Ldebug_info0:
.section .debug_line,0x7000001e,0,0,1
.Ldebug_line0:
.text
.align 2
.globl main
.ent main
main:
.LFB1:
.LM1:
.frame $fp,32,$31 # vars= 0, regs= 2/0, args= 0, extra= 16
.mask 0x50000000,-8
.fmask 0x00000000,0
subu $sp,$sp,32
.LCFI0:
sd $fp,24($sp)
.LCFI1:
sd $28,16($sp)
.LCFI2:
move $fp,$sp
.LCFI3:
.set noat
lui $1,%hi(%neg(%gp_rel(main)))
addiu $1,$1,%lo(%neg(%gp_rel(main)))
daddu $gp,$1,$25
.set at
.LM2:
li $2,3 # 0x3
b .L2
.LM3:
.L2:
move $sp,$fp
ld $fp,24($sp)
ld $28,16($sp)
addu $sp,$sp,32
j $31
.LFE1:
.end main
#APP
.section .debug_frame,0x7000001e,0x08000000,0,1
.4byte .LECIE0-.LSCIE0 # Length of Common Information Entry
.LSCIE0:
.4byte 0xffffffff # CIE Identifier Tag
.byte 0x1 # CIE Version
.byte 0x0 # CIE Augmentation (none)
.byte 0x1 # ULEB128 0x1 (CIE Code Alignment Factor)
.byte 0x78 # SLEB128 -8 (CIE Data Alignment Factor)
.byte 0x40 # CIE RA Column
.byte 0xc # DW_CFA_def_cfa
.byte 0x1d # ULEB128 0x1d
.byte 0x0 # ULEB128 0x0
.byte 0x9 # DW_CFA_register
.byte 0x40 # ULEB128 0x40
.byte 0x1f # ULEB128 0x1f
.align 2
.LECIE0:
.4byte .LEFDE0-.LSFDE0 # FDE Length
.LSFDE0:
.4byte .debug_frame # FDE CIE offset
.4byte .LFB1 # FDE initial location
.4byte .LFE1-.LFB1 # FDE address range
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI0-.LFB1
.byte 0xe # DW_CFA_def_cfa_offset
.byte 0x20 # ULEB128 0x20
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI1-.LCFI0
.byte 0x9e # DW_CFA_offset, column 0x1e
.byte 0x1 # ULEB128 0x1
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI2-.LCFI1
.byte 0x9c # DW_CFA_offset, column 0x1c
.byte 0x2 # ULEB128 0x2
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI3-.LCFI2
.byte 0xc # DW_CFA_def_cfa
.byte 0x1e # ULEB128 0x1e
.byte 0x20 # ULEB128 0x20
.align 2
.LEFDE0:
.align 0
#NO_APP
.section .text
.Letext0:
.section .debug_line,0x7000001e,0,0,1
.4byte 0x3a # Length of Source Line Info.
.2byte 0x2 # DWARF Version
.4byte 0x1a # Prolog Length
.byte 0x4 # Minimum Instruction Length
.byte 0x1 # Default is_stmt_start flag
.byte -10 # Line Base Value (Special Opcodes)
.byte 245 # Line Range Value (Special Opcodes)
.byte 10 # Special Opcode Base
.byte 0x0 # opcode: 0x1 has 0 args
.byte 0x1 # opcode: 0x2 has 1 args
.byte 0x1 # opcode: 0x3 has 1 args
.byte 0x1 # opcode: 0x4 has 1 args
.byte 0x1 # opcode: 0x5 has 1 args
.byte 0x0 # opcode: 0x6 has 0 args
.byte 0x0 # opcode: 0x7 has 0 args
.byte 0x0 # opcode: 0x8 has 0 args
.byte 0x1 # opcode: 0x9 has 1 args
# Include Directory Table
.byte 0x0
# File Name Table
.ascii "test.c\0" # File Entry: 0x1
.byte 0x0 # ULEB128 0x0
.byte 0x0 # ULEB128 0x0
.byte 0x0 # ULEB128 0x0
.byte 0x0
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .LM2
.byte 0x15 # line 2
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .LM3
.byte 0x15 # line 3
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .Letext0
.byte 0x0 # DW_LNE_end_sequence
.byte 0x1 # ULEB128 0x1
.byte 0x1
.section .debug_abbrev,0x7000001e,0,0,1
.byte 0x1 # ULEB128 0x1 (abbrev code)
.byte 0x11 # ULEB128 0x11 (TAG: DW_TAG_compile_unit)
.byte 0x1 # DW_children_yes
.byte 0x3 # ULEB128 0x3 (DW_AT_name)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x1b # ULEB128 0x1b (DW_AT_comp_dir)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x25 # ULEB128 0x25 (DW_AT_producer)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x13 # ULEB128 0x13 (DW_AT_language)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x11 # ULEB128 0x11 (DW_AT_low_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x12 # ULEB128 0x12 (DW_AT_high_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x10 # ULEB128 0x10 (DW_AT_stmt_list)
.byte 0x6 # ULEB128 0x6 (DW_FORM_data4)
.byte 0,0
.byte 0x2 # ULEB128 0x2 (abbrev code)
.byte 0x2e # ULEB128 0x2e (TAG: DW_TAG_subprogram)
.byte 0x0 # DW_children_no
.byte 0x3f # ULEB128 0x3f (DW_AT_external)
.byte 0xc # ULEB128 0xc (DW_FORM_flag)
.byte 0x3 # ULEB128 0x3 (DW_AT_name)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x3a # ULEB128 0x3a (DW_AT_decl_file)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x3b # ULEB128 0x3b (DW_AT_decl_line)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x49 # ULEB128 0x49 (DW_AT_type)
.byte 0x13 # ULEB128 0x13 (DW_FORM_ref4)
.byte 0x11 # ULEB128 0x11 (DW_AT_low_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x12 # ULEB128 0x12 (DW_AT_high_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x81,0x40 # ULEB128 0x2001 (DW_AT_MIPS_fde)
.byte 0x6 # ULEB128 0x6 (DW_FORM_data4)
.byte 0x40 # ULEB128 0x40 (DW_AT_frame_base)
.byte 0xa # ULEB128 0xa (DW_FORM_block1)
.byte 0,0
.byte 0x3 # ULEB128 0x3 (abbrev code)
.byte 0x24 # ULEB128 0x24 (TAG: DW_TAG_base_type)
.byte 0x0 # DW_children_no
.byte 0x3 # ULEB128 0x3 (DW_AT_name)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0xb # ULEB128 0xb (DW_AT_byte_size)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x3e # ULEB128 0x3e (DW_AT_encoding)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0,0
.byte 0
.section .debug_info,0x7000001e,0,0,1
.4byte 0x76 # Length of Compilation Unit Info.
.2byte 0x2 # DWARF version number
.4byte .Ldebug_abbrev0 # Offset Into Abbrev. Section
.byte 0x4 # Pointer Size (in bytes)
.byte 0x1 # ULEB128 0x1 (DIE (0xb) DW_TAG_compile_unit)
.ascii "test.c\0" # DW_AT_name
.ascii "/users/mitchell/tmp\0" # DW_AT_comp_dir
.ascii "GNU C 2.95.2 19991024 (release) -g\0" # DW_AT_producer
.byte 0x1 # DW_AT_language
.4byte .Ltext0 # DW_AT_low_pc
.4byte .Letext0 # DW_AT_high_pc
.4byte .Ldebug_line0 # DW_AT_stmt_list
.byte 0x2 # ULEB128 0x2 (DIE (0x57) DW_TAG_subprogram)
.byte 0x1 # DW_AT_external
.ascii "main\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file
.byte 0x1 # DW_AT_decl_line
.4byte 0x72 # DW_AT_type
.4byte .LFB1 # DW_AT_low_pc
.4byte .LFE1 # DW_AT_high_pc
.4byte .LSFDE0 - 4 # DW_AT_MIPS_fde
.byte 0x1 # DW_AT_frame_base
.byte 0x6e # DW_OP_reg30
.byte 0x3 # ULEB128 0x3 (DIE (0x72) DW_TAG_base_type)
.ascii "int\0" # DW_AT_name
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.byte 0x0 # end of children of DIE 0xb
.section .debug_pubnames,0x7000001e,0,0,1
.4byte 0x17 # Length of Public Names Info.
.2byte 0x2 # DWARF Version
.4byte .Ldebug_info0 # Offset of Compilation Unit Info.
.4byte 0x7a # Compilation Unit Length
.4byte 0x57 # DIE offset
.ascii "main\0" # external name
.4byte 0x0
.section .debug_aranges,0x7000001e,0,0,1
.4byte 0x1c # Length of Address Ranges Info.
.2byte 0x2 # DWARF Version
.4byte .Ldebug_info0 # Offset of Compilation Unit Info.
.byte 0x4 # Size of Address
.byte 0x0 # Size of Segment Descriptor
.4byte 0x4 # Pad to 8 byte boundary
.4byte .Ltext0 # Address
.4byte .Letext0-.Ltext0 # Length
.4byte 0x0
.4byte 0x0
=== test.bad.s ===
#.file 1 "test.c"
.option pic2
.section .text
.section .debug_abbrev,0x7000001e,0,0,1
.Ldebug_abbrev0:
.section .debug_info,0x7000001e,0,0,1
.Ldebug_info0:
.section .debug_line,0x7000001e,0,0,1
.Ldebug_line0:
.text
.align 2
.globl main
.ent main
main:
.LFB1:
.LM1:
# test.c:1
.frame $fp,32,$31 # vars= 0, regs= 2/0, args= 0, extra= 16
.mask 0x50000000,-8
.fmask 0x00000000,0
# basic block 0
subu $sp,$sp,32
.LCFI0:
sd $fp,24($sp)
.LCFI1:
sd $28,16($sp)
.LCFI2:
move $fp,$sp
.LCFI3:
.set noat
lui $1,%hi(%neg(%gp_rel(main)))
addiu $1,$1,%lo(%neg(%gp_rel(main)))
daddu $gp,$1,$25
.set at
.LM2:
# test.c:2
li $2,3 # 0x3
.LM3:
# test.c:3
move $sp,$fp
ld $fp,24($sp)
ld $28,16($sp)
addu $sp,$sp,32
j $31
.LFE1:
.end main
#APP
.section .debug_frame,0x7000001e,0x08000000,0,1
.4byte .LECIE0-.LSCIE0 # Length of Common Information Entry
.LSCIE0:
.4byte 0xffffffff # CIE Identifier Tag
.byte 0x1 # CIE Version
.byte 0x0 # CIE Augmentation (none)
.byte 0x1 # ULEB128 0x1 (CIE Code Alignment Factor)
.byte 0x78 # SLEB128 -8 (CIE Data Alignment Factor)
.byte 0x40 # CIE RA Column
.byte 0xc # DW_CFA_def_cfa
.byte 0x1d # ULEB128 0x1d
.byte 0x0 # ULEB128 0x0
.align 2
.LECIE0:
.4byte .LEFDE0-.LSFDE0 # FDE Length
.LSFDE0:
.4byte .debug_frame # FDE CIE offset
.4byte .LFB1 # FDE initial location
.4byte .LFE1-.LFB1 # FDE address range
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI0-.LFB1
.byte 0xe # DW_CFA_def_cfa_offset
.byte 0x20 # ULEB128 0x20
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI1-.LCFI0
.byte 0x9e # DW_CFA_offset, column 0x1e
.byte 0x1 # ULEB128 0x1
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI2-.LCFI1
.byte 0x9c # DW_CFA_offset, column 0x1c
.byte 0x2 # ULEB128 0x2
.byte 0x4 # DW_CFA_advance_loc4
.4byte .LCFI3-.LCFI2
.byte 0xc # DW_CFA_def_cfa
.byte 0x1e # ULEB128 0x1e
.byte 0x20 # ULEB128 0x20
.align 2
.LEFDE0:
.align 0
#NO_APP
.section .text
.Letext0:
.section .debug_line,0x7000001e,0,0,1
.4byte .LSLT0-.LELT0 # Length of Source Line Info.
.LSLT0:
.2byte 0x2 # DWARF Version
.4byte .LASLTP0-.LELTP0 # Prolog Length
.LASLTP0:
.byte 0x4 # Minimum Instruction Length
.byte 0x1 # Default is_stmt_start flag
.byte -10 # Line Base Value (Special Opcodes)
.byte 245 # Line Range Value (Special Opcodes)
.byte 10 # Special Opcode Base
.byte 0x0 # opcode: 0x1 has 0 args
.byte 0x1 # opcode: 0x2 has 1 args
.byte 0x1 # opcode: 0x3 has 1 args
.byte 0x1 # opcode: 0x4 has 1 args
.byte 0x1 # opcode: 0x5 has 1 args
.byte 0x0 # opcode: 0x6 has 0 args
.byte 0x0 # opcode: 0x7 has 0 args
.byte 0x0 # opcode: 0x8 has 0 args
.byte 0x1 # opcode: 0x9 has 1 args
.byte 0x0 # End directory table
.ascii "test.c\0" # File Entry: 0x1
.byte 0x0 # ULEB128 0x0
.byte 0x0 # ULEB128 0x0
.byte 0x0 # ULEB128 0x0
.byte 0x0 # End file name table
.LELTP0:
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .LM1
.byte 0x1 # DW_LNS_copy
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .LM2
.byte 0x15 # line 2
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .LM3
.byte 0x15 # line 3
.byte 0x0 # DW_LNE_set_address
.byte 0x5 # ULEB128 0x5
.byte 0x2
.4byte .Letext0
.byte 0x0 # DW_LNE_end_sequence
.byte 0x1 # ULEB128 0x1
.byte 0x1
.LELT0:
.section .debug_info,0x7000001e,0,0,1
.4byte 0x76 # Length of Compilation Unit Info.
.2byte 0x2 # DWARF version number
.4byte .Ldebug_abbrev0 # Offset Into Abbrev. Section
.byte 0x4 # Pointer Size (in bytes)
.byte 0x1 # ULEB128 0x1 (DIE (0xb) DW_TAG_compile_unit)
.4byte .Ldebug_line0 # DW_AT_stmt_list
.4byte .Letext0 # DW_AT_high_pc
.4byte .text # DW_AT_low_pc
.ascii "test.c\0" # DW_AT_name
.ascii "/users/mitchell/tmp\0" # DW_AT_comp_dir
.ascii "GNU C 3.0 20010426 (prerelease) -g\0" # DW_AT_producer
.byte 0x1 # DW_AT_language
.byte 0x2 # ULEB128 0x2 (DIE (0x57) DW_TAG_subprogram)
.byte 0x1 # DW_AT_external
.ascii "main\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file
.byte 0x1 # DW_AT_decl_line
.4byte 0x72 # DW_AT_type
.4byte .LFB1 # DW_AT_low_pc
.4byte .LFE1 # DW_AT_high_pc
.4byte .LSFDE0 - 4 # DW_AT_MIPS_fde
.byte 0x1 # DW_AT_frame_base
.byte 0x6e # DW_OP_reg30
.byte 0x3 # ULEB128 0x3 (DIE (0x72) DW_TAG_base_type)
.ascii "int\0" # DW_AT_name
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.byte 0x0 # end of children of DIE 0xb
.section .debug_abbrev,0x7000001e,0,0,1
.byte 0x1 # ULEB128 0x1 (abbrev code)
.byte 0x11 # ULEB128 0x11 (TAG: DW_TAG_compile_unit)
.byte 0x1 # DW_children_yes
.byte 0x10 # ULEB128 0x10 (DW_AT_stmt_list)
.byte 0x6 # ULEB128 0x6 (DW_FORM_data4)
.byte 0x12 # ULEB128 0x12 (DW_AT_high_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x11 # ULEB128 0x11 (DW_AT_low_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x3 # ULEB128 0x3 (DW_AT_name)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x1b # ULEB128 0x1b (DW_AT_comp_dir)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x25 # ULEB128 0x25 (DW_AT_producer)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x13 # ULEB128 0x13 (DW_AT_language)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0,0
.byte 0x2 # ULEB128 0x2 (abbrev code)
.byte 0x2e # ULEB128 0x2e (TAG: DW_TAG_subprogram)
.byte 0x0 # DW_children_no
.byte 0x3f # ULEB128 0x3f (DW_AT_external)
.byte 0xc # ULEB128 0xc (DW_FORM_flag)
.byte 0x3 # ULEB128 0x3 (DW_AT_name)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0x3a # ULEB128 0x3a (DW_AT_decl_file)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x3b # ULEB128 0x3b (DW_AT_decl_line)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x49 # ULEB128 0x49 (DW_AT_type)
.byte 0x13 # ULEB128 0x13 (DW_FORM_ref4)
.byte 0x11 # ULEB128 0x11 (DW_AT_low_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x12 # ULEB128 0x12 (DW_AT_high_pc)
.byte 0x1 # ULEB128 0x1 (DW_FORM_addr)
.byte 0x81,0x40 # ULEB128 0x2001 (DW_AT_MIPS_fde)
.byte 0x6 # ULEB128 0x6 (DW_FORM_data4)
.byte 0x40 # ULEB128 0x40 (DW_AT_frame_base)
.byte 0xa # ULEB128 0xa (DW_FORM_block1)
.byte 0,0
.byte 0x3 # ULEB128 0x3 (abbrev code)
.byte 0x24 # ULEB128 0x24 (TAG: DW_TAG_base_type)
.byte 0x0 # DW_children_no
.byte 0x3 # ULEB128 0x3 (DW_AT_name)
.byte 0x8 # ULEB128 0x8 (DW_FORM_string)
.byte 0xb # ULEB128 0xb (DW_AT_byte_size)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0x3e # ULEB128 0x3e (DW_AT_encoding)
.byte 0xb # ULEB128 0xb (DW_FORM_data1)
.byte 0,0
.byte 0
.section .debug_pubnames,0x7000001e,0,0,1
.4byte 0x17 # Length of Public Names Info.
.2byte 0x2 # DWARF Version
.4byte .Ldebug_info0 # Offset of Compilation Unit Info.
.4byte 0x7a # Compilation Unit Length
.4byte 0x57 # DIE offset
.ascii "main\0" # external name
.4byte 0x0
.section .debug_aranges,0x7000001e,0,0,1
.4byte 0x1c # Length of Address Ranges Info.
.2byte 0x2 # DWARF Version
.4byte .Ldebug_info0 # Offset of Compilation Unit Info.
.byte 0x4 # Size of Address
.byte 0x0 # Size of Segment Descriptor
.2byte 0x0,0 # Pad to 8 byte boundary
.4byte .text # Address
.4byte .Letext0-.text # Length
.4byte 0x0
.4byte 0x0
.data