From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16267 invoked by alias); 16 Aug 2002 21:19:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16260 invoked from network); 16 Aug 2002 21:19:40 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by sources.redhat.com with SMTP; 16 Aug 2002 21:19:40 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id g7GLJaE24025; Fri, 16 Aug 2002 14:19:36 -0700 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: gdb-patches@sources.redhat.com Subject: [rfa/testsuite] more tests in gdb.c++/m-static Cc: carlton@math.stanford.edu From: David Carlton Date: Fri, 16 Aug 2002 14:19:00 -0000 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2002-08/txt/msg00455.txt.bz2 --=-=-= Content-length: 1579 I've added some tests to gdb.c++/m-static that correspond to the patch in ; patches below. A few tangential questions: * I hope I got the stuff in brackets in the subject correct; is rfa "request for approval"? * What's the convention for submitting new files (as opposed to patches to existing files)? (I'd look through the mail archive for examples, but I don't seem to be able to access it right now.) I'm attaching them below as files and hoping that the mailer will make it clear what they're named and so forth; please let me know if I should do anything else. * CONTRIBUTE suggests using "cvs diff -cp", but everybody submits unidiff patches. Should I change it to say "cvs diff -up"? * Does "make clean" actually clean up the testsuite directory properly? Looking at the Makefile in gdb.c++, it seems like it cleans up whatever's in the EXECUTABLES variable, which certainly doesn't include all the executables in that directory. Is there something else magic going on, or should I audit the Makefile.in's in the various directories to see if they clean up everything? (Yes, I know, I should really type "make clean" and see what it does, but I don't feel like rebuilding gdb if somebody can answer the question quickly.) Thanks, David Carlton carlton@math.stanford.edu 2002-08-16 David Carlton * gdb.c++/m-static.exp: Added test 4. * gdb.c++/m-static.cc: Ditto. * gdb.c++/m-static.h: New file. * gdb.c++/m-static1.cc: New file. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=m-static.exp.diff Content-Description: patch for m-static.exp Content-length: 3823 Index: m-static.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.exp,v retrieving revision 1.1 diff -u -p -r1.1 m-static.exp --- m-static.exp 30 May 2002 19:09:47 -0000 1.1 +++ m-static.exp 16 Aug 2002 20:59:29 -0000 @@ -16,6 +16,7 @@ # Tests for member static data # 2002-05-13 Benjamin Kosnik +# 2002-08-16 David Carlton # This file is part of the gdb testsuite @@ -33,9 +34,10 @@ set bug_id 0 set testfile "m-static" set srcfile ${testfile}.cc +set srcfile1 ${testfile}1.cc set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" "${binfile}" executable {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -55,8 +57,8 @@ if ![runto_main] then { } # One. -gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68" +gdb_test "break 72" "Breakpoint \[0-9\]*.*line 72\\." +gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:72\r\n.*" "continue to 72" # simple object, static const bool gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool" @@ -71,8 +73,8 @@ gdb_test "print test1.key2" "\\$\[0-9\]* gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum" # Two. -gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69" +gdb_test "break 73" "Breakpoint \[0-9\]*.*line 73\\." +gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:73\r\n.*" "continue to 73" # derived template object, base static const bool gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool" @@ -90,8 +92,11 @@ gdb_test "print test2.value" "\\$\[0-9\] gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum" # Three. -gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\." -gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71" + +# Setting a breakpoint at the test4 initializer doesn't work, since +# execution won't stop there. +gdb_test "break 76" "Breakpoint \[0-9\]*.*line 76\\." +gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:76\r\n.*" "continue to 76" # template object, static derived template data member's base static const bool gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool" @@ -107,6 +112,22 @@ gdb_test "print test3.data.value" "\\$\[ # template object, static derived template data member's static enum gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum" + +# 2002-08-16 +# Four. + +# No breakpoint: see test3 comment. + +# static const int initialized in another file. +gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere" + +# static const int that nobody initializes. From PR gdb/635. +gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere" + +# Perhaps at some point test4 should also include a test for a static +# const int that was initialized in the header file. But I'm not sure +# that GDB's current behavior in such situations is either consistent +# across platforms or optimal, so I'm not including one now. gdb_exit return 0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=m-static.cc.diff Content-Description: patch for m-static.cc Content-length: 713 Index: m-static.cc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/m-static.cc,v retrieving revision 1.1 diff -u -p -r1.1 m-static.cc --- m-static.cc 30 May 2002 19:09:47 -0000 1.1 +++ m-static.cc 16 Aug 2002 20:59:25 -0000 @@ -53,6 +53,10 @@ namespace __gnu_test template gnu_obj_2 gnu_obj_3::data(etruscan); + + // 2002-08-16 + // Test four. +#include "m-static.h" } // instantiate templates explicitly so their static members will exist @@ -67,6 +71,7 @@ int main() gnu_obj_1 test1(egyptian, 4589); gnu_obj_2 test2(roman); gnu_obj_3 test3(greek); + gnu_obj_4 test4; return 0; } --=-=-= Content-Disposition: attachment; filename=m-static.h Content-Description: m-static.h Content-length: 173 // 2002-08-16 class gnu_obj_4 { public: static const int elsewhere; static const int nowhere; // At some point, perhaps: // static const int everywhere = 317; }; --=-=-= Content-Disposition: attachment; filename=m-static1.cc Content-Description: m-static1.cc Content-length: 130 // 2002-08-16 namespace __gnu_test { #include "m-static.h" } using namespace __gnu_test; const int gnu_obj_4::elsewhere = 221; --=-=-=--