aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-02-02 14:58:33 +0000
committerTom Tromey <tromey@redhat.com>2012-02-02 14:58:33 +0000
commitf149aabd9635963a60436c536fdc56436b927fd4 (patch)
treec46d52c32297f85f4dfd9b228d811d88ff8f183a /gdb
parentfacf03f2c394065666184d7d842e1488eaba355d (diff)
downloadgdb-f149aabd9635963a60436c536fdc56436b927fd4.zip
gdb-f149aabd9635963a60436c536fdc56436b927fd4.tar.gz
gdb-f149aabd9635963a60436c536fdc56436b927fd4.tar.bz2
PR gdb/9307:
* symtab.c (lookup_language_this): Set block_found. gdb/testsuite * gdb.cp/dispcxx.exp: New file. * gdb.cp/dispcxx.cc: New file.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/symtab.c5
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.cp/dispcxx.cc39
-rw-r--r--gdb/testsuite/gdb.cp/dispcxx.exp41
5 files changed, 94 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c9ae098..4ca12dc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-02 Tom Tromey <tromey@redhat.com>
+
+ PR gdb/9307:
+ * symtab.c (lookup_language_this): Set block_found.
+
2012-02-01 Tom Tromey <tromey@redhat.com>
PR gdb/13431:
diff --git a/gdb/symtab.c b/gdb/symtab.c
index c6314c9..61f7536 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1232,7 +1232,10 @@ lookup_language_this (const struct language_defn *lang,
sym = lookup_block_symbol (block, lang->la_name_of_this, VAR_DOMAIN);
if (sym != NULL)
- return sym;
+ {
+ block_found = block;
+ return sym;
+ }
if (BLOCK_FUNCTION (block))
break;
block = BLOCK_SUPERBLOCK (block);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a5c0cd7..c42cf7d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-02 Tom Tromey <tromey@redhat.com>
+
+ * gdb.cp/dispcxx.exp: New file.
+ * gdb.cp/dispcxx.cc: New file.
+
2012-02-01 Tom Tromey <tromey@redhat.com>
* gdb.base/jit-simple.exp: New file.
diff --git a/gdb/testsuite/gdb.cp/dispcxx.cc b/gdb/testsuite/gdb.cp/dispcxx.cc
new file mode 100644
index 0000000..2bc15e4
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/dispcxx.cc
@@ -0,0 +1,39 @@
+/* Test for displays in C++.
+
+ Copyright 2012 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/>.
+*/
+
+struct K {
+ void method () { }
+
+ int k;
+
+ K() : k(23) { }
+
+ int m2 ()
+ {
+ k += 7; // Break here
+ return k;
+ }
+};
+
+int main() {
+ K k;
+
+ k.method();
+ return k.m2();
+}
+
diff --git a/gdb/testsuite/gdb.cp/dispcxx.exp b/gdb/testsuite/gdb.cp/dispcxx.exp
new file mode 100644
index 0000000..da35c11
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/dispcxx.exp
@@ -0,0 +1,41 @@
+# Copyright 2012 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/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile dispcxx
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile} "c++"] {
+ untested dispcxx.exp
+ return -1
+}
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+ return -1
+}
+
+if ![runto_main] then {
+ perror "couldn't run to main"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "Break here"]
+gdb_continue_to_breakpoint here
+
+# Regression test for
+# http://sourceware.org/bugzilla/show_bug.cgi?id=9307.
+gdb_test "display k" "1: k = 23"