Copy over fix for fetching dynamic type of a reference from python side.
authorDoug Evans <xdje42@gmail.com>
Sat, 12 Apr 2014 16:09:41 +0000 (09:09 -0700)
committerDoug Evans <xdje42@gmail.com>
Sat, 12 Apr 2014 16:09:41 +0000 (09:09 -0700)
* guile/scm-value.c (gdbscm_value_dynamic_type): Use coerce_ref to
dereference TYPE_CODE_REF values.

testsuite/
* gdb.guile/scm-value.c: Improve test case.
* gdb.guile/scm-value.exp: Add new test.

gdb/ChangeLog
gdb/guile/scm-value.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.guile/scm-value.c
gdb/testsuite/gdb.guile/scm-value.exp

index 2184479588972b566539ba0df78dbe2597445b09..83d75ac67fbd3b2ebced26c9f85f00f449f703f3 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-12  Siva Chandra Reddy  <sivachandra@google.com>
+           Doug Evans  <xdje42@gmail.com>
+
+       * guile/scm-value.c (gdbscm_value_dynamic_type): Use coerce_ref to
+       dereference TYPE_CODE_REF values.
+
 2014-04-11  Joel Brobecker  <brobecker@adacore.com>
 
        Revert the following changes due to regressions:
index 8ca076211c4c963fa714a1cc4096f3c7ad7d21ea..2160a1eceff1bedee852d59ea09f1685523ccd66 100644 (file)
@@ -585,7 +585,10 @@ gdbscm_value_dynamic_type (SCM self)
          struct value *target;
          int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
 
-         target = value_ind (value);
+         if (was_pointer)
+           target = value_ind (value);
+         else
+           target = coerce_ref (value);
          type = value_rtti_type (target, NULL, NULL, NULL);
 
          if (type)
index f7a4b8e3fcbc190f73b38de923576dd9707dc969..730c116cefd42de9f9c39b0fb90c2c2712776843 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-12  Siva Chandra Reddy  <sivachandra@google.com>
+           Doug Evans  <xdje42@gmail.com>
+
+       * gdb.guile/scm-value.c: Improve test case.
+       * gdb.guile/scm-value.exp: Add new test.
+
 2014-04-11  David Blaikie  <dblaikie@gmail.com>
 
        * gdb.opt/inline-break.exp: Explicitly specify -std=gnu89 to
index 3c61911aaac24534f82ce8be18c85053cae5b036..e4f7530322265a404e4df71f12e5849eaa4a49d4 100644 (file)
@@ -49,6 +49,8 @@ struct Derived : public Base {
 };
 
 Base *base = new Derived ();
+Derived derived;
+Base &base_ref = derived;
 
 void ptr_ref(int*& rptr_int)
 {
index 0bcd3816c626fdfc7c47bfc158d5313a02ee478f..2784da2e27d12510c67931e10e382e45ce1677da 100644 (file)
@@ -335,6 +335,8 @@ proc test_subscript_regression {exefile lang} {
        # Likewise.
        gdb_test "gu (print (value-dynamic-type (parse-and-eval \"base\")))" \
            "= Derived \[*\]"
+       gdb_test "gu (print (value-dynamic-type (parse-and-eval \"base_ref\")))" \
+           "= Derived \[&\]"
        # A static type case.
        gdb_test "gu (print (value-dynamic-type (parse-and-eval \"5\")))" \
            "= int"