aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-08-25 00:09:14 +0000
committerDoug Evans <dje@google.com>2010-08-25 00:09:14 +0000
commit673bfd454bcb059022eb237ccae068c6a4446e49 (patch)
tree4a23be93b2906efb63a8b34111eb0f8f6c355b90 /gdb/testsuite
parent1e30cf071474933e8dc1b3ebb88d6cff7784ae70 (diff)
downloadgdb-673bfd454bcb059022eb237ccae068c6a4446e49.zip
gdb-673bfd454bcb059022eb237ccae068c6a4446e49.tar.gz
gdb-673bfd454bcb059022eb237ccae068c6a4446e49.tar.bz2
PR symtab/11942
* dwarf2read.c (dwarf2_per_objfile): New members debug_info_type_hash, debug_types_type_hash. (dwarf2_cu, dwarf2_per_cu_data): Delete member type_hash. All uses updated. (lookup_die_type): Renamed from tag_type_to_tag. First look in appropriate type_hash table. All callers updated. (allocate_signatured_type_table): Renamed from allocate_signatured_type_hash_table. All callers updated. (create_signatured_type_table_from_index): Renamed from create_signatured_type_hash_from_index. All callers updated. (read_die_type): Add comment. Move actual reading to ... (read_die_type_1): ... here. New function. (follow_die_ref_or_sig): Tweak comment. (set_die_type): Rewrite to use appropriate choice of debug_info_type_hash or debug_types_type_hash. (get_die_type_at_offset): New function. (get_die_type): Call it. testsuite/ PR symtab/11942 * gdb.dwarf2/dw4-sig-types.cc: New file. * gdb.dwarf2/dw4-sig-types.h: New file. * gdb.dwarf2/dw4-sig-types-b.cc: New file. * gdb.dwarf2/dw4-sig-types.exp: New file.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-types-b.cc16
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-types.cc12
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp42
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw4-sig-types.h15
5 files changed, 93 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3749928..adfa1a1 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-24 Doug Evans <dje@google.com>
+
+ PR symtab/11942
+ * gdb.dwarf2/dw4-sig-types.cc: New file.
+ * gdb.dwarf2/dw4-sig-types.h: New file.
+ * gdb.dwarf2/dw4-sig-types-b.cc: New file.
+ * gdb.dwarf2/dw4-sig-types.exp: New file.
+
2010-08-23 Tom Tromey <tromey@redhat.com>
PR python/11145:
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types-b.cc b/gdb/testsuite/gdb.dwarf2/dw4-sig-types-b.cc
new file mode 100644
index 0000000..140763a
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types-b.cc
@@ -0,0 +1,16 @@
+
+#include "dw4-sig-types.h"
+
+extern myns::bar_type myset;
+
+static myns::bar_type *
+bar ()
+{
+ return &myset;
+}
+
+void
+foo ()
+{
+ bar ();
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.cc b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.cc
new file mode 100644
index 0000000..47bd3d4
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.cc
@@ -0,0 +1,12 @@
+
+#include "dw4-sig-types.h"
+
+myns::bar_type myset;
+
+int
+main ()
+{
+ foo ();
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
new file mode 100644
index 0000000..650aa7a
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.exp
@@ -0,0 +1,42 @@
+# Copyright 2010 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/>.
+
+# Test dwarf4 signatured types.
+
+set test "dw4-sig-types"
+
+# This test is intended for targets which support DWARF-4.
+# Since we pass an explicit -gdwarf-4 to the compiler, we let
+# that be the test of whether the target supports it.
+
+if { [prepare_for_testing "${test}.exp" "${test}" \
+ {dw4-sig-types.cc dw4-sig-types-b.cc} \
+ {debug c++ additional_flags=-gdwarf-4}] } {
+ return -1
+}
+
+# Stress test gdb's handling of cached comp units, disable the cache.
+gdb_test_no_output "maint set dwarf2 max-cache-age 0"
+
+if ![runto_main] {
+ return -1
+}
+
+# Bring symtab for myset into gdb.
+gdb_test "p myset" ".*"
+
+# This is enough to trigger the problem in PR 11942.
+gdb_breakpoint "foo"
+gdb_continue "foo"
diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-types.h b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.h
new file mode 100644
index 0000000..a11d096
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-types.h
@@ -0,0 +1,15 @@
+
+#include <set>
+using std::set;
+
+namespace myns
+{
+
+struct bar_type
+{
+ set<int> foo;
+};
+
+} // myns
+
+extern void foo ();