]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LVU: add gas testcases for view numbering
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 27 Apr 2017 06:59:58 +0000 (03:59 -0300)
committerAlexandre Oliva <aoliva@redhat.com>
Thu, 27 Apr 2017 07:02:17 +0000 (04:02 -0300)
gas/testsuite/gas/elf/dwarf2-5.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf2-5.s [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf2-6.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf2-6.s [new file with mode: 0644]
gas/testsuite/gas/elf/elf.exp

diff --git a/gas/testsuite/gas/elf/dwarf2-5.d b/gas/testsuite/gas/elf/dwarf2-5.d
new file mode 100644 (file)
index 0000000..7cb1725
--- /dev/null
@@ -0,0 +1,24 @@
+#as:
+#readelf: -x.rodata -wL
+#name: DWARF2 5
+
+Hex dump of section '\.rodata':
+  0x00000000 01010201 010203 *.*
+
+Decoded dump of debug contents of section \.debug_line:
+
+CU: dwarf2-5\.c:
+File name  *Line number  *Starting address  *View
+dwarf2-5\.c  *1  *0
+dwarf2-5\.c  *2  *0  *1
+dwarf2-5\.c  *3  *0x4
+dwarf2-5\.c  *4  *0x4  *1
+dwarf2-5\.c  *5  *0x4  *2
+dwarf2-5\.c  *6  *0x8
+dwarf2-5\.c  *7  *0xc
+dwarf2-5\.c  *8  *0xc  *1
+dwarf2-5\.c  *9  *0x10
+dwarf2-5\.c  *10  *0x10  *1
+dwarf2-5\.c  *11  *0x10  *2
+dwarf2-5\.c  *12  *0x10  *3
+dwarf2-5\.c  *12  *0x14
diff --git a/gas/testsuite/gas/elf/dwarf2-5.s b/gas/testsuite/gas/elf/dwarf2-5.s
new file mode 100644 (file)
index 0000000..9483b82
--- /dev/null
@@ -0,0 +1,58 @@
+/* Test view numbering.
+
+   Copyright (C) 2017 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, see <http://www.gnu.org/licenses/>.  */
+
+       .file "dwarf2-5.c"
+       .text
+       .align 4
+       .globl _start
+_start:
+       .file 1 "dwarf2-5.c"
+       .loc 1 1 view 0
+       .loc 1 2 view .L2
+       .int 0
+       .loc 1 3 view 0
+       .align 4
+       .loc 1 4 view .L4
+       .loc 1 5 view .L5
+       .org .+1
+       .align 4
+       .loc 1 6 view 0
+       .int 0
+       .text
+       .globl func
+       .type func, %function
+func:
+       .loc 1 7 view 0
+       .loc 1 8 view .L8
+       .int 0
+       .loc 1 9 view 0
+       .loc 1 10 view .L10
+       .pushsection .text
+       .loc 1 11 view .L11
+       .popsection
+       .loc 1 12 view .L12
+       .int 0
+       .size func, .-func
+
+       .section .rodata
+       .uleb128 .L2
+       .uleb128 .L4
+       .uleb128 .L5
+       .uleb128 .L8
+       .uleb128 .L10
+       .uleb128 .L11
+       .uleb128 .L12
diff --git a/gas/testsuite/gas/elf/dwarf2-6.d b/gas/testsuite/gas/elf/dwarf2-6.d
new file mode 100644 (file)
index 0000000..eed484e
--- /dev/null
@@ -0,0 +1,19 @@
+#as:
+#readelf: -wL
+#name: DWARF2 6
+
+Decoded dump of debug contents of section \.debug_line:
+
+CU: dwarf2-6\.c:
+File name  *Line number  *Starting address  *View
+dwarf2-6\.c  *1  *0
+dwarf2-6\.c  *1  *0  *1
+dwarf2-6\.c  *1  *0x1
+dwarf2-6\.c  *1  *0x1  *1
+dwarf2-6\.c  *1  *0x2
+dwarf2-6\.c  *1  *0x3  *1
+dwarf2-6\.c  *2  *0x3  *2
+dwarf2-6\.c  *3  *0x4
+dwarf2-6\.c  *3  *0x4  *1
+dwarf2-6\.c  *3  *0xf3
+dwarf2-6\.c  *3  *0x100
diff --git a/gas/testsuite/gas/elf/dwarf2-6.s b/gas/testsuite/gas/elf/dwarf2-6.s
new file mode 100644 (file)
index 0000000..678d8a1
--- /dev/null
@@ -0,0 +1,101 @@
+/* Test view number decoding.
+
+   Copyright (C) 2017 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, see <http://www.gnu.org/licenses/>.  */
+
+       .file "dwarf2-6.c"
+       .text
+       .align 4
+       .globl _start
+_start:
+.L_start:
+       .org .+256
+.Lend_start:
+
+       .section .debug_line,"",%progbits
+       .4byte .Lline_end - .Lline_start  /* Initial length.  */
+.Lline_start:
+       .2byte 2 /* Dwarf Version.  */
+       .4byte .Lline_lines - .Lline_hdr
+.Lline_hdr:
+       .byte 1 /* Minimum insn length.  */
+       .byte 1 /* Default is_stmt.  */
+       .byte 1 /* Line base.  */
+       .byte 1 /* Line range.  */
+       .byte 0x10 /* Opcode base.  */
+
+       /* Standard lengths.  */
+       .byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0
+
+       .byte 0 /* Include directories.  */
+
+       /* File names.  */
+       .ascii "dwarf2-6.c\0"
+       .uleb128 0, 0, 0
+
+       .byte 0
+
+.Lline_lines:
+       .byte 0 /* DW_LNS_extended_op.  */
+       .uleb128 5
+       .byte 2 /* DW_LNE_set_address.  */
+       .4byte .L_start
+
+       .byte 1 /* DW_LNS_copy view 0.  */
+
+       .byte 1 /* DW_LNS_copy view 1.  */
+
+       .byte 0 /* DW_LNS_extended_op.  */
+       .uleb128 5
+       .byte 2 /* DW_LNE_set_address.  */
+       .4byte .L_start+1
+
+       .byte 1 /* DW_LNS_copy view 0.  */
+
+       .byte 2 /* DW_LNS_advance_pc by 0.  */
+       .uleb128 0
+
+       .byte 1 /* DW_LNS_copy view 1.  */
+
+       .byte 2 /* DW_LNS_advance_pc by 1 (reset view).  */
+       .uleb128 1
+
+       .byte 1 /* DW_LNS_copy view 0.  */
+
+       .byte 9 /* DW_LNS_fixed_advance_pc by 1.  */
+       .2byte 1 /* This opcode does NOT reset view.  */
+
+       .byte 1 /* DW_LNS_copy view 1.  */
+
+       .byte 16 /* Special opcode 0, PC+=0, Line+=1, view 2.  */
+
+       .byte 17 /* Special opcode 1, PC+=1 (reset view), Line+=1.  */
+
+       .byte 1 /* DW_LNS_copy view 1.  */
+
+       .byte 8 /* DW_LNS_const_add_pc by 239 (reset view).  */
+
+       .byte 1 /* DW_LNS_copy view 0.  */
+
+       .byte 0 /* DW_LNS_extended_op.  */
+       .uleb128 5
+       .byte 2 /* DW_LNE_set_address.  */
+       .4byte .Lend_start
+
+       .byte 0 /* DW_LNS_extended_op.  */
+       .uleb128 1
+       .byte 1 /* DW_LEN_end_of_sequence.  */
+
+.Lline_end:
index e4dd684b44c84b5bfa70e87cc0a84287f91b0fe0..199b8fdeb5f6a3c953a4367ce0a502c5a148f708 100644 (file)
@@ -213,6 +213,8 @@ if { [is_elf_format] } then {
     run_dump_test "dwarf2-2"
     run_dump_test "dwarf2-3"
     run_dump_test "dwarf2-4"
+    run_dump_test "dwarf2-5"
+    run_dump_test "dwarf2-6"
     run_dump_test "bss"
     run_dump_test "bad-bss"
     run_dump_test "bad-section-flag"