Add addr2line, objcopy and strip tests for compressed debug sections.

binutils/testsuite/

2010-07-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/default.exp (binutils_assemble): Use
	default_binutils_assemble_flags.
	(binutils_assemble_flags): New.

	* lib/utils-lib.exp (default_binutils_assemble): Renamed to ...
	(default_binutils_assemble_flags): This.  Add asflags and
	pass it to target_assemble.
	(run_dump_test): Support assembler flags.

	* binutils-all/i386/compressed-1.s: New.
	* binutils-all/i386/compressed-1a.d: Likewise.
	* binutils-all/i386/compressed-1b.d: Likewise.
	* binutils-all/i386/compressed-1c.d: Likewise.
	* binutils-all/i386/i386.exp: Likewise.
	* binutils-all/x86-64/compressed-1.s: Likewise.
	* binutils-all/x86-64/compressed-1a.d: Likewise.
	* binutils-all/x86-64/compressed-1b.d: Likewise.
	* binutils-all/x86-64/compressed-1c.d: Likewise.
	* binutils-all/x86-64/x86-64.exp: Likewise.

gas/testsuite/

2010-07-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config/default.exp (ADDR2LINE): New.
	(ADDR2LINEFLAGS): Likewise.

	* gas/i386/i386.exp: Run dw2-compress-2 and x86-64-dw2-compress-2.

	* gas/i386/dw2-compress-2.d: New.
	* gas/i386/dw2-compress-2.s: Likewise.
	* gas/i386/x86-64-dw2-compress-2.d: Likewise.
	* gas/i386/x86-64-dw2-compress-2.s: Likewise.

	* lib/gas-defs.exp (run_dump_test): Support addr2line as dump
	program.
	(slurp_options): Allow numbers in options.
This commit is contained in:
H.J. Lu 2010-07-14 19:46:01 +00:00
parent 3cbaedfff7
commit 368886ac46
21 changed files with 1121 additions and 8 deletions

View File

@ -1,3 +1,25 @@
2010-07-14 H.J. Lu <hongjiu.lu@intel.com>
* config/default.exp (binutils_assemble): Use
default_binutils_assemble_flags.
(binutils_assemble_flags): New.
* lib/utils-lib.exp (default_binutils_assemble): Renamed to ...
(default_binutils_assemble_flags): This. Add asflags and
pass it to target_assemble.
(run_dump_test): Support assembler flags.
* binutils-all/i386/compressed-1.s: New.
* binutils-all/i386/compressed-1a.d: Likewise.
* binutils-all/i386/compressed-1b.d: Likewise.
* binutils-all/i386/compressed-1c.d: Likewise.
* binutils-all/i386/i386.exp: Likewise.
* binutils-all/x86-64/compressed-1.s: Likewise.
* binutils-all/x86-64/compressed-1a.d: Likewise.
* binutils-all/x86-64/compressed-1b.d: Likewise.
* binutils-all/x86-64/compressed-1c.d: Likewise.
* binutils-all/x86-64/x86-64.exp: Likewise.
2010-07-05 H.J. Lu <hongjiu.lu@intel.com>
PR gas/10531

View File

