From: Joel Brobecker <brobecker@gnat.com>
To: Elena Zannoni <ezannoni@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: [RFA/dwarf-2] Fix for the null record problem
Date: Thu, 26 Feb 2004 19:00:00 -0000 [thread overview]
Message-ID: <20040226190011.GE1154@gnat.com> (raw)
In-Reply-To: <20040226032743.GA30615@nevyn.them.org>
[-- Attachment #1: Type: text/plain, Size: 501 bytes --]
> I'd like to have the empty struct test anyway. Remember to add a
> variable of that type if you add a type to class2.cc; or newer GCCs
> will just elide the type.
Would the following patch be ok to apply?
2004-02-26 J. Brobecker <brobecker@gnat.com>
* gdb.cp/class2.cc (empty): New class.
(refer): New function.
(main): Declare an object of type empty and use it.
* gdb.cp/class2.exp: Print the value of an object of type empty.
Tested on x86-linux.
--
Joel
[-- Attachment #2: empty.diff --]
[-- Type: text/plain, Size: 1294 bytes --]
Index: class2.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/class2.cc,v
retrieving revision 1.2
diff -u -r1.2 class2.cc
--- class2.cc 11 Feb 2004 14:01:25 -0000 1.2
+++ class2.cc 26 Feb 2004 18:51:32 -0000
@@ -48,10 +48,19 @@
;
}
+struct empty {};
+
+// Stop the compiler from optimizing away data.
+void refer (empty *)
+{
+ ;
+}
+
int main (void)
{
A alpha, *aap, *abp;
B beta, *bbp;
+ empty e;
alpha.a1 = 100;
beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
@@ -59,6 +68,7 @@
aap = α refer (aap);
abp = β refer (abp);
bbp = β refer (bbp);
+ refer (&e);
return 0; // marker return 0
} // marker close brace
Index: class2.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/class2.exp,v
retrieving revision 1.1
diff -u -r1.1 class2.exp
--- class2.exp 25 Nov 2003 15:01:31 -0000 1.1
+++ class2.exp 26 Feb 2004 18:51:32 -0000
@@ -113,3 +113,7 @@
gdb_test "print * (B *) abp" \
"= {.*a1 = 200.*b1 = 201.*b2 = 202}" \
"print * (B *) abp at marker return 0"
+
+# Printing the value of an object containing no data fields:
+
+gdb_test "p e" "= {<No data fields>}" "print object with no data fields"
next prev parent reply other threads:[~2004-02-26 19:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-19 14:01 Joel Brobecker
2004-02-19 21:52 ` Elena Zannoni
2004-02-19 23:29 ` Andrew Cagney
2004-02-19 23:37 ` Joel Brobecker
2004-02-26 2:31 ` Joel Brobecker
2004-02-26 3:27 ` Daniel Jacobowitz
2004-02-26 19:00 ` Joel Brobecker [this message]
2004-04-01 1:18 ` Joel Brobecker
2004-04-13 5:26 ` Joel Brobecker
2004-04-14 17:24 ` Jim Blandy
2004-04-14 17:47 ` Daniel Jacobowitz
2004-04-15 5:01 ` Jim Blandy
2004-04-15 20:43 ` Joel Brobecker
2004-04-16 3:18 ` Joel Brobecker
2004-04-16 3:59 ` Jim Blandy
2004-04-15 5:33 ` Jim Blandy
2004-02-26 19:49 Michael Elizabeth Chastain
2004-02-26 20:23 ` Joel Brobecker
2004-02-26 21:34 Michael Elizabeth Chastain
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=20040226190011.GE1154@gnat.com \
--to=brobecker@gnat.com \
--cc=ezannoni@redhat.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