Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Carlton <carlton@math.stanford.edu>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com, mec@shout.net
Cc: carlton@math.stanford.edu
Subject: [rfa/c++testsuite] (was Re: patch for PR gdb/574)
Date: Fri, 16 Aug 2002 16:10:00 -0000	[thread overview]
Message-ID: <ro13ctewgca.fsf_-_@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <20020816032649.GA30528@nevyn.them.org>

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]

In article <20020816032649.GA30528@nevyn.them.org>, Daniel Jacobowitz
<drow@mvista.com> writes:

> Also, I'd appreciate it if you would submit a testsuite patch to run
> the reduced testcase you wrote.  More tests are always good.

Here it is.  The bug seemed idiosyncratic enough to not really fit
into any of the files or into any other general schema that I could
think of, so I just put it in a new file named after the bug number.

David Carlton
carlton@math.stanford.edu

2002-08-16  David Carlton  <carlton@math.stanford.edu>

	* gdb.c++/pr-574.exp: New file.
	* gdb.c++/pr-574.cc: New file.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr-574.exp; new file --]
[-- Type: text/x-patch, Size: 2241 bytes --]

--- /dev/null	Thu Apr 11 07:25:15 2002
+++ pr-574.exp	Fri Aug 16 16:00:06 2002
@@ -0,0 +1,71 @@
+# Copyright 2002 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 the bug mentioned in PR gdb/574.  It's a bit
+# idiosyncratic, so I gave it its own file.
+
+# 2002-08-16  David Carlton <carlton@math.stanford.edu>
+
+# This file is part of the gdb testsuite
+
+if $tracelevel then {
+        strace $tracelevel
+        }
+
+if { [skip_cplus_tests] } { continue }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "pr-574"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+
+if ![runto_main] then {
+    perror "couldn't run to breakpoint"
+    continue
+}
+
+# One.
+gdb_test "break 20" "Breakpoint \[0-9\]*.*line 20\\."
+gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*pr-574\\.cc:20\r\n.*" "continue to 20"
+
+# This failed, as long as the code was compiled with GCC v. 2.
+
+# Different compilers order the data for <A> differently, so I'm not
+# matching the result exactly.
+
+gdb_test "print *theB" "\\$\[0-9\]* = {<A> = {\[^}\]*}, static b = <optimized out>}" "PR gdb/574"
+
+gdb_exit
+return 0

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: pr-574.cc; new file --]
[-- Type: text/x-patch, Size: 486 bytes --]

--- /dev/null	Thu Apr 11 07:25:15 2002
+++ pr-574.cc	Fri Aug 16 15:21:49 2002
@@ -0,0 +1,20 @@
+/*
+  An attempt to replicate PR gdb/574 with a shorter program.
+
+  Printing out *theB failed if the program was compiled with GCC 2.95.
+*/
+
+class A {
+public:
+  virtual void foo() {};		// Stick in a virtual function.
+  int a;				// Stick in a data member.
+};
+
+class B : public A {
+  static int b;				// Stick in a static data member.
+};
+
+int main()
+{
+  B *theB = new B;
+}

  parent reply	other threads:[~2002-08-16 23:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-22 12:02 patch for PR gdb/574 david carlton
2002-07-22 12:16 ` Daniel Jacobowitz
2002-07-22 12:18   ` david carlton
2002-07-23 16:47 ` Jim Blandy
2002-08-15 20:26 ` Daniel Jacobowitz
2002-08-15 20:48   ` David Carlton
2002-08-16 16:10   ` David Carlton [this message]
2002-08-22 10:10     ` [rfa/c++testsuite] (was Re: patch for PR gdb/574) David Carlton
2002-09-27 16:20       ` Andrew Cagney
2002-09-27 16:32         ` David Carlton
2002-09-27 16:42           ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ro13ctewgca.fsf_-_@jackfruit.Stanford.EDU \
    --to=carlton@math.stanford.edu \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec@shout.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox