public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PING^2] [PATCH] Fix dynamic_cast operator
@ 2014-04-28 14:13 Siva Chandra
  2014-04-29 20:16 ` Doug Evans
  2014-09-23 14:47 ` Siva Chandra
  0 siblings, 2 replies; 3+ messages in thread
From: Siva Chandra @ 2014-04-28 14:13 UTC (permalink / raw)
  To: gdb-patches

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

Original post: https://sourceware.org/ml/gdb-patches/2014-04/msg00089.html

ChangeLog:
2014-04-28  Siva Chandra Reddy  <sivachandra@google.com>

         * valops.c (value_dynamic_cast): Fix mixup between rtti_type
         and resolved_type.

         testsuite/
         * gdb.cp/casts.exp: Adjust expected result for few tests.

[-- Attachment #2: fix_dynamic_cast_v1.txt --]
[-- Type: text/plain, Size: 1925 bytes --]

diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp
index 9122450..dd848db 100644
--- a/gdb/testsuite/gdb.cp/casts.exp
+++ b/gdb/testsuite/gdb.cp/casts.exp
@@ -151,8 +151,7 @@ gdb_test "print dynamic_cast<Alpha &> (derived)" \
     "dynamic_cast simple upcast to reference"
 
 gdb_test "print dynamic_cast<Derived *> (ad)" \
-    " = \\(Derived \\*\\) ${nonzero_hex}( <vtable for Derived.*>)?" \
-    "dynamic_cast simple downcast"
+    " = \\(Derived \\*\\) ${nonzero_hex}" "dynamic_cast simple downcast"
 
 gdb_test "print dynamic_cast<VirtuallyDerived *> (add)" \
     " = \\(VirtuallyDerived \\*\\) $nonzero_hex" \
@@ -167,8 +166,7 @@ gdb_test "print dynamic_cast<VirtuallyDerived &> (*ad)" \
     "dynamic_cast to reference to non-existing base"
 
 gdb_test "print dynamic_cast<DoublyDerived *> (add)" \
-    " = \\(DoublyDerived \\*\\) ${nonzero_hex}( <vtable for DoublyDerived.*>)?" \
-    "dynamic_cast unique downcast"
+    " = \\(DoublyDerived \\*\\) ${nonzero_hex}" "dynamic_cast unique downcast"
 
 gdb_test "print dynamic_cast<Gamma *> (add)" \
     " = \\(Gamma \\*\\) $nonzero_hex" \
diff --git a/gdb/valops.c b/gdb/valops.c
index 7f2d5f0..b68c4e1 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -801,14 +801,14 @@ value_dynamic_cast (struct type *type, struct value *arg)
       && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) == TYPE_CODE_VOID)
     return value_at_lazy (type, addr);
 
-  tem = value_at (type, addr);
-  type = value_type (tem);
+  tem = value_at (rtti_type, addr);
 
   /* The first dynamic check specified in 5.2.7.  */
   if (is_public_ancestor (arg_type, TYPE_TARGET_TYPE (resolved_type)))
     {
       if (class_types_same_p (rtti_type, TYPE_TARGET_TYPE (resolved_type)))
-	return tem;
+	return value_from_pointer (type, addr);
+
       result = NULL;
       if (dynamic_cast_check_1 (TYPE_TARGET_TYPE (resolved_type),
 				value_contents_for_printing (tem),

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

* Re: [PING^2] [PATCH] Fix dynamic_cast operator
  2014-04-28 14:13 [PING^2] [PATCH] Fix dynamic_cast operator Siva Chandra
@ 2014-04-29 20:16 ` Doug Evans
  2014-09-23 14:47 ` Siva Chandra
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Evans @ 2014-04-29 20:16 UTC (permalink / raw)
  To: Siva Chandra, Tom Tromey; +Cc: gdb-patches

On Mon, Apr 28, 2014 at 7:13 AM, Siva Chandra <sivachandra@google.com> wrote:
> Original post: https://sourceware.org/ml/gdb-patches/2014-04/msg00089.html
>
> ChangeLog:
> 2014-04-28  Siva Chandra Reddy  <sivachandra@google.com>
>
>          * valops.c (value_dynamic_cast): Fix mixup between rtti_type
>          and resolved_type.
>
>          testsuite/
>          * gdb.cp/casts.exp: Adjust expected result for few tests.

Hi.
fyi, I've been deferring commenting on this patch as I think the
original author of dynamic_cast support can do a better job.  Tom can
get to it whenever he's able.  Just letting you know I haven't set
aside time to.

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

* Re: [PING^2] [PATCH] Fix dynamic_cast operator
  2014-04-28 14:13 [PING^2] [PATCH] Fix dynamic_cast operator Siva Chandra
  2014-04-29 20:16 ` Doug Evans
@ 2014-09-23 14:47 ` Siva Chandra
  1 sibling, 0 replies; 3+ messages in thread
From: Siva Chandra @ 2014-09-23 14:47 UTC (permalink / raw)
  To: gdb-patches

On Mon, Apr 28, 2014 at 7:13 AM, Siva Chandra <sivachandra@google.com> wrote:
> Original post: https://sourceware.org/ml/gdb-patches/2014-04/msg00089.html
>
> ChangeLog:
> 2014-04-28  Siva Chandra Reddy  <sivachandra@google.com>
>
>          * valops.c (value_dynamic_cast): Fix mixup between rtti_type
>          and resolved_type.
>
>          testsuite/
>          * gdb.cp/casts.exp: Adjust expected result for few tests.

Ping.

I have seen some patches around dynamic values recently and hence
trying to bubble this up.

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

end of thread, other threads:[~2014-09-23 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28 14:13 [PING^2] [PATCH] Fix dynamic_cast operator Siva Chandra
2014-04-29 20:16 ` Doug Evans
2014-09-23 14:47 ` Siva Chandra

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).