RFA: shrink main_type
Ken Werner
ken@linux.vnet.ibm.com
Wed Sep 15 19:23:00 GMT 2010
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: type_nottext.patch
Type: text/x-patch
Size: 4791 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100915/850658a0/attachment.bin>
More information about the Gdb-patches
mailing list