@ -0,0 +1,147 @@
.file "compressed-1.c"
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.section .debug_line,"",@progbits
.Ldebug_line0:
.text
.Ltext0:
.cfi_sections .debug_frame
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB1:
.file 1 "compressed-1.c"
.loc 1 11 0
.cfi_startproc
.loc 1 12 0
rep
ret
.cfi_endproc
.LFE1:
.size foo2, .-foo2
.p2align 4,,15
.globl foo1
.type foo1, @function
foo1:
.LFB0:
.loc 1 5 0
.cfi_startproc
subl $12, %esp
.cfi_def_cfa_offset 16
.loc 1 7 0
addl $12, %esp
.cfi_def_cfa_offset 4
.loc 1 6 0
jmp bar
.cfi_endproc
.LFE0:
.size foo1, .-foo1
.Letext0:
.section .debug_info
.long 0x46
.value 0x3
.long .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.long .LASF2
.byte 0x1
.long .LASF3
.long .LASF4
.long .Ltext0
.long .Letext0
.long .Ldebug_line0
.uleb128 0x2
.byte 0x1
.long .LASF0
.byte 0x1
.byte 0xa
.long .LFB1
.long .LFE1
.byte 0x1
.byte 0x9c
.uleb128 0x2
.byte 0x1
.long .LASF1
.byte 0x1
.byte 0x4
.long .LFB0
.long .LFE0
.byte 0x1
.byte 0x9c
.byte 0x0
.section .debug_abbrev
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x10
.uleb128 0x6
.byte 0x0
.byte 0x0
.uleb128 0x2
.uleb128 0x2e
.byte 0x0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.byte 0x0
.byte 0x0
.byte 0x0
.section .debug_pubnames,"",@progbits
.long 0x20
.value 0x2
.long .Ldebug_info0
.long 0x4a
.long 0x25
.string "foo2"
.long 0x37
.string "foo1"
.long 0x0
.section .debug_aranges,"",@progbits
.long 0x1c
.value 0x2
.long .Ldebug_info0
.byte 0x4
.byte 0x0
.value 0x0
.value 0x0
.long .Ltext0
.long .Letext0-.Ltext0
.long 0x0
.long 0x0
.section .debug_str,"MS",@progbits,1
.LASF2:
.string "GNU C 4.4.4"
.LASF0:
.string "foo2"
.LASF1:
.string "foo1"
.LASF4:
.string "."
.LASF3:
.string "compressed-1.c"

View File

@ -0,0 +1,157 @@
#PROG: objcopy
#source: compressed-1.s
#as: --32 --compress-debug-sections
#objcopy:
#readelf: -w
#name: objcopy on compressed debug setions
Contents of the .[z]?debug_abbrev section:
Number TAG
1 DW_TAG_compile_unit \[has children\]
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data1
DW_AT_name DW_FORM_strp
DW_AT_comp_dir DW_FORM_strp
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_stmt_list DW_FORM_data4
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_name DW_FORM_strp
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
Contents of the .[z]?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x46 \(32-bit\)
Version: 3
Abbrev Offset: 0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
< c> DW_AT_producer : \(indirect string, offset: 0x0\): GNU C 4.4.4
<10> DW_AT_language : 1 \(ANSI C\)
<11> DW_AT_name : \(indirect string, offset: 0x18\): compressed-1.c
<15> DW_AT_comp_dir : \(indirect string, offset: 0x16\): .
<19> DW_AT_low_pc : 0x0
<1d> DW_AT_high_pc : 0x1b
<21> DW_AT_stmt_list : 0x0
<1><25>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<26> DW_AT_external : 1
<27> DW_AT_name : \(indirect string, offset: 0xc\): foo2
<2b> DW_AT_decl_file : 1
<2c> DW_AT_decl_line : 10
<2d> DW_AT_low_pc : 0x0
<31> DW_AT_high_pc : 0x2
<35> DW_AT_frame_base : 1 byte block: 9c \(DW_OP_call_frame_cfa\)
<1><37>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<38> DW_AT_external : 1
<39> DW_AT_name : \(indirect string, offset: 0x11\): foo1
<3d> DW_AT_decl_file : 1
<3e> DW_AT_decl_line : 4
<3f> DW_AT_low_pc : 0x10
<43> DW_AT_high_pc : 0x1b
<47> DW_AT_frame_base : 1 byte block: 9c \(DW_OP_call_frame_cfa\)
Raw dump of debug contents of section .[z]?debug_line:
Offset: 0x0
Length: 64
DWARF Version: 2
Prologue Length: 37
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 compressed-1.c
Line Number Statements:
Extended opcode 2: set Address to 0x0
Advance Line by 10 to 11
Copy
Special opcode 6: advance Address by 0 to 0x0 and Line by 1 to 12
Advance Line by -7 to 5
Special opcode 229: advance Address by 16 to 0x10 and Line by 0 to 5
Special opcode 49: advance Address by 3 to 0x13 and Line by 2 to 7
Special opcode 46: advance Address by 3 to 0x16 and Line by -1 to 6
Advance PC by 5 to 0x1b
Extended opcode 1: End of Sequence
Contents of the .[z]?debug_pubnames section:
Length: 32
Version: 2
Offset into .[z]?debug_info section: 0x0
Size of area in .[z]?debug_info section: 74
Offset Name
25 foo2
37 foo1
Contents of the .[z]?debug_aranges section:
Length: 28
Version: 2
Offset into .[z]?debug_info: 0x0
Pointer Size: 4
Segment Size: 0
Address Length
00000000 0000001b
00000000 00000000
Contents of the .[z]?debug_str section:
0x00000000 474e5520 4320342e 342e3400 666f6f32 GNU C 4.4.4.foo2
0x00000010 00666f6f 31002e00 636f6d70 72657373 .foo1...compress
0x00000020 65642d31 2e6300 ed-1.c.
Contents of the .[z]?debug_frame section:
00000000 00000010 ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -4
Return address column: 8
DW_CFA_def_cfa: r4 \(esp\) ofs 4
DW_CFA_offset: r8 \(eip\) at cfa-4
DW_CFA_nop
DW_CFA_nop
00000014 0000000c 00000000 FDE cie=00000000 pc=00000000..00000002
00000024 00000014 00000000 FDE cie=00000000 pc=00000010..0000001b
DW_CFA_advance_loc: 3 to 00000013
DW_CFA_def_cfa_offset: 16
DW_CFA_advance_loc: 3 to 00000016
DW_CFA_def_cfa_offset: 4
DW_CFA_nop
DW_CFA_nop

