aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-01-03 22:11:55 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-01-03 22:11:55 +0000
commitecf4d1d0138e0e38204a9d870ba26f2d6d8d4db5 (patch)
tree5fb04fa80094fe3cacc30f6238af5e6afc26a190
parent7836e43e665eb213e0b6903f9241f2427f897f18 (diff)
downloadfsf-binutils-gdb-ecf4d1d0138e0e38204a9d870ba26f2d6d8d4db5.zip
fsf-binutils-gdb-ecf4d1d0138e0e38204a9d870ba26f2d6d8d4db5.tar.gz
fsf-binutils-gdb-ecf4d1d0138e0e38204a9d870ba26f2d6d8d4db5.tar.bz2
gdb/
* gdbtypes.c (check_typedef): New comment on type length. * value.c (allocate_value_lazy): Remove the unused atype variable. New comment on type length. (value_primitive_field): Keep the original TYPE value, new comment. gdb/testsuite/ * gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to "uint_for_mi_testing".
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/gdbtypes.c11
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.mi/var-cmd.c2
-rw-r--r--gdb/value.c18
5 files changed, 38 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 55755e3..f6da918 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Joel Brobecker <brobecker@adacore.com>
+
+ * gdbtypes.c (check_typedef): New comment on type length.
+ * value.c (allocate_value_lazy): Remove the unused atype variable. New
+ comment on type length.
+ (value_primitive_field): Keep the original TYPE value, new comment.
+
2009-12-22 Joel Brobecker <brobecker@adacore.com>
* version.in: Set version to 7.0.1.20091222-cvs.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 2f77dca..3d223a5 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1342,12 +1342,17 @@ stub_noname_complaint (void)
symbols which contain a full definition for the type.
This used to be coded as a macro, but I don't think it is called
- often enough to merit such treatment. */
+ often enough to merit such treatment.
-/* Find the real type of TYPE. This function returns the real type,
+ Find the real type of TYPE. This function returns the real type,
after removing all layers of typedefs and completing opaque or stub
types. Completion changes the TYPE argument, but stripping of
- typedefs does not. */
+ typedefs does not.
+
+ If TYPE is a TYPE_CODE_TYPEDEF, its length is (also) set to the length of
+ the target type instead of zero. However, in the case of TYPE_CODE_TYPEDEF
+ check_typedef can still return different type than the original TYPE
+ pointer. */
struct type *
check_typedef (struct type *type)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3dd2374..4fcb5be 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to
+ "uint_for_mi_testing".
+
2009-12-21 Vladimir Prus <vladimir@codesourcery.com>
PR gdb/10884
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index bbadc24..7220030 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -494,7 +494,7 @@ void do_bitfield_tests ()
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"}
+ {"V.sharable" "sharable" "0" "uint_for_mi_testing"}
} "list children of Data"
mi_check_varobj_value V.sharable 3 "access bitfield"
:*/
diff --git a/gdb/value.c b/gdb/value.c
index e240c7a..7b814b6 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -254,7 +254,14 @@ struct value *
allocate_value_lazy (struct type *type)
{
struct value *val;
- struct type *atype = check_typedef (type);
+
+ /* Call check_typedef on our type to make sure that, if TYPE
+ is a TYPE_CODE_TYPEDEF, its length is set to the length
+ of the target type instead of zero. However, we do not
+ replace the typedef type by the target type, because we want
+ to keep the typedef in order to be able to set the VAL's type
+ description correctly. */
+ check_typedef (type);
val = (struct value *) xzalloc (sizeof (struct value));
val->contents = NULL;
@@ -1873,7 +1880,14 @@ value_primitive_field (struct value *arg1, int offset,
CHECK_TYPEDEF (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
- type = check_typedef (type);
+
+ /* Call check_typedef on our type to make sure that, if TYPE
+ is a TYPE_CODE_TYPEDEF, its length is set to the length
+ of the target type instead of zero. However, we do not
+ replace the typedef type by the target type, because we want
+ to keep the typedef in order to be able to print the type
+ description correctly. */
+ check_typedef (type);
/* Handle packed fields */