diff options
author | Tom Tromey <tromey@redhat.com> | 2012-02-02 14:58:28 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-02-02 14:58:28 +0000 |
commit | f20ae89f3501ae4761f5e55b152a1241125f2131 (patch) | |
tree | 68128292aebcae6f2412a4157150f9859e8453f1 /gdb/testsuite/gdb.cp | |
parent | 04ab626d8cbd9c2ce0bdb24438fb5dd25970caac (diff) | |
download | gdb-f20ae89f3501ae4761f5e55b152a1241125f2131.tar.gz |
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/testsuite/gdb.cp')
-rw-r--r-- | gdb/testsuite/gdb.cp/dispcxx.cc | 39 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/dispcxx.exp | 41 |
2 files changed, 80 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/dispcxx.cc b/gdb/testsuite/gdb.cp/dispcxx.cc new file mode 100644 index 00000000000..2bc15e47936 --- /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 00000000000..da35c114431 --- /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" |