aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-05-04 17:27:01 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-05-04 17:27:01 +0000
commitff013f42f48f16bd8606a109bcaa49b7aa90499a (patch)
tree3fb23831c61d908b6b689719b3d4af5855193c9f /gdb/testsuite
parent85cbf3d35dae0aedb6f444a71e723187acdf1f1d (diff)
downloadgdb-ff013f42f48f16bd8606a109bcaa49b7aa90499a.zip
gdb-ff013f42f48f16bd8606a109bcaa49b7aa90499a.tar.gz
gdb-ff013f42f48f16bd8606a109bcaa49b7aa90499a.tar.bz2
gdb/
* Makefile.in: Update dependencies. * dwarf2read.c: Include "addrmap.h" (struct dwarf2_cu): New fields RANGES_OFFSET and HAS_RANGES_OFFSET. (dwarf2_ranges_read): New prototype. (dwarf2_build_psymtabs_hard): Initialize and prepare PSYMTABS_ADDRMAP. Add discontiguous range to PSYMTABS_ADDRMAP by DWARF2_RANGES_READ on HAS_RANGES_OFFSET, otherwise add there the contiguous range. (dwarf2_ranges_read): New parameter RANGES_PST, update the function comment for it. Add the found ranges to RANGES_PST. New variable BASEADDR, initialize it the common way. (dwarf2_get_pc_bounds): Update the caller for the new parameter. (read_partial_die): `DW_AT_ranges' now only sets RANGES_OFFSET and HAS_RANGES_OFFSET for the later processing. * objfiles.h (struct objfile): New field PSYMTABS_ADDRMAP. * symtab.c: Include "addrmap.h" (find_pc_sect_psymtab): Support reading the field PSYMTABS_ADDRMAP. Move the psymtab locator into ... (find_pc_sect_psymtab_closer): ... a new function. gdb/testsuite/ * gdb.dwarf2/dw2-ranges.S: Merge the secondary section with `.fini'. * gdb.dwarf2/dw2-ranges.exp: Compile also `dw2-ranges2.S' and `dw2-ranges3.S' and test also their MAIN2, FUNC2 and MAIN3 symbols. * gdb.dwarf2/dw2-ranges2.S, gdb.dwarf2/dw2-ranges3.S: New files.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges.S5
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges.exp22
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges2.S46
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ranges3.S36
5 files changed, 113 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1e9b3ec..7071545 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-04 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.dwarf2/dw2-ranges.S: Merge the secondary section with `.fini'.
+ * gdb.dwarf2/dw2-ranges.exp: Compile also `dw2-ranges2.S' and
+ `dw2-ranges3.S' and test also their MAIN2, FUNC2 and MAIN3 symbols.
+ * gdb.dwarf2/dw2-ranges2.S, gdb.dwarf2/dw2-ranges3.S: New files.
+
2008-05-04 Vladimir Prus <vladimir@codesourcery.com>
* lib/mi-support.exp (mi_run_cmd): Allow for =thread-created
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.S b/gdb/testsuite/gdb.dwarf2/dw2-ranges.S
index 1334c0c..ac450f7 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.S
@@ -35,7 +35,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 each other. */
+ .section .fini, "ax", @progbits
+
.globl func
.func func
func: .int 0
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
index 0009d82..a3ace15 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
@@ -30,9 +30,23 @@ if {![istarget *-*-linux*]
set testfile "dw2-ranges"
set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.o
+set srcfile2 ${testfile}2.S
+set srcfile3 ${testfile}3.S
+set objfile ${objdir}/${subdir}/${testfile}.o
+set objfile2 ${objdir}/${subdir}/${testfile}2.o
+set objfile3 ${objdir}/${subdir}/${testfile}3.o
+set binfile ${objdir}/${subdir}/${testfile}
-if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object debug] != "" } {
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {additional_flags=-gdwarf-2}] != "" } {
+ return -1
+}
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {additional_flags=-gdwarf-2}] != "" } {
+ return -1
+}
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" "${objfile3}" object {additional_flags=-gstabs}] != "" } {
+ return -1
+}
+if {[gdb_compile "${objfile} ${objfile2} ${objfile3}" "${binfile}" executable {}] != "" } {
return -1
}
@@ -46,4 +60,8 @@ 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 .*"
+gdb_test "info line main3" "Line \[0-9\]* of .* starts at address .* and ends at .*"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges2.S b/gdb/testsuite/gdb.dwarf2/dw2-ranges2.S
new file mode 100644
index 0000000..cf06f02
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges2.S
@@ -0,0 +1,46 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+ */
+
+/* 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.
+ */
+
+ /* Such directive is required by GAS for builds without `-g'. */
+ .file 1 "dw2-ranges2.S"
+
+ /* 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 each other. */
+ .section .fini, "ax", @progbits
+
+ .globl func2
+ .func func2
+func2: .int 0
+ .endfunc
+ .size func2, . - func2
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges3.S b/gdb/testsuite/gdb.dwarf2/dw2-ranges3.S
new file mode 100644
index 0000000..8e2c948
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges3.S
@@ -0,0 +1,36 @@
+/*
+ Copyright 2007, 2008 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/>.
+ */
+
+/* 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.
+ */
+
+ /* Such directive is required by GAS for builds without `-g'. */
+ .file 1 "dw2-ranges3.S"
+
+ /* 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 main3
+ .func main3
+main3: .int 0
+ .endfunc
+ .size main3, . - main3