Re: set print object on should affect MI varobjs (PR 13393)

Tom Tromey
2011-12-20T16:40:14Z

>>>>> ">" == xgsa <xgsa@yandex.ru> writes:

>> (it seems that my previous message about this patch was lost somehow,
>> so I resend it again; sorry, if I sent it twice)

No problem. Thanks for working on this.

>> 2011-12-02 Anton Gorenkov <xgsa@yandex.ru>

>> PR 13393

I think it has to mention the category for the commit->bz scanner to
work.

Your patch got wrapped by your mailer, making it harder to read.

>> -static struct type *
>> +struct type *
>> make_qualified_type (struct type *type, int new_flags,
>> struct type *storage)

I'd prefer not to export this.
I think you can just use make_cv_type instead.

>> + else if (TYPE_CODE(type) == TYPE_CODE_PTR)

Missing space before the open paren here. This occurs a few times.

>> +struct type *
>> +actual_type (struct value *value, int resolve_simple_types)
>> +{

This should have an introductory comment saying to look at value.h.

>> + struct type *real_type;
>> + real_type = value_rtti_target_type ( value, 0, 0, 0 );

Blank line between declaration and code.
This has an extra space after "(" and before ")".

>> +/* Returns value_type() or value_enclosing_type () depending on

Remove the '()'s.

>> + value_print_options.objectprint.
>> +
>> + If RESOLVE_SIMPLE_TYPES is 0 the enclosing type will be resolved
>> + only for pointers and references, else it will be returned also
>> + all the types (e.g. for structures). This option is useful
>> + to prevent retrieving enclosing type for the base classes fields */

Sentences should end with a period followed by 2 spaces.
The last sentence needs this too.

>> + struct type *enclosing_type;
>> + var->type = value_type (value);

Blank line.

>> + enclosing_type = actual_type(value, 0);

Missing space.

>> + if (check_typedef (enclosing_type) != check_typedef (var->type))
>> + {
>> + var->type = enclosing_type;
>> + value = value_cast (enclosing_type, value);

Will this always do the right thing?
It seems questionable.

>> + // Access a real type of the value (if necessary and possible)

GDB is C90 and can't use // comments.

>> + enclosing_type = actual_type(*value, 1);

I don't understand why this one call has a '1' here.

>> + // It is necessary to access a real type (via RTTI)
>> + if (opts.objectprint)
>> + {
>> + value = var->value;
>> + lookup_actual_type = TYPE_CODE (var->type) == TYPE_CODE_REF
>> || TYPE_CODE (var->type) == TYPE_CODE_PTR;

This line has to be reformatted per the GNU coding standards.

Do you have copyright assignment papers filed with the FSF?
If not, contact me off-list to get started with this.
We can't put anything in until the paperwork is finished.

Tom