View File

@ -0,0 +1,21 @@
#PROG: strip
#source: compressed-1.s
#as: --32
#strip:
#readelf: -S --wide
#name: strip on uncompressed debug setions
There are 6 section headers, starting at offset 0x7c:
Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] .text PROGBITS 00000000 000040 00001b 00 AX 0 0 16
\[ 2\] .rel.text REL 00000000 00016c 000000 08 0 1 4
\[ 3\] .data PROGBITS 00000000 00005c 000000 00 WA 0 0 4
\[ 4\] .bss NOBITS 00000000 00005c 000000 00 WA 0 0 4
\[ 5\] .shstrtab STRTAB 00000000 00005c 000020 00 0 0 1
Key to Flags:
W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
I \(info\), L \(link order\), G \(group\), x \(unknown\)
O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)

View File

@ -0,0 +1,21 @@
#PROG: strip
#source: compressed-1.s
#as: --32 --compress-debug-sections
#strip:
#readelf: -S --wide
#name: strip on compressed debug setions
There are 6 section headers, starting at offset 0x7c:
Section Headers:
\[Nr\] Name Type Addr Off Size ES Flg Lk Inf Al
\[ 0\] NULL 00000000 000000 000000 00 0 0 0
\[ 1\] .text PROGBITS 00000000 000040 00001b 00 AX 0 0 16
\[ 2\] .rel.text REL 00000000 00016c 000000 08 0 1 4
\[ 3\] .data PROGBITS 00000000 00005c 000000 00 WA 0 0 4
\[ 4\] .bss NOBITS 00000000 00005c 000000 00 WA 0 0 4
\[ 5\] .shstrtab STRTAB 00000000 00005c 000020 00 0 0 1
Key to Flags:
W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
I \(info\), L \(link order\), G \(group\), x \(unknown\)
O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)

View File

@ -0,0 +1,32 @@
# Copyright 2010
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
if {!([istarget "i*86-*-linux*"] || [istarget "x86_64-*-linux*"]) || [is_remote host]} then {
return
}
global tempfile
global copyfile
set tempfile tmpdir/i386temp.o
set copyfile tmpdir/i386copy
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
verbose [file rootname $t]
run_dump_test [file rootname $t]
}

View File

