RTTI type improvement for (was: "Re: set print object on should affect MI varobjs (PR mi/13393)")

xgsa xgsa@yandex.ru
Fri Jan 6 15:47:00 GMT 2012


> That change to value_rtti_indirect_type would be easier to read if it was
> a separate patch.

This is the first part of my previous patch that contains the change
to value_rtti_indirect_type. The second part requires this one to be
applied, so I'll provide it after commit.

Here is an example of what this patch fixes:
struct Base {
	virtual ~Base() {}
};

struct Derived: public Base {};

int main()
{
	Derived i;
	const Base& ri = i;
	const Base* pi = &i;
	return 0;   // <= run until this line
}

The "whatis ri" command fails with message:
  "Attempt to take contents of a non-pointer value.".
The "whatis pi" command does not respect cv-qualifiers:
  type = /* real type = Derived * */
  const Base *

This patch fixes these problems and takes into account the last Jan's review.


gdb/ChangeLog:

2012-01-06  Anton Gorenkov <xgsa@yandex.ru>

        * c-valprint.c (c_value_print): Use value_rtti_indirect_type
        instead of value_rtti_target_type.
        * eval.c (evaluate_subexp_standard): Use value_rtti_indirect_type
        instead of value_rtti_target_type.
        * typeprint.c (whatis_exp): Use value_rtti_indirect_type instead of
        value_rtti_target_type.
        * valops.c (value_ind): Extract function readjust_indirect_value_type.
        (value_rtti_indirect_type): The replacement for value_rtti_target_type.
        * value.c (readjust_indirect_value_type): New function.
        (coerce_ref): Support for enclosing type setting for references
        with readjust_indirect_value_type.
        * value.h (readjust_value_type): The replacement for
        value_rtti_target_type.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb_reference_rtti_fix1.patch
Type: text/x-diff
Size: 8332 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20120106/b364da75/attachment.bin>


More information about the Gdb-patches mailing list