commit 36d650aa2b2fa688c049ba73b4a8fc26a0b6742b Author: David Blaikie Date: Thu Apr 24 22:02:40 2014 -0700 Provide a test for GCC's default and part of Clang's -fstandalone-debug behavior. gdb/testsuite/ * gdb.base/pointer-to-def.exp: Verify that the compiler produces a definition for a type only used via pointer but with a definition available. Use Clang's -fstandalone-debug when running with clang to force this emission. * gdb.base/pointer-to-def.cc: Provides a defined type and a variable of pointer to that type. diff --git gdb/testsuite/ChangeLog gdb/testsuite/ChangeLog index c028cd5..78c3164 100644 --- gdb/testsuite/ChangeLog +++ gdb/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2014-04-24 David Blaikie + * gdb.base/pointer-to-def.exp: Verify that the compiler produces a + definition for a type only used via pointer but with a definition + available. Use Clang's -fstandalone-debug when running with clang to + force this emission. + * gdb.base/pointer-to-def.cc: Provides a defined type and a variable of + pointer to that type. + +2014-04-24 David Blaikie + * gdb.stabs/gdb11479.c (tag_dummy_enum): introduce a variable to cause clang to emit the full definition of type required by the test * gdb.stabs/gdb11479.exp (do_test): correct a typo in a test message diff --git gdb/testsuite/gdb.cp/pointer-to-def.cc gdb/testsuite/gdb.cp/pointer-to-def.cc new file mode 100644 index 0000000..f6499b9 --- /dev/null +++ gdb/testsuite/gdb.cp/pointer-to-def.cc @@ -0,0 +1,8 @@ +struct foo { + int i; +}; + +foo *f; + +int main() { +} diff --git gdb/testsuite/gdb.cp/pointer-to-def.exp gdb/testsuite/gdb.cp/pointer-to-def.exp new file mode 100644 index 0000000..2c51827 --- /dev/null +++ gdb/testsuite/gdb.cp/pointer-to-def.exp @@ -0,0 +1,35 @@ +# Copyright 2010-2014 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 . + +if { [skip_cplus_tests] } { continue } + +if { [get_compiler_info] } { + return -1 +} + +set additional_flags "" + +if { [test_compiler_info {clang-*-*}] } { + set additional_flags "-fstandalone-debug" +} + +standard_testfile .cc + +if { [prepare_for_testing ${testfile}.exp $testfile ${srcfile} "debug additional_flags=$additional_flags"] } { + untested pointer-to-def.exp + return -1 +} + +gdb_test "ptype f" "type = struct foo {\r\n int i;\r\n} \\*" "definition of foo"