Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Carlton <carlton@kealia.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [rfa] lookup_transparent_type hack
Date: Fri, 23 Jan 2004 23:06:00 -0000	[thread overview]
Message-ID: <yf2llnyi7sq.fsf@hawaii.kealia.com> (raw)
In-Reply-To: <yf2llnzk5jr.fsf@hawaii.kealia.com> (David Carlton's message of "Thu, 22 Jan 2004 14:00:08 -0800")

On Thu, 22 Jan 2004 14:00:08 -0800, David Carlton <carlton@kealia.com> said:

> These failures aren't caused by my patch to GDB - they happen with or
> without the patch - but I want to look into the reason for the
> behavior first before committing the patch.

I've looked into them; as I suspected, they didn't really have
anything to do with this patch.  There is a bug in the way I handle
the debug output that GCC 3.4 generates for classes in namespaces;
I'll submit a patch for that later this afternoon.  And, once I fixed
that bug, I discovered that, if you do:


  void func ()
  {
    C2 *obj = create2 ();

    return;
  }

and set a breakpoint on the 'return' line then, if it's compiled with
GCC 3.4, 'print *obj' claims that there isn't a variable named 'obj'.
Sigh.

So I tweaked rtti1.cc to avoid this issue.  With that change, I
committed the patch; the rtti1.cc part of the patch is below.

David Carlton
carlton@kealia.com

Index: testsuite/gdb.cp/rtti1.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/rtti1.cc,v
retrieving revision 1.1
diff -u -p -r1.1 rtti1.cc
--- testsuite/gdb.cp/rtti1.cc	23 Aug 2003 03:55:59 -0000	1.1
+++ testsuite/gdb.cp/rtti1.cc	23 Jan 2004 22:54:25 -0000
@@ -1,6 +1,6 @@
 /* Code to go along with tests in rtti.exp.
    
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright 2003, 2004 Free Software Foundation, Inc.
 
    Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
    Inc.
@@ -55,6 +55,26 @@ namespace n1 {
 
 } // n1
 
+// NOTE: carlton/2004-01-23: This call exists only to convince GCC to
+// keep around a reference to 'obj' in n2::func - GCC 3.4 had been
+// optimizing it away.
+void refer_to (n2::C2 *obj)
+{
+  // Do nothing.
+}
+
+namespace n2
+{
+  void func ()
+  {
+    C2 *obj = create2 ();
+
+    refer_to (obj);			// func-constructs-done
+
+    return;
+  }
+}
+
 int main()
 {
     using namespace n1;
@@ -63,5 +83,7 @@ int main()
     C1 *e1 = create1();
     C2 *e2 = create2();
 
-    return 0;				// constructs-done
+    n2::func();				// main-constructs-done
+
+    return 0;
 }


  parent reply	other threads:[~2004-01-23 23:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 23:58 David Carlton
2004-01-18 23:48 ` Elena Zannoni
2004-01-19  4:25 ` Daniel Jacobowitz
2004-01-22 22:00   ` David Carlton
2004-01-22 22:30     ` Daniel Jacobowitz
2004-01-23 23:06     ` David Carlton [this message]
2004-01-23 23:08       ` Daniel Jacobowitz

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=yf2llnyi7sq.fsf@hawaii.kealia.com \
    --to=carlton@kealia.com \
    --cc=gdb-patches@sources.redhat.com \
    /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