aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-07-14 19:46:01 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-07-14 19:46:01 +0000
commit368886ac463c9e75337621a29292de8ff5744ce6 (patch)
tree4cc193fa9c72affe05c2b03908b8ec08e426d199 /gas
parent3cbaedfff7a843d64792766c0322ea3a66ef6cb2 (diff)
downloadfsf-binutils-gdb-368886ac463c9e75337621a29292de8ff5744ce6.zip
fsf-binutils-gdb-368886ac463c9e75337621a29292de8ff5744ce6.tar.gz
fsf-binutils-gdb-368886ac463c9e75337621a29292de8ff5744ce6.tar.bz2
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/ChangeLog16
-rw-r--r--gas/testsuite/config/default.exp8
-rw-r--r--gas/testsuite/gas/i386/dw2-compress-2.d6
-rw-r--r--gas/testsuite/gas/i386/dw2-compress-2.s147
-rw-r--r--gas/testsuite/gas/i386/i386.exp5
-rw-r--r--gas/testsuite/gas/i386/x86-64-dw2-compress-2.d6
-rw-r--r--gas/testsuite/gas/i386/x86-64-dw2-compress-2.s142
-rw-r--r--gas/testsuite/lib/gas-defs.exp10
8 files changed, 337 insertions, 3 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 3a9cb57..f0ca9e0 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -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
diff --git a/gas/testsuite/config/default.exp b/gas/testsuite/config/default.exp
index ef4a531..044dba1 100644
--- a/gas/testsuite/config/default.exp
+++ b/gas/testsuite/config/default.exp
@@ -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
diff --git a/gas/testsuite/gas/i386/dw2-compress-2.d b/gas/testsuite/gas/i386/dw2-compress-2.d
new file mode 100644
index 0000000..b11474f
--- /dev/null
+++ b/gas/testsuite/gas/i386/dw2-compress-2.d
@@ -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
diff --git a/gas/testsuite/gas/i386/dw2-compress-2.s b/gas/testsuite/gas/i386/dw2-compress-2.s
new file mode 100644
index 0000000..0aa789c
--- /dev/null
+++ b/gas/testsuite/gas/i386/dw2-compress-2.s
@@ -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"
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 98e7ad6..1c8fb79 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -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"
diff --git a/gas/testsuite/gas/i386/x86-64-dw2-compress-2.d b/gas/testsuite/gas/i386/x86-64-dw2-compress-2.d
new file mode 100644
index 0000000..c605102
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-dw2-compress-2.d
@@ -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
diff --git a/gas/testsuite/gas/i386/x86-64-dw2-compress-2.s b/gas/testsuite/gas/i386/x86-64-dw2-compress-2.s
new file mode 100644
index 0000000..c46c0ef
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-dw2-compress-2.s
@@ -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"
diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp
index fd2f179..cfdecc4 100644
--- a/gas/testsuite/lib/gas-defs.exp
+++ b/gas/testsuite/lib/gas-defs.exp
@@ -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.