@ -0,0 +1,142 @@
.file "compressed-1.c"
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.section .debug_line,"",@progbits
.Ldebug_line0:
.text
.Ltext0:
.cfi_sections .debug_frame
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB1:
.file 1 "compressed-1.c"
.loc 1 11 0
.cfi_startproc
.loc 1 12 0
rep
ret
.cfi_endproc
.LFE1:
.size foo2, .-foo2
.p2align 4,,15
.globl foo1
.type foo1, @function
foo1:
.LFB0:
.loc 1 5 0
.cfi_startproc
.loc 1 6 0
jmp bar
.cfi_endproc
.LFE0:
.size foo1, .-foo1
.Letext0:
.section .debug_info
.long 0x5e
.value 0x3
.long .Ldebug_abbrev0
.byte 0x8
.uleb128 0x1
.long .LASF2
.byte 0x1
.long .LASF3
.long .LASF4
.quad .Ltext0
.quad .Letext0
.long .Ldebug_line0
.uleb128 0x2
.byte 0x1
.long .LASF0
.byte 0x1
.byte 0xa
.quad .LFB1
.quad .LFE1
.byte 0x1
.byte 0x9c
.uleb128 0x2
.byte 0x1
.long .LASF1
.byte 0x1
.byte 0x4
.quad .LFB0
.quad .LFE0
.byte 0x1
.byte 0x9c
.byte 0x0
.section .debug_abbrev
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x10
.uleb128 0x6
.byte 0x0
.byte 0x0
.uleb128 0x2
.uleb128 0x2e
.byte 0x0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.byte 0x0
.byte 0x0
.byte 0x0
.section .debug_pubnames,"",@progbits
.long 0x20
.value 0x2
.long .Ldebug_info0
.long 0x62
.long 0x2d
.string "foo2"
.long 0x47
.string "foo1"
.long 0x0
.section .debug_aranges,"",@progbits
.long 0x2c
.value 0x2
.long .Ldebug_info0
.byte 0x8
.byte 0x0
.value 0x0
.value 0x0
.quad .Ltext0
.quad .Letext0-.Ltext0
.quad 0x0
.quad 0x0
.section .debug_str,"MS",@progbits,1
.LASF2:
.string "GNU C 4.4.4"
.LASF0:
.string "foo2"
.LASF1:
.string "foo1"
.LASF4:
.string "."
.LASF3:
.string "compressed-1.c"

View File

