aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-11-27 18:48:43 +0100
committerTom de Vries <tdevries@suse.de>2024-11-27 18:48:43 +0100
commit4c5d88facd74c392737882608c001b17b7aeb017 (patch)
tree040d55f7aa95e07351bc3a713d680c25fcf2f7b7 /gdb
parente33e55b6651f230762ccfe248037263e511b41b3 (diff)
downloadgdb-4c5d88facd74c392737882608c001b17b7aeb017.zip
gdb-4c5d88facd74c392737882608c001b17b7aeb017.tar.gz
gdb-4c5d88facd74c392737882608c001b17b7aeb017.tar.bz2
[gdb/testsuite] Add gdb.dwarf2/dw2-tu-dwarf-4-5.exp
Add a regression test for PR symtab/32225. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c52
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c58
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp63
3 files changed, 173 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c
new file mode 100644
index 0000000..8f22096
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5-2.c
@@ -0,0 +1,52 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024 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/>. */
+
+namespace sp2 {
+ class B {
+ float f;
+ const float f1 = 1;
+ const float f2 = 1;
+ const float f3 = 1;
+ const float f4 = 1;
+ const float f5 = 1;
+ const float f6 = 1;
+ const float f7 = 1;
+ const float f8 = 1;
+ const float f10 = 1;
+ const float f11 = 1;
+ const float f12 = 1;
+ const float f13 = 1;
+ const float f14 = 1;
+ const float f15 = 1;
+ const float f16 = 1;
+ const float f17 = 1;
+ const float f18 = 1;
+ const float f19 = 1;
+ const float f20 = 1;
+ const float f21 = 1;
+ const float f22 = 1;
+ const float f23 = 1;
+ const float f24 = 1;
+ const float f25 = 1;
+ const float f26 = 1;
+ const float f27 = 1;
+ const float f28 = 1;
+ const float f29 = 1;
+ };
+}
+
+sp2::B b;
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c
new file mode 100644
index 0000000..d723d73
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.c
@@ -0,0 +1,58 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2024 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/>. */
+
+namespace sp1 {
+ class A {
+ int i;
+ const int f1 = 1;
+ const int f2 = 1;
+ const int f3 = 1;
+ const int f4 = 1;
+ const int f5 = 1;
+ const int f6 = 1;
+ const int f7 = 1;
+ const int f8 = 1;
+ const int f10 = 1;
+ const int f11 = 1;
+ const int f12 = 1;
+ const int f13 = 1;
+ const int f14 = 1;
+ const int f15 = 1;
+ const int f16 = 1;
+ const int f17 = 1;
+ const int f18 = 1;
+ const int f19 = 1;
+ const int f20 = 1;
+ const int f21 = 1;
+ const int f22 = 1;
+ const int f23 = 1;
+ const int f24 = 1;
+ const int f25 = 1;
+ const int f26 = 1;
+ const int f27 = 1;
+ const int f28 = 1;
+ const int f29 = 1;
+ };
+}
+
+sp1::A a;
+
+extern "C" {
+ void _start (void)
+ {
+ }
+}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp
new file mode 100644
index 0000000..03c26e6
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-tu-dwarf-4-5.exp
@@ -0,0 +1,63 @@
+# Copyright 2024 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
+
+# Minimal DWARF-2 unit test
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+require dwarf2_support
+
+standard_testfile .c -2.c
+
+set opts {}
+lappend opts debug
+lappend opts c++
+lappend opts additional_flags=-gdwarf-4
+lappend opts additional_flags=-fdebug-types-section
+
+set opts2 {}
+lappend opts2 debug
+lappend opts2 c++
+lappend opts2 dwarf5
+lappend opts2 additional_flags=-fdebug-types-section
+
+set lopts {}
+lappend lopts debug
+lappend lopts c++
+lappend lopts additional_flags=-nostdlib
+
+if { [prepare_for_testing_full "failed to prepare" \
+ [list $testfile $lopts \
+ $srcfile $opts \
+ $srcfile2 $opts2]] } {
+ return -1
+}
+
+gdb_test_no_output \
+ [join \
+ [list \
+ "pipe maint print objfiles" \
+ "grep -E \"qualified:.*::A$\"" \
+ "grep -v -E \"(sp1::A|sp1::A::A)$\""] \
+ "|"]
+
+gdb_test_no_output \
+ [join \
+ [list \
+ "pipe maint print objfiles" \
+ "grep -E \"qualified:.*::B$\"" \
+ "grep -v -E \"(sp2::B|sp2::B::B)$\""] \
+ "|"]