--- /dev/null 2003-09-15 19:10:47.000000000 +0530 +++ testsuite/gdb.base/gdb1821.exp 2004-12-06 09:07:46.925182104 +0530 @@ -0,0 +1,49 @@ +# Copyright 2003 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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Tests for PR gdb/1821. +# 2004-12-06 Ramana Radhakrishnan + +# This file is part of the gdb testsuite. + +if $tracelevel then { + strace $tracelevel + } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "gdb1821" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +gdb_exit +gdb_start +gdb_load ${binfile} + +if ![runto main] then { + perror "couldn't run to breakpoint" + continue +} +gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}" + --- /dev/null 2003-09-15 19:10:47.000000000 +0530 +++ testsuite/gdb.base/gdb1821.c 2004-12-06 09:08:45.644255448 +0530 @@ -0,0 +1,25 @@ +/* Test printing of structure member names in gdb. PR exp/1821 + + Copyright 2004, Free Software Foundation, Inc. + + This file is part of GDB. + + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +struct foo { double x__0, y__0, z__1; } bar; + + +int main(void) { return 0; } --- cp-valprint.c.~1.27.~ 2004-12-06 02:26:31.000000000 +0530 +++ cp-valprint.c 2004-12-06 08:39:29.487231896 +0530 @@ -35,6 +35,7 @@ #include "target.h" #include "cp-abi.h" #include "valprint.h" +#include "language.h" int vtblprint; /* Controls printing of vtbl's */ int objectprint; /* Controls looking up an object's derived type @@ -317,11 +318,11 @@ if (TYPE_FIELD_STATIC (type, i)) fputs_filtered ("static ", stream); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), - language_cplus, + current_language->la_language, DMGL_PARAMS | DMGL_ANSI); fputs_filtered ("\" \"", stream); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), - language_cplus, + current_language->la_language, DMGL_PARAMS | DMGL_ANSI); fputs_filtered ("\") \"", stream); } @@ -332,7 +333,7 @@ if (TYPE_FIELD_STATIC (type, i)) fputs_filtered ("static ", stream); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), - language_cplus, + current_language->la_language , DMGL_PARAMS | DMGL_ANSI); annotate_field_name_end (); /* do not print leading '=' in case of anonymous unions */