@ -0,0 +1,154 @@
#PROG: objcopy
#source: compressed-1.s
#as: --64 --compress-debug-sections
#objcopy:
#readelf: -w
#name: objcopy on compressed debug setions
Contents of the .[z]?debug_abbrev section:
Number TAG
1 DW_TAG_compile_unit \[has children\]
DW_AT_producer DW_FORM_strp
DW_AT_language DW_FORM_data1
DW_AT_name DW_FORM_strp
DW_AT_comp_dir DW_FORM_strp
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_stmt_list DW_FORM_data4
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_name DW_FORM_strp
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
Contents of the .[z]?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x5e \(32-bit\)
Version: 3
Abbrev Offset: 0
Pointer Size: 8
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
< c> DW_AT_producer : \(indirect string, offset: 0x0\): GNU C 4.4.4
<10> DW_AT_language : 1 \(ANSI C\)
<11> DW_AT_name : \(indirect string, offset: 0x18\): compressed-1.c
<15> DW_AT_comp_dir : \(indirect string, offset: 0x16\): .
<19> DW_AT_low_pc : 0x0
<21> DW_AT_high_pc : 0x15
<29> DW_AT_stmt_list : 0x0
<1><2d>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<2e> DW_AT_external : 1
<2f> DW_AT_name : \(indirect string, offset: 0xc\): foo2
<33> DW_AT_decl_file : 1
<34> DW_AT_decl_line : 10
<35> DW_AT_low_pc : 0x0
<3d> DW_AT_high_pc : 0x2
<45> DW_AT_frame_base : 1 byte block: 9c \(DW_OP_call_frame_cfa\)
<1><47>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<48> DW_AT_external : 1
<49> DW_AT_name : \(indirect string, offset: 0x11\): foo1
<4d> DW_AT_decl_file : 1
<4e> DW_AT_decl_line : 4
<4f> DW_AT_low_pc : 0x10
<57> DW_AT_high_pc : 0x15
<5f> DW_AT_frame_base : 1 byte block: 9c \(DW_OP_call_frame_cfa\)
Raw dump of debug contents of section .[z]?debug_line:
Offset: 0x0
Length: 67
DWARF Version: 2
Prologue Length: 37
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: -5
Line Range: 14
Opcode Base: 13
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table:
Entry Dir Time Size Name
1 0 0 0 compressed-1.c
Line Number Statements:
Extended opcode 2: set Address to 0x0
Advance Line by 10 to 11
Copy
Special opcode 6: advance Address by 0 to 0x0 and Line by 1 to 12
Advance Line by -7 to 5
Special opcode 229: advance Address by 16 to 0x10 and Line by 0 to 5
Special opcode 6: advance Address by 0 to 0x10 and Line by 1 to 6
Advance PC by 5 to 0x15
Extended opcode 1: End of Sequence
Contents of the .[z]?debug_pubnames section:
Length: 32
Version: 2
Offset into .[z]?debug_info section: 0x0
Size of area in .[z]?debug_info section: 98
Offset Name
2d foo2
47 foo1
Contents of the .[z]?debug_aranges section:
Length: 44
Version: 2
Offset into .[z]?debug_info: 0x0
Pointer Size: 8
Segment Size: 0
Address Length
0000000000000000 0000000000000015
0000000000000000 0000000000000000
Contents of the .[z]?debug_str section:
0x00000000 474e5520 4320342e 342e3400 666f6f32 GNU C 4.4.4.foo2
0x00000010 00666f6f 31002e00 636f6d70 72657373 .foo1...compress
0x00000020 65642d31 2e6300 ed-1.c.
Contents of the .[z]?debug_frame section:
00000000 00000014 ffffffff CIE
Version: 1
Augmentation: ""
Code alignment factor: 1
Data alignment factor: -8
Return address column: 16
DW_CFA_def_cfa: r7 \(rsp\) ofs 8
DW_CFA_offset: r16 \(rip\) at cfa-8
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
00000018 00000014 00000000 FDE cie=00000000 pc=00000000..00000002
00000030 00000014 00000000 FDE cie=00000000 pc=00000010..00000015

View File

@ -0,0 +1,21 @@
#PROG: strip
#source: compressed-1.s
#as: --64
#strip:
#readelf: -S --wide
#name: strip on uncompressed debug setions
There are 6 section headers, starting at offset 0x80:
Section Headers:
\[Nr\] Name Type Address Off Size ES Flg Lk Inf Al
\[ 0\] NULL 0000000000000000 000000 000000 00 0 0 0
\[ 1\] .text PROGBITS 0000000000000000 000040 000015 00 AX 0 0 16
\[ 2\] .rela.text RELA 0000000000000000 000200 000000 18 0 1 8
\[ 3\] .data PROGBITS 0000000000000000 000058 000000 00 WA 0 0 4
\[ 4\] .bss NOBITS 0000000000000000 000058 000000 00 WA 0 0 4
\[ 5\] .shstrtab STRTAB 0000000000000000 000058 000021 00 0 0 1
Key to Flags:
W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
I \(info\), L \(link order\), G \(group\), x \(unknown\)
O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)

View File

@ -0,0 +1,21 @@
#PROG: strip
#source: compressed-1.s
#as: --64 --compress-debug-sections
#strip:
#readelf: -S --wide
#name: strip on compressed debug setions
There are 6 section headers, starting at offset 0x80:
Section Headers:
\[Nr\] Name Type Address Off Size ES Flg Lk Inf Al
\[ 0\] NULL 0000000000000000 000000 000000 00 0 0 0
\[ 1\] .text PROGBITS 0000000000000000 000040 000015 00 AX 0 0 16
\[ 2\] .rela.text RELA 0000000000000000 000200 000000 18 0 1 8
\[ 3\] .data PROGBITS 0000000000000000 000058 000000 00 WA 0 0 4
\[ 4\] .bss NOBITS 0000000000000000 000058 000000 00 WA 0 0 4
\[ 5\] .shstrtab STRTAB 0000000000000000 000058 000021 00 0 0 1
Key to Flags:
W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
I \(info\), L \(link order\), G \(group\), x \(unknown\)
O \(extra OS processing required\) o \(OS specific\), p \(processor specific\)

