From: Vladimir Prus <vladimir@codesourcery.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: RFA: unbreak typedefed bitfield
Date: Mon, 21 Dec 2009 09:51:00 -0000 [thread overview]
Message-ID: <200912211251.02535.vladimir@codesourcery.com> (raw)
In-Reply-To: <20091218142407.GA18808@caradoc.them.org>
[-- Attachment #1: Type: Text/Plain, Size: 342 bytes --]
On Friday 18 December 2009 17:24:07 Daniel Jacobowitz wrote:
> On Fri, Dec 18, 2009 at 05:20:19PM +0300, Vladimir Prus wrote:
> > I can surely use
> >
> > type = check_typedef (type);
> >
> > if that seems less confusing.
>
> Yes, please. That version's fine.
Here's what I've checked in — with tests added.
- Volodya
[-- Attachment #2: 10884-final.diff --]
[-- Type: text/x-patch, Size: 3947 bytes --]
Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11157
diff -u -p -r1.11157 ChangeLog
--- gdb/ChangeLog 21 Dec 2009 07:40:04 -0000 1.11157
+++ gdb/ChangeLog 21 Dec 2009 09:49:47 -0000
@@ -1,3 +1,10 @@
+2009-12-21 Vladimir Prus <vladimir@codesourcery.com>
+
+ PR gdb/10884
+
+ * value.c (value_primitive_field): Call check_typedef
+ on the type.
+
2009-12-21 Joel Brobecker <brobecker@adacore.com>
* COPYING: Update to GPL version 3.
Index: gdb/value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.96
diff -u -p -r1.96 value.c
--- gdb/value.c 31 Aug 2009 20:18:45 -0000 1.96
+++ gdb/value.c 21 Dec 2009 09:49:47 -0000
@@ -1873,6 +1873,7 @@ value_primitive_field (struct value *arg
CHECK_TYPEDEF (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
+ type = check_typedef (type);
/* Handle packed fields */
Index: gdb/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.2049
diff -u -p -r1.2049 ChangeLog
--- gdb/testsuite/ChangeLog 20 Dec 2009 11:55:24 -0000 1.2049
+++ gdb/testsuite/ChangeLog 21 Dec 2009 09:49:48 -0000
@@ -1,3 +1,11 @@
+2009-12-21 Vladimir Prus <vladimir@codesourcery.com>
+
+ PR gdb/10884
+
+ * gdb.mi/var-cmd.c (do_bitfield_tests): New
+ (main): Call do_bitfield_tests.
+ * gdb.mi/mi-cmd-var.exp: Run the 'bitfield' testcase.
+
2009-12-20 Joel Brobecker <brobecker@adacore.com>
* Makefile.in gdb.ada/gnat_ada.gpr, gdb.base/gcore-buffer-overflow.c,
Index: gdb/testsuite/gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.45
diff -u -p -r1.45 mi-var-cmd.exp
--- gdb/testsuite/gdb.mi/mi-var-cmd.exp 15 Sep 2009 18:51:25 -0000 1.45
+++ gdb/testsuite/gdb.mi/mi-var-cmd.exp 21 Dec 2009 09:49:48 -0000
@@ -577,6 +577,8 @@ proc set_frozen {varobjs flag} {
mi_prepare_inline_tests $srcfile
mi_run_inline_test frozen
+mi_run_inline_test bitfield
+
# Since the inline test framework does not really work with
# function calls, first to inline tests and then do the reminder
# manually.
Index: gdb/testsuite/gdb.mi/var-cmd.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/var-cmd.c,v
retrieving revision 1.19
diff -u -p -r1.19 var-cmd.c
--- gdb/testsuite/gdb.mi/var-cmd.c 3 Jan 2009 05:58:06 -0000 1.19
+++ gdb/testsuite/gdb.mi/var-cmd.c 21 Dec 2009 09:49:48 -0000
@@ -468,6 +468,40 @@ void do_at_tests ()
/*: END: floating :*/
}
+/* Some header appear to define uint already, so apply some
+ uglification. Note that without uglification, the compile
+ does not fail, rather, we don't test what we want because
+ something else calls check_typedef on 'uint' already. */
+typedef unsigned int uint_for_mi_testing;
+
+struct Data {
+ int alloc;
+ uint_for_mi_testing sharable : 4;
+};
+
+/* Accessing a value of a bitfield whose type is a typed used to
+ result in division by zero. See:
+
+ http://sourceware.org/bugzilla/show_bug.cgi?id=10884
+
+ This tests for this bug. */
+
+void do_bitfield_tests ()
+{
+ /*: BEGIN: bitfield :*/
+ struct Data d = {0, 3};
+ /*:
+ mi_create_varobj V d "create varobj for Data"
+ mi_list_varobj_children "V" {
+ {"V.alloc" "alloc" "0" "int"}
+ {"V.sharable" "sharable" "0" "unsigned int"}
+ } "list children of Data"
+ mi_check_varobj_value V.sharable 3 "access bitfield"
+ :*/
+ return;
+ /*: END: bitfield :*/
+}
+
int
main (int argc, char *argv [])
{
@@ -477,6 +511,7 @@ main (int argc, char *argv [])
do_special_tests ();
do_frozen_tests ();
do_at_tests ();
+ do_bitfield_tests ();
exit (0);
}
next prev parent reply other threads:[~2009-12-21 9:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-18 12:41 Vladimir Prus
2009-12-18 13:06 ` Joel Brobecker
2009-12-18 14:17 ` Daniel Jacobowitz
2009-12-18 14:20 ` Vladimir Prus
2009-12-18 14:24 ` Daniel Jacobowitz
2009-12-21 9:51 ` Vladimir Prus [this message]
2009-12-21 13:23 ` Joel Brobecker
2009-12-18 19:55 ` Tom Tromey
2009-12-21 10:00 ` Vladimir Prus
2009-12-21 17:08 ` Tom Tromey
2009-12-21 17:15 ` Daniel Jacobowitz
2009-12-21 17:18 ` Vladimir Prus
2009-12-21 17:37 ` Joel Brobecker
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=200912211251.02535.vladimir@codesourcery.com \
--to=vladimir@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/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