aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-05-20 08:55:51 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-05-20 08:55:51 +0000
commitb3c8eb43f1e3f7d21851b3d82f9438ec372f9417 (patch)
tree41860298d2d4d7b2793dc52309edd32ed27e4eb6 /gdb/testsuite
parent5583de77a97f8b3ab60ab9b84443b7dd53a7d792 (diff)
downloadgdb-b3c8eb43f1e3f7d21851b3d82f9438ec372f9417.zip
gdb-b3c8eb43f1e3f7d21851b3d82f9438ec372f9417.tar.gz
gdb-b3c8eb43f1e3f7d21851b3d82f9438ec372f9417.tar.bz2
gdb/
Fix -readnow for -gdwarf-4 unused type units. * dwarf2read.c (struct signatured_type): Remove the field offset. (create_signatured_type_table_from_index): Remove its initialization. (create_debug_types_hash_table): Likewise. Initialize per_cu.offset instead. Add a complaint call. (process_psymtab_comp_unit): Change assignment to gdb_assert. (process_type_comp_unit, lookup_die_type, dump_die_shallow) (lookup_signatured_type_at_offset, read_signatured_type) (write_one_signatured_type): Update the field for per_cu. gdb/testsuite/ Fix -readnow for -gdwarf-4 unused type units. * gdb.dwarf2/dw4-sig-type-unused.S: New file. * gdb.dwarf2/dw4-sig-type-unused.exp: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S87
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp36
3 files changed, 129 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 974b302..f1e6eea 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-20 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix -readnow for -gdwarf-4 unused type units.
+ * gdb.dwarf2/dw4-sig-type-unused.S: New file.
+ * gdb.dwarf2/dw4-sig-type-unused.exp: New file.
+
2011-05-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/kill-after-signal.c: New file.
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S
new file mode 100644
index 0000000..c5f33f4
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S
@@ -0,0 +1,87 @@
+/* Copyright 2011 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/>. */
+
+ .section .debug_info
+debug_start:
+ .long debug_end - 1f /* Length of Compilation Unit Info */
+1:
+ .2byte 0x4 /* DWARF version number */
+ .long .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x4 /* Pointer Size (in bytes) */
+ .uleb128 0x3 /* (DIE (0xb) DW_TAG_compile_unit) */
+ .ascii "GNU C 4.4.3\0" /* DW_AT_producer */
+ .byte 0x0c /* DW_AT_language = DW_LANG_C99 */
+ .ascii "1.c\0" /* DW_AT_name */
+debug_end:
+
+ .section .debug_types
+types_start:
+ .macro unit sig1 sig2 name
+ .long 2f - 1f /* Length of Compilation Unit Info */
+1:
+ .2byte 0x4 /* DWARF version number */
+ .long .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x4 /* Pointer Size (in bytes) */
+ /* signature */
+ .4byte \sig1
+ .4byte \sig2
+ .long 3f-types_start /* offset into type DIE */
+ .uleb128 0x1 /* DW_TAG_type_unit) */
+ .byte 0x0c /* DW_AT_language = DW_LANG_C99 */
+3:
+ .uleb128 0x2 /* DW_TAG_structure_type */
+ .ascii "\name" /* DW_AT_name ... */
+ .byte 0 /* ... DW_AT_name */
+ .4byte 0 /* DW_AT_byte_size */
+ .byte 0x0 /* end of children of CU */
+2:
+ .endm
+
+ unit 0x01234567, 0x01234567, foo
+ /* One duplicate. */
+ unit 0x01234567, 0x01234567, foo
+ /* One different, but still unused. */
+ unit 0x89abcdef, 0x89abcdef, bar
+
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_type_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x2 /* (abbrev code) */
+ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x0b /* (DW_AT_byte_size) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
new file mode 100644
index 0000000..9e4bc74
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.exp
@@ -0,0 +1,36 @@
+# Copyright 2011 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/>.
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+set testfile "dw4-sig-type-unused"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+ return -1
+}
+
+set saved_gdbflags $GDBFLAGS
+set GDBFLAGS "$GDBFLAGS --readnow"
+clean_restart $executable
+set GDBFLAGS $saved_gdbflags
+
+gdb_test "p 1" " = 1" "alive"