View File

@ -0,0 +1,32 @@
# Copyright 2010
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
if {![istarget "x86_64-*-linux*"] || [is_remote host]} then {
return
}
global tempfile
global copyfile
set tempfile tmpdir/x86-64temp.o
set copyfile tmpdir/x86-64copy
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
verbose [file rootname $t]
run_dump_test [file rootname $t]
}

View File

@ -123,5 +123,13 @@ proc binutils_run { prog progargs } {
# assemble a file
#
proc binutils_assemble { source object } {
default_binutils_assemble $source $object
default_binutils_assemble_flags $source $object ""
}
#
# binutils_assemble_flags
# assemble a file
#
proc binutils_assemble_flags { source object asflags } {
default_binutils_assemble_flags $source $object $asflags
}

View File

@ -84,10 +84,10 @@ proc default_binutils_run { prog progargs } {
}
#
# default_binutils_assemble
# default_binutils_assemble_flags
# assemble a file
#
proc default_binutils_assemble { source object } {
proc default_binutils_assemble_flags { source object asflags } {
global srcdir
global host_triplet
@ -105,7 +105,7 @@ proc default_binutils_assemble { source object } {
set source asm.s
}
set exec_output [target_assemble $source $object ""]
set exec_output [target_assemble $source $object $asflags]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] {
@ -301,6 +301,7 @@ proc run_dump_test { name {extra_options {}} } {
}
set opts(addr2line) {}
set opts(ar) {}
set opts(as) {}
set opts(nm) {}
set opts(objcopy) {}
set opts(objdump) {}
@ -475,7 +476,7 @@ proc run_dump_test { name {extra_options {}} } {
set srcfile $srcdir/$subdir/$opts(source)
}
set exec_output [binutils_assemble ${srcfile} $tempfile]
set exec_output [binutils_assemble_flags ${srcfile} $tempfile $opts(as)]
if [string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output"

View File

@ -1,3 +1,19 @@
2010-07-14 H.J. Lu <hongjiu.lu@intel.com>
* config/default.exp (ADDR2LINE): New.
(ADDR2LINEFLAGS): Likewise.
* gas/i386/i386.exp: Run dw2-compress-2 and x86-64-dw2-compress-2.
* gas/i386/dw2-compress-2.d: New.
* gas/i386/dw2-compress-2.s: Likewise.
* gas/i386/x86-64-dw2-compress-2.d: Likewise.
* gas/i386/x86-64-dw2-compress-2.s: Likewise.
* lib/gas-defs.exp (run_dump_test): Support addr2line as dump
program.
(slurp_options): Allow numbers in options.
2010-07-14 Maciej W. Rozycki <macro@codesourcery.com>
* gas/elf/dwarf2-3.s: Replace .short and .long directives in

View File

@ -46,4 +46,12 @@ if ![info exists READELFFLAGS] then {
set READELFFLAGS {}
}
if ![info exists ADDR2LINE] then {
set ADDR2LINE [findfile $base_dir/../../binutils/addr2line]
}
if ![info exists ADDR2LINEFLAGS] then {
set ADDR2LINEFLAGS {}
}
gas_init

View File

@ -0,0 +1,6 @@
#as: --compress-debug-sections
#addr2line: 0x0 0x10 -e
#name: DWARF2 debugging information 2
./dw2-compress-2.c:12
./dw2-compress-2.c:5

View File

@ -0,0 +1,147 @@
.file "dw2-compress-2.c"
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.section .debug_line,"",@progbits
.Ldebug_line0:
.text
.Ltext0:
.cfi_sections .debug_frame
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB1:
.file 1 "dw2-compress-2.c"
.loc 1 11 0
.cfi_startproc
.loc 1 12 0
rep
ret
.cfi_endproc
.LFE1:
.size foo2, .-foo2
.p2align 4,,15
.globl foo1
.type foo1, @function
foo1:
.LFB0:
.loc 1 5 0
.cfi_startproc
subl $12, %esp
.cfi_def_cfa_offset 16
.loc 1 7 0
addl $12, %esp
.cfi_def_cfa_offset 4
.loc 1 6 0
jmp bar
.cfi_endproc
.LFE0:
.size foo1, .-foo1
.Letext0:
.section .debug_info
.long 0x46
.value 0x3
.long .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.long .LASF2
.byte 0x1
.long .LASF3
.long .LASF4
.long .Ltext0
.long .Letext0
.long .Ldebug_line0
.uleb128 0x2
.byte 0x1
.long .LASF0
.byte 0x1
.byte 0xa
.long .LFB1
.long .LFE1
.byte 0x1
.byte 0x9c
.uleb128 0x2
.byte 0x1
.long .LASF1
.byte 0x1
.byte 0x4
.long .LFB0
.long .LFE0
.byte 0x1
.byte 0x9c
.byte 0x0
.section .debug_abbrev
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x10
.uleb128 0x6
.byte 0x0
.byte 0x0
.uleb128 0x2
.uleb128 0x2e
.byte 0x0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.byte 0x0
.byte 0x0
.byte 0x0
.section .debug_pubnames,"",@progbits
.long 0x20
.value 0x2
.long .Ldebug_info0
.long 0x4a
.long 0x25
.string "foo2"
.long 0x37
.string "foo1"
.long 0x0
.section .debug_aranges,"",@progbits
.long 0x1c
.value 0x2
.long .Ldebug_info0
.byte 0x4
.byte 0x0
.value 0x0
.value 0x0
.long .Ltext0
.long .Letext0-.Ltext0
.long 0x0
.long 0x0
.section .debug_str,"MS",@progbits,1
.LASF2:
.string "GNU C 4.4.4"
.LASF0:
.string "foo2"
.LASF1:
.string "foo1"
.LASF4:
.string "."
.LASF3:
.string "dw2-compress-2.c"

View File

@ -238,6 +238,7 @@ if [expr [istarget "i*86-*-*"] || [istarget "x86_64-*-*"]] then {
}
if [expr [istarget "*-*-linux*"]] then {
run_dump_test "dw2-compress-1"
run_dump_test "dw2-compress-2"
}
}
@ -401,6 +402,10 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "l1om"
run_dump_test "x86-64-localpic"
run_dump_test "debug1"
if [istarget "*-*-linux*"] then {
run_dump_test "x86-64-dw2-compress-2"
}
}
set ASFLAGS "$old_ASFLAGS"

View File

@ -0,0 +1,6 @@
#as: --compress-debug-sections
#addr2line: 0x0 0x10 -e
#name: 64bit DWARF2 debugging information 2
./dw2-compress-2.c:12
./dw2-compress-2.c:6

View File

@ -0,0 +1,142 @@
.file "dw2-compress-2.c"
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.section .debug_line,"",@progbits
.Ldebug_line0:
.text
.Ltext0:
.cfi_sections .debug_frame
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB1:
.file 1 "dw2-compress-2.c"
.loc 1 11 0
.cfi_startproc
.loc 1 12 0
rep
ret
.cfi_endproc
.LFE1:
.size foo2, .-foo2
.p2align 4,,15
.globl foo1
.type foo1, @function
foo1:
.LFB0:
.loc 1 5 0
.cfi_startproc
.loc 1 6 0
jmp bar
.cfi_endproc
.LFE0:
.size foo1, .-foo1
.Letext0:
.section .debug_info
.long 0x5e
.value 0x3
.long .Ldebug_abbrev0
.byte 0x8
.uleb128 0x1
.long .LASF2
.byte 0x1
.long .LASF3
.long .LASF4
.quad .Ltext0
.quad .Letext0
.long .Ldebug_line0
.uleb128 0x2
.byte 0x1
.long .LASF0
.byte 0x1
.byte 0xa
.quad .LFB1
.quad .LFE1
.byte 0x1
.byte 0x9c
.uleb128 0x2
.byte 0x1
.long .LASF1
.byte 0x1
.byte 0x4
.quad .LFB0
.quad .LFE0
.byte 0x1
.byte 0x9c
.byte 0x0
.section .debug_abbrev
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x10
.uleb128 0x6
.byte 0x0
.byte 0x0
.uleb128 0x2
.uleb128 0x2e
.byte 0x0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.byte 0x0
.byte 0x0
.byte 0x0
.section .debug_pubnames,"",@progbits
.long 0x20
.value 0x2
.long .Ldebug_info0
.long 0x62
.long 0x2d
.string "foo2"
.long 0x47
.string "foo1"
.long 0x0
.section .debug_aranges,"",@progbits
.long 0x2c
.value 0x2
.long .Ldebug_info0
.byte 0x8
.byte 0x0
.value 0x0
.value 0x0
.quad .Ltext0
.quad .Letext0-.Ltext0
.quad 0x0
.quad 0x0
.section .debug_str,"MS",@progbits,1
.LASF2:
.string "GNU C 4.4.4"
.LASF0:
.string "foo2"
.LASF1:
.string "foo1"
.LASF4:
.string "."
.LASF3:
.string "dw2-compress-2.c"

View File

@ -402,6 +402,7 @@ proc run_dump_tests { testcases {extra_options {}} } {
# as: FLAGS
# When assembling FILE.s, pass FLAGS to the assembler.
#
# addr2line: FLAGS
# nm: FLAGS
# objcopy: FLAGS
# objdump: FLAGS
@ -410,7 +411,7 @@ proc run_dump_tests { testcases {extra_options {}} } {
# FLAGS, in addition to the .o file name. Note that they are run
# with LC_ALL=C in the environment to give consistent sorting
# of symbols. If no FLAGS are needed then use:
# PROG: [nm objcopy objdump readelf]
# PROG: [nm objcopy objdump readelf addr2line]
# instead.
#
# source: SOURCE
@ -468,6 +469,7 @@ proc run_dump_test { name {extra_options {}} } {
global subdir srcdir
global OBJDUMP NM AS OBJCOPY READELF
global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS
global ADDR2LINE ADDR2LINEFLAGS
global host_triplet
global env
@ -483,6 +485,7 @@ proc run_dump_test { name {extra_options {}} } {
unresolved $subdir/$name
return
}
set opts(addr2line) {}
set opts(as) {}
set opts(objdump) {}
set opts(nm) {}
@ -561,6 +564,7 @@ proc run_dump_test { name {extra_options {}} } {
if { $opts(error) == "" && $opts(error-output) == "" } {
if {$opts(PROG) != ""} {
switch -- $opts(PROG) {
addr2line { set program addr2line }
objdump { set program objdump }
nm { set program nm }
objcopy { set program objcopy }
@ -572,7 +576,7 @@ proc run_dump_test { name {extra_options {}} } {
}
} else {
# Guess which program to run, by seeing which option was specified.
foreach p {objdump objcopy nm readelf} {
foreach p {objdump objcopy nm readelf addr2line} {
if {$opts($p) != ""} {
if {$program != ""} {
perror "ambiguous dump program in $file.d"
@ -790,7 +794,7 @@ proc slurp_options { file } {
set nws {[^ ]*}
# whitespace is ignored anywhere except within the options list;
# option names are alphabetic plus dash
set pat "^#${ws}(\[a-zA-Z-\]*)$ws:${ws}(.*)$ws\$"
set pat "^#${ws}(\[a-zA-Z0-9-\]*)$ws:${ws}(.*)$ws\$"
while { [gets $f line] != -1 } {
set line [string trim $line]
# Whitespace here is space-tab.