2007-11-30 Jan Kratochvil * gdb.dwarf2/dw2-ranges2.S: New file. * gdb.dwarf2/dw2-ranges.S: Merge the secondary section with `.fini'. * gdb.dwarf2/dw2-ranges.exp: Compile also "dw2-ranges2.S" and test also its MAIN2 and FUNC2 symbols. --- ./gdb/testsuite/gdb.dwarf2/dw2-ranges.S 25 Nov 2007 21:40:39 -0000 1.1 +++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.S 30 Nov 2007 15:01:49 -0000 @@ -32,7 +32,10 @@ main: .int 0 .endfunc .size main, . - main - .section .text.func, "ax", @progbits + /* `.fini' section is here to make sure `dw2-ranges.S' + vs. `dw2-ranges2.S' overlap their DW_AT_ranges with eac other. */ + .section .fini, "ax", @progbits + .globl func .func func func: .int 0 --- ./gdb/testsuite/gdb.dwarf2/dw2-ranges.exp 25 Nov 2007 21:40:39 -0000 1.1 +++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges.exp 30 Nov 2007 15:01:49 -0000 @@ -30,9 +30,10 @@ if {![istarget *-*-linux*] set testfile "dw2-ranges" set srcfile ${testfile}.S -set binfile ${objdir}/${subdir}/${testfile}.o +set srcfile2 ${testfile}2.S +set binfile ${objdir}/${subdir}/${testfile} -if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object debug] != "" } { +if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable debug] != "" } { return -1 } @@ -46,4 +47,7 @@ gdb_load ${binfile} # Wrong output: # No line number information available for address 0x4 +gdb_test "info line main" "Line \[0-9\]* of .* starts at address .* and ends at .*" gdb_test "info line func" "Line \[0-9\]* of .* starts at address .* and ends at .*" +gdb_test "info line main2" "Line \[0-9\]* of .* starts at address .* and ends at .*" +gdb_test "info line func2" "Line \[0-9\]* of .* starts at address .* and ends at .*" --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ./gdb/testsuite/gdb.dwarf2/dw2-ranges2.S 30 Nov 2007 15:01:49 -0000 @@ -0,0 +1,43 @@ +/* + Copyright 2007 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 . + */ + +/* Despite the sections below will be adjacent the assembler has to produce + DW_AT_ranges as the linker could place both sections at arbitrary locations. + */ + + /* Without this directive GAS will not emit DWARF2 unless we provide an + instruction to assemble. We want to avoid any instructions to + remain architecture independent. */ + .loc_mark_labels 1 + + .text + + .globl main2 + .func main2 +main2: .int 0 + .endfunc + .size main2, . - main2 + + /* `.fini' section is here to make sure `dw2-ranges.S' + vs. `dw2-ranges2.S' overlap their DW_AT_ranges with eac other. */ + .section .fini, "ax", @progbits + + .globl func2 + .func func2 +func2: .int 0 + .endfunc + .size func2, . - func2