public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Re: RFA: shrink main_type
       [not found]   ` <m3zln8rism.fsf@fleche.redhat.com>
@ 2010-09-15 19:23     ` Ken Werner
  2010-09-25 14:38       ` Ken Werner
  2010-09-30 18:56       ` Joel Brobecker
  0 siblings, 2 replies; 8+ messages in thread
From: Ken Werner @ 2010-09-15 19:23 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 1804 bytes --]

On Tuesday, August 19, 2008 07:55:37 pm Tom Tromey wrote:
> +  /* Flags about this type.  These fields appear at this location
> +     because they packs nicely here.  See the TYPE_* macros for
> +     documentation about these fields.  */
> +
> +  unsigned int flag_unsigned : 1;
> +  unsigned int flag_nosign : 1;
> +  unsigned int flag_stub : 1;
> +  unsigned int flag_target_stub : 1;
> +  unsigned int flag_static : 1;
> +  unsigned int flag_prototyped : 1;
> +  unsigned int flag_incomplete : 1;
> +  unsigned int flag_varargs : 1;
> +  unsigned int flag_vector : 1;
> +  unsigned int flag_stub_supported : 1;
> +  unsigned int flag_nottext : 1;
> +  unsigned int flag_fixed_instance : 1;

Hi Tom,

This is quite an old change but while debugging gdb I noticed that vector 
types do have a strange bit set into their instance_flags and this seems to go 
back to this patch.
The snippet above introduces the flag_nottext as a bitfield member of the type 
struct while gdbtypes.c:make_vector_type still sets that bit into the 
instance_flags.

The nottext flag is set for the element types of vectors 
(gdbtypes.c:make_vector_type) and for the builtin_int8/builtin_int8 types. The 
flag is read from the c-valprint.c:c_textual_element_type function that 
determines whether arrays of chars should be printed as strings or not.  So, I 
guess that prior to this patch char vectors were printed just like integer 
vectors - plain data. One approach to restore that functionality would be to 
move the nottext flag into to the instance_flags of the type. Attached is an 
untested patch of what I have in mind. Comments are welcome.

This also renders my previous attempt to fix the printing of character vectors 
(http://sourceware.org/ml/gdb-patches/2010-06/msg00573.html) obsolete.

Regards
Ken Werner

[-- Attachment #2: type_nottext.patch --]
[-- Type: text/x-patch, Size: 4791 bytes --]

Index: gdb/c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.72
diff -p -u -r1.72 c-valprint.c
--- gdb/c-valprint.c	14 Jul 2010 14:13:54 -0000	1.72
+++ gdb/c-valprint.c	15 Sep 2010 12:22:49 -0000
@@ -180,8 +180,7 @@ c_val_print (struct type *type, const gd
 
 	  /* Print arrays of textual chars with a string syntax, as
 	     long as the entire array is valid.  */
-          if (!TYPE_VECTOR (type)
-	      && c_textual_element_type (unresolved_elttype, options->format)
+          if (c_textual_element_type (unresolved_elttype, options->format)
 	      && value_bits_valid (original_value,
 				   TARGET_CHAR_BIT * embedded_offset,
 				   TARGET_CHAR_BIT * TYPE_LENGTH (type)))
Index: gdb/gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.199
diff -p -u -r1.199 gdbtypes.c
--- gdb/gdbtypes.c	8 Sep 2010 17:17:42 -0000	1.199
+++ gdb/gdbtypes.c	15 Sep 2010 12:22:49 -0000
@@ -942,7 +942,7 @@ make_vector_type (struct type *array_typ
   elt_type = TYPE_TARGET_TYPE (inner_array);
   if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
     {
-      flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT;
+      flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT;
       elt_type = make_qualified_type (elt_type, flags, NULL);
       TYPE_TARGET_TYPE (inner_array) = elt_type;
     }
@@ -1801,8 +1801,6 @@ init_type (enum type_code code, int leng
     TYPE_VECTOR (type) = 1;
   if (flags & TYPE_FLAG_STUB_SUPPORTED)
     TYPE_STUB_SUPPORTED (type) = 1;
-  if (flags & TYPE_FLAG_NOTTEXT)
-    TYPE_NOTTEXT (type) = 1;
   if (flags & TYPE_FLAG_FIXED_INSTANCE)
     TYPE_FIXED_INSTANCE (type) = 1;
 
@@ -3490,8 +3488,10 @@ gdbtypes_post_init (struct gdbarch *gdba
     = arch_integer_type (gdbarch, 128, 0, "int128_t");
   builtin_type->builtin_uint128
     = arch_integer_type (gdbarch, 128, 1, "uint128_t");
-  TYPE_NOTTEXT (builtin_type->builtin_int8) = 1;
-  TYPE_NOTTEXT (builtin_type->builtin_uint8) = 1;
+  TYPE_INSTANCE_FLAGS (builtin_type->builtin_int8) |=
+    TYPE_INSTANCE_FLAG_NOTTEXT;
+  TYPE_INSTANCE_FLAGS (builtin_type->builtin_uint8) |=
+    TYPE_INSTANCE_FLAG_NOTTEXT;
 
   /* Wide character types.  */
   builtin_type->builtin_char16
Index: gdb/gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.134
diff -p -u -r1.134 gdbtypes.h
--- gdb/gdbtypes.h	28 Jul 2010 16:23:58 -0000	1.134
+++ gdb/gdbtypes.h	15 Sep 2010 12:22:49 -0000
@@ -159,18 +159,17 @@ enum type_code
 
 enum type_flag_value
 {
-  TYPE_FLAG_UNSIGNED = (1 << 6),
-  TYPE_FLAG_NOSIGN = (1 << 7),
-  TYPE_FLAG_STUB = (1 << 8),
-  TYPE_FLAG_TARGET_STUB = (1 << 9),
-  TYPE_FLAG_STATIC = (1 << 10),
-  TYPE_FLAG_PROTOTYPED = (1 << 11),
-  TYPE_FLAG_INCOMPLETE = (1 << 12),
-  TYPE_FLAG_VARARGS = (1 << 13),
-  TYPE_FLAG_VECTOR = (1 << 14),
-  TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
-  TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
-  TYPE_FLAG_NOTTEXT = (1 << 17),
+  TYPE_FLAG_UNSIGNED = (1 << 7),
+  TYPE_FLAG_NOSIGN = (1 << 8),
+  TYPE_FLAG_STUB = (1 << 9),
+  TYPE_FLAG_TARGET_STUB = (1 << 10),
+  TYPE_FLAG_STATIC = (1 << 11),
+  TYPE_FLAG_PROTOTYPED = (1 << 12),
+  TYPE_FLAG_INCOMPLETE = (1 << 13),
+  TYPE_FLAG_VARARGS = (1 << 14),
+  TYPE_FLAG_VECTOR = (1 << 15),
+  TYPE_FLAG_FIXED_INSTANCE = (1 << 16),
+  TYPE_FLAG_STUB_SUPPORTED = (1 << 17),
 
   /* Used for error-checking.  */
   TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -186,7 +185,8 @@ enum type_instance_flag_value
   TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
   TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
   TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
-  TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5)
+  TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5),
+  TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6),
 };
 
 /* Unsigned integer type.  If this is not set for a TYPE_CODE_INT, the
@@ -269,7 +269,7 @@ enum type_instance_flag_value
 /* Not textual.  By default, GDB treats all single byte integers as
    characters (or elements of strings) unless this flag is set.  */
 
-#define TYPE_NOTTEXT(t)		(TYPE_MAIN_TYPE (t)->flag_nottext)
+#define TYPE_NOTTEXT(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT)
 
 /* Type owner.  If TYPE_OBJFILE_OWNED is true, the type is owned by
    the objfile retrieved as TYPE_OBJFILE.  Otherweise, the type is
@@ -388,7 +388,6 @@ struct main_type
   unsigned int flag_varargs : 1;
   unsigned int flag_vector : 1;
   unsigned int flag_stub_supported : 1;
-  unsigned int flag_nottext : 1;
   unsigned int flag_fixed_instance : 1;
   unsigned int flag_objfile_owned : 1;
   /* True if this type was declared with "class" rather than

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: shrink main_type
  2010-09-15 19:23     ` RFA: shrink main_type Ken Werner
@ 2010-09-25 14:38       ` Ken Werner
  2010-09-30 18:56       ` Joel Brobecker
  1 sibling, 0 replies; 8+ messages in thread
From: Ken Werner @ 2010-09-25 14:38 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Wednesday, September 15, 2010 2:41:43 pm Ken Werner wrote:
> On Tuesday, August 19, 2008 07:55:37 pm Tom Tromey wrote:
> > +  /* Flags about this type.  These fields appear at this location
> > +     because they packs nicely here.  See the TYPE_* macros for
> > +     documentation about these fields.  */
> > +
> > +  unsigned int flag_unsigned : 1;
> > +  unsigned int flag_nosign : 1;
> > +  unsigned int flag_stub : 1;
> > +  unsigned int flag_target_stub : 1;
> > +  unsigned int flag_static : 1;
> > +  unsigned int flag_prototyped : 1;
> > +  unsigned int flag_incomplete : 1;
> > +  unsigned int flag_varargs : 1;
> > +  unsigned int flag_vector : 1;
> > +  unsigned int flag_stub_supported : 1;
> > +  unsigned int flag_nottext : 1;
> > +  unsigned int flag_fixed_instance : 1;
> 
> Hi Tom,
> 
> This is quite an old change but while debugging gdb I noticed that vector
> types do have a strange bit set into their instance_flags and this seems to
> go back to this patch.
> The snippet above introduces the flag_nottext as a bitfield member of the
> type struct while gdbtypes.c:make_vector_type still sets that bit into the
> instance_flags.
> 
> The nottext flag is set for the element types of vectors
> (gdbtypes.c:make_vector_type) and for the builtin_int8/builtin_int8 types.
> The flag is read from the c-valprint.c:c_textual_element_type function
> that determines whether arrays of chars should be printed as strings or
> not.  So, I guess that prior to this patch char vectors were printed just
> like integer vectors - plain data. One approach to restore that
> functionality would be to move the nottext flag into to the instance_flags
> of the type. Attached is an untested patch of what I have in mind.
> Comments are welcome.
> 
> This also renders my previous attempt to fix the printing of character
> vectors (http://sourceware.org/ml/gdb-patches/2010-06/msg00573.html)
> obsolete.
> 
> Regards
> Ken Werner

Ping. : ) Since I screwed up the recipient list plus the fact that this was a 
reply to a 2008 post it may be well hidden by the mail reader.
Are there any comments on that?

Thanks
Ken

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: shrink main_type
  2010-09-15 19:23     ` RFA: shrink main_type Ken Werner
  2010-09-25 14:38       ` Ken Werner
@ 2010-09-30 18:56       ` Joel Brobecker
  2010-10-01 13:23         ` Ken Werner
  2010-10-01 15:34         ` [patch] move the nottext flag to the instance_flags Ken Werner
  1 sibling, 2 replies; 8+ messages in thread
From: Joel Brobecker @ 2010-09-30 18:56 UTC (permalink / raw)
  To: Ken Werner; +Cc: gdb-patches

I'm sorry about the delay in getting to this. I hope it's something
temporary that we all seem to be busier than usual.

> One approach to restore that functionality would be to move the
> nottext flag into to the instance_flags of the type. Attached is an
> untested patch of what I have in mind. Comments are welcome.

It took me a while to figure out why this is necessary. Initially,
I thought that the vector type should have the NOTTEXT bit set,
but that wouldn't be sufficient for the case where we just print
one element of the vector (because we'd end up checking type of
the element and not find the NOTTEXT bit set, and thus print it
as a character rather than an integer.

Do I understand the situation correctly? If yes, can we add a test
that checks that, if not already there?

Based on that understanding, then I agree that the NOTTEXT flag
seems to be more of an instance flag than a type flag.  The code
in make_vector_type seems to be confirming that.

If you make a proper submission for this patch, I will officially
review it.

-- 
Joel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: shrink main_type
  2010-09-30 18:56       ` Joel Brobecker
@ 2010-10-01 13:23         ` Ken Werner
  2010-10-01 15:34         ` [patch] move the nottext flag to the instance_flags Ken Werner
  1 sibling, 0 replies; 8+ messages in thread
From: Ken Werner @ 2010-10-01 13:23 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On Thursday, September 30, 2010 7:55:18 pm Joel Brobecker wrote:
> I'm sorry about the delay in getting to this. I hope it's something
> temporary that we all seem to be busier than usual.

Thanks for taking a look at this.

> > One approach to restore that functionality would be to move the
> > nottext flag into to the instance_flags of the type. Attached is an
> > untested patch of what I have in mind. Comments are welcome.

> It took me a while to figure out why this is necessary. Initially,
> I thought that the vector type should have the NOTTEXT bit set,
> but that wouldn't be sufficient for the case where we just print
> one element of the vector (because we'd end up checking type of
> the element and not find the NOTTEXT bit set, and thus print it
> as a character rather than an integer.
>
> Do I understand the situation correctly? If yes, can we add a test
> that checks that, if not already there?

I think you are right because c_textual_element_type queries the type of the 
element to be printed. In case a single element of the vector is printed it is 
the type of the vectors target type. Printing of character vectors is only 
tested indirectly through gdb.arch/altivec-abi.exp. I think it would be good 
to add a few tests to gdb.base/gnu_vector.exp.

> Based on that understanding, then I agree that the NOTTEXT flag
> seems to be more of an instance flag than a type flag.  The code
> in make_vector_type seems to be confirming that.
> 
> If you make a proper submission for this patch, I will officially
> review it.

When I first realized that printing of char vectors is awkward I attempted to 
fix this at c-valprint (http://sourceware.org/ml/gdb-
patches/2010-06/msg00573.html) but overlooked that there already is a 
mechanism for that. Then I learned about the NOTTEXT flag and thought Toms 
shrink-main_type-patch broke the char vector printing and revived this mail 
thread. Now I think this never worked because even the initial patch from Jan  
(http://sourceware.org/ml/gdb-patches/2007-08/msg00467.html) writes the 
nottext bit into the instance flags (make_vector_type) but  the 
textual_element_type function checks for a type flag. I think that moving 
nottext flag into to the instance_flags of the type is a good way to fix this. 
I'll post a proper patch soon.

Thanks
-ken

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch] move the nottext flag to the instance_flags
  2010-09-30 18:56       ` Joel Brobecker
  2010-10-01 13:23         ` Ken Werner
@ 2010-10-01 15:34         ` Ken Werner
  2010-10-01 16:15           ` Joel Brobecker
  1 sibling, 1 reply; 8+ messages in thread
From: Ken Werner @ 2010-10-01 15:34 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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

On Thursday, September 30, 2010 7:55:18 pm Joel Brobecker wrote:
> If you make a proper submission for this patch, I will officially
> review it.

This patch moves the nottext flag into to the instance_flags of the 
type to handle the printing of character vectors as discussed here:
http://sourceware.org/ml/gdb-patches/2010-10/msg00005.html
The initial patch on how char vectors should be treated can be found at:
http://sourceware.org/ml/gdb-patches/2007-08/msg00467.html

Tested on powerpc64-*-linux-gnu and i686-*-linux-gnu, no regressions.
OK to apply?

Thanks
-ken

[-- Attachment #2: type_nottext.patch --]
[-- Type: text/x-patch, Size: 9176 bytes --]

ChangeLog:

2010-10-01  Ken Werner  <ken.werner@de.ibm.com>

	* gdbtypes.h (struct main_type): Remove flag_nottext.
	(enum type_flag_value): Remove TYPE_FLAG_NOTTEXT.
	(enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT.
	(TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext.
	* gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead
	of TYPE_FLAG_NOTTEXT.
	(init_type): Remove the initialization of the flag_nottext field.
	(gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of
	TYPE_FLAG_NOTTEXT.
	* c-valprint.c (c_val_print): Remove TYPE_VECTOR check.

testsuite/ChangeLog:

2010-10-01  Ken Werner  <ken.werner@de.ibm.com>

	* gdb.base/gnu_vector.c: Add variable c4.
	* gdb.base/gnu_vector.exp: Add tests for character vector printing.
	* gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors.


Index: gdb/c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.72
diff -p -u -r1.72 c-valprint.c
--- gdb/c-valprint.c	14 Jul 2010 14:13:54 -0000	1.72
+++ gdb/c-valprint.c	1 Oct 2010 14:13:29 -0000
@@ -180,8 +180,7 @@ c_val_print (struct type *type, const gd
 
 	  /* Print arrays of textual chars with a string syntax, as
 	     long as the entire array is valid.  */
-          if (!TYPE_VECTOR (type)
-	      && c_textual_element_type (unresolved_elttype, options->format)
+          if (c_textual_element_type (unresolved_elttype, options->format)
 	      && value_bits_valid (original_value,
 				   TARGET_CHAR_BIT * embedded_offset,
 				   TARGET_CHAR_BIT * TYPE_LENGTH (type)))
Index: gdb/gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.199
diff -p -u -r1.199 gdbtypes.c
--- gdb/gdbtypes.c	8 Sep 2010 17:17:42 -0000	1.199
+++ gdb/gdbtypes.c	1 Oct 2010 14:13:30 -0000
@@ -942,7 +942,7 @@ make_vector_type (struct type *array_typ
   elt_type = TYPE_TARGET_TYPE (inner_array);
   if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
     {
-      flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_FLAG_NOTTEXT;
+      flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT;
       elt_type = make_qualified_type (elt_type, flags, NULL);
       TYPE_TARGET_TYPE (inner_array) = elt_type;
     }
@@ -1801,8 +1801,6 @@ init_type (enum type_code code, int leng
     TYPE_VECTOR (type) = 1;
   if (flags & TYPE_FLAG_STUB_SUPPORTED)
     TYPE_STUB_SUPPORTED (type) = 1;
-  if (flags & TYPE_FLAG_NOTTEXT)
-    TYPE_NOTTEXT (type) = 1;
   if (flags & TYPE_FLAG_FIXED_INSTANCE)
     TYPE_FIXED_INSTANCE (type) = 1;
 
@@ -3490,8 +3488,10 @@ gdbtypes_post_init (struct gdbarch *gdba
     = arch_integer_type (gdbarch, 128, 0, "int128_t");
   builtin_type->builtin_uint128
     = arch_integer_type (gdbarch, 128, 1, "uint128_t");
-  TYPE_NOTTEXT (builtin_type->builtin_int8) = 1;
-  TYPE_NOTTEXT (builtin_type->builtin_uint8) = 1;
+  TYPE_INSTANCE_FLAGS (builtin_type->builtin_int8) |=
+    TYPE_INSTANCE_FLAG_NOTTEXT;
+  TYPE_INSTANCE_FLAGS (builtin_type->builtin_uint8) |=
+    TYPE_INSTANCE_FLAG_NOTTEXT;
 
   /* Wide character types.  */
   builtin_type->builtin_char16
Index: gdb/gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.134
diff -p -u -r1.134 gdbtypes.h
--- gdb/gdbtypes.h	28 Jul 2010 16:23:58 -0000	1.134
+++ gdb/gdbtypes.h	1 Oct 2010 14:13:30 -0000
@@ -159,18 +159,17 @@ enum type_code
 
 enum type_flag_value
 {
-  TYPE_FLAG_UNSIGNED = (1 << 6),
-  TYPE_FLAG_NOSIGN = (1 << 7),
-  TYPE_FLAG_STUB = (1 << 8),
-  TYPE_FLAG_TARGET_STUB = (1 << 9),
-  TYPE_FLAG_STATIC = (1 << 10),
-  TYPE_FLAG_PROTOTYPED = (1 << 11),
-  TYPE_FLAG_INCOMPLETE = (1 << 12),
-  TYPE_FLAG_VARARGS = (1 << 13),
-  TYPE_FLAG_VECTOR = (1 << 14),
-  TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
-  TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
-  TYPE_FLAG_NOTTEXT = (1 << 17),
+  TYPE_FLAG_UNSIGNED = (1 << 7),
+  TYPE_FLAG_NOSIGN = (1 << 8),
+  TYPE_FLAG_STUB = (1 << 9),
+  TYPE_FLAG_TARGET_STUB = (1 << 10),
+  TYPE_FLAG_STATIC = (1 << 11),
+  TYPE_FLAG_PROTOTYPED = (1 << 12),
+  TYPE_FLAG_INCOMPLETE = (1 << 13),
+  TYPE_FLAG_VARARGS = (1 << 14),
+  TYPE_FLAG_VECTOR = (1 << 15),
+  TYPE_FLAG_FIXED_INSTANCE = (1 << 16),
+  TYPE_FLAG_STUB_SUPPORTED = (1 << 17),
 
   /* Used for error-checking.  */
   TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -186,7 +185,8 @@ enum type_instance_flag_value
   TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
   TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
   TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
-  TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5)
+  TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5),
+  TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6),
 };
 
 /* Unsigned integer type.  If this is not set for a TYPE_CODE_INT, the
@@ -269,7 +269,7 @@ enum type_instance_flag_value
 /* Not textual.  By default, GDB treats all single byte integers as
    characters (or elements of strings) unless this flag is set.  */
 
-#define TYPE_NOTTEXT(t)		(TYPE_MAIN_TYPE (t)->flag_nottext)
+#define TYPE_NOTTEXT(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT)
 
 /* Type owner.  If TYPE_OBJFILE_OWNED is true, the type is owned by
    the objfile retrieved as TYPE_OBJFILE.  Otherweise, the type is
@@ -388,7 +388,6 @@ struct main_type
   unsigned int flag_varargs : 1;
   unsigned int flag_vector : 1;
   unsigned int flag_stub_supported : 1;
-  unsigned int flag_nottext : 1;
   unsigned int flag_fixed_instance : 1;
   unsigned int flag_objfile_owned : 1;
   /* True if this type was declared with "class" rather than
Index: gdb/testsuite/gdb.arch/altivec-abi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/altivec-abi.exp,v
retrieving revision 1.20
diff -p -u -r1.20 altivec-abi.exp
--- gdb/testsuite/gdb.arch/altivec-abi.exp	14 Jul 2010 14:54:58 -0000	1.20
+++ gdb/testsuite/gdb.arch/altivec-abi.exp	1 Oct 2010 14:13:30 -0000
@@ -82,7 +82,7 @@ proc altivec_abi_tests { extra_flags for
 
     # now all the arguments of vec_fun are initialized
 
-    set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g', 104 'h', 105 'i', 108 'l', 109 'm', 110 'n', 111 'o', 112 'p', 113 'q', 114 'r'., vuchar_f=.65 'A', 66 'B', 67 'C', 68 'D', 69 'E', 70 'F', 71 'G', 72 'H', 73 'I', 76 'L', 77 'M', 78 'N', 79 'O', 80 'P', 81 'Q', 82 'R'., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.118 'v', 101 'e', 99 'c', 116 't', 111 'o', 114 'r', 32 ' ', 111 'o', 102 'f', 32 ' ', 99 'c', 104 'h', 97 'a', 114 'r', 115 's', 46 '.'., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.."
+    set pattern "vec_func .vshort_f=.111, 222, 333, 444, 555, 666, 777, 888., vushort_f=.100, 200, 300, 400, 500, 600, 700, 800., vint_f=.-10, -20, -30, -40., vuint_f=.1111, 2222, 3333, 4444., vchar_f=.97, 98, 99, 100, 101, 102, 103, 104, 105, 108, 109, 110, 111, 112, 113, 114., vuchar_f=.65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82., vfloat_f=.1.25, 3.75, 5.5, 1.25., x_f=.1, 2, 3, 4, 5, 6, 7, 8., y_f=.12, 22, 32, 42., a_f=.118, 101, 99, 116, 111, 114, 32, 111, 102, 32, 99, 104, 97, 114, 115, 46., b_f=.5.5, 4.5, 3.75, 2.25., c_f=.1.25, 3.5, 5.5, 7.75., intv_on_stack_f=.12, 34, 56, 78.."
 
     set pattern1 $pattern
     append pattern1 " at.*altivec-abi.c.*vint_res  = vec_add.*vint_f, intv_on_stack_f.;"
Index: gdb/testsuite/gdb.base/gnu_vector.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gnu_vector.c,v
retrieving revision 1.1
diff -p -u -r1.1 gnu_vector.c
--- gdb/testsuite/gdb.base/gnu_vector.c	11 Aug 2010 16:48:26 -0000	1.1
+++ gdb/testsuite/gdb.base/gnu_vector.c	1 Oct 2010 14:13:30 -0000
@@ -17,6 +17,7 @@
 
    Contributed by Ken Werner <ken.werner@de.ibm.com>  */
 
+char __attribute__ ((vector_size (4 * sizeof(char)))) c4 = {1, 2, 3, 4};
 int __attribute__ ((vector_size (4 * sizeof(int)))) i4a = {2, 4, 8, 16};
 int __attribute__ ((vector_size (4 * sizeof(int)))) i4b = {1, 2, 8, 4};
 float __attribute__ ((vector_size (4 * sizeof(float)))) f4a = {2, 4, 8, 16};
Index: gdb/testsuite/gdb.base/gnu_vector.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gnu_vector.exp,v
retrieving revision 1.1
diff -p -u -r1.1 gnu_vector.exp
--- gdb/testsuite/gdb.base/gnu_vector.exp	11 Aug 2010 16:48:26 -0000	1.1
+++ gdb/testsuite/gdb.base/gnu_vector.exp	1 Oct 2010 14:13:30 -0000
@@ -46,6 +46,10 @@ if { ![runto main] } {
     return -1
 }
 
+# Test printing of character vector types
+gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
+gdb_test "print c4\[2\]" "\\\$$decimal = 3"
+
 # Test binary operators on integer vector types
 gdb_test "print i4a" "\\\$$decimal = \\{2, 4, 8, 16\\}"
 gdb_test "print i4b" "\\\$$decimal = \\{1, 2, 8, 4\\}"

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] move the nottext flag to the instance_flags
  2010-10-01 15:34         ` [patch] move the nottext flag to the instance_flags Ken Werner
@ 2010-10-01 16:15           ` Joel Brobecker
  2010-10-05 21:50             ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Joel Brobecker @ 2010-10-01 16:15 UTC (permalink / raw)
  To: Ken Werner; +Cc: gdb-patches

> 2010-10-01  Ken Werner  <ken.werner@de.ibm.com>
> 
> 	* gdbtypes.h (struct main_type): Remove flag_nottext.
> 	(enum type_flag_value): Remove TYPE_FLAG_NOTTEXT.
> 	(enum type_instance_flag_value): Add TYPE_INSTANCE_FLAG_NOTTEXT.
> 	(TYPE_NOTTEXT): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of flag_nottext.
> 	* gdbtypes.c (make_vector_type): Use TYPE_INSTANCE_FLAG_NOTTEXT instead
> 	of TYPE_FLAG_NOTTEXT.
> 	(init_type): Remove the initialization of the flag_nottext field.
> 	(gdbtypes_post_init): Use TYPE_INSTANCE_FLAG_NOTTEXT instead of
> 	TYPE_FLAG_NOTTEXT.
> 	* c-valprint.c (c_val_print): Remove TYPE_VECTOR check.
> 
> testsuite/ChangeLog:
> 
> 2010-10-01  Ken Werner  <ken.werner@de.ibm.com>
> 
> 	* gdb.base/gnu_vector.c: Add variable c4.
> 	* gdb.base/gnu_vector.exp: Add tests for character vector printing.
> 	* gdb.arch/altivec-abi.exp: Fix expect pattern of character vectors.

Looks good to me. Can you wait, maybe a day or two to give Tom a chance
to comment before you commit, in case he spots something I didn't?

Thanks,
-- 
Joel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] move the nottext flag to the instance_flags
  2010-10-01 16:15           ` Joel Brobecker
@ 2010-10-05 21:50             ` Tom Tromey
  2010-10-06  8:45               ` Ken Werner
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2010-10-05 21:50 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Ken Werner, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> Looks good to me. Can you wait, maybe a day or two to give Tom a chance
Joel> to comment before you commit, in case he spots something I didn't?

I'm sorry about the delay on this.
I think this seems reasonable.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] move the nottext flag to the instance_flags
  2010-10-05 21:50             ` Tom Tromey
@ 2010-10-06  8:45               ` Ken Werner
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Werner @ 2010-10-06  8:45 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Joel Brobecker, gdb-patches

On Tuesday, October 05, 2010 11:50:23 pm Tom Tromey wrote:
> >>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
> Joel> Looks good to me. Can you wait, maybe a day or two to give Tom a
> chance Joel> to comment before you commit, in case he spots something I
> didn't?
> 
> I'm sorry about the delay on this.
> I think this seems reasonable.

Patch applied.
http://sourceware.org/ml/gdb-cvs/2010-10/msg00031.html

Thanks
Ken

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-10-06  8:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m37iafzdcp.fsf@fleche.redhat.com>
     [not found] ` <20080819051306.GQ16894@adacore.com>
     [not found]   ` <m3zln8rism.fsf@fleche.redhat.com>
2010-09-15 19:23     ` RFA: shrink main_type Ken Werner
2010-09-25 14:38       ` Ken Werner
2010-09-30 18:56       ` Joel Brobecker
2010-10-01 13:23         ` Ken Werner
2010-10-01 15:34         ` [patch] move the nottext flag to the instance_flags Ken Werner
2010-10-01 16:15           ` Joel Brobecker
2010-10-05 21:50             ` Tom Tromey
2010-10-06  8:45               ` Ken Werner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).