This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3 PR gdb/16959] gdb hangs in infinite recursion




On 3/24/2018 5:33 AM, Simon Marchi wrote:
On 2018-03-24 06:10, Pedro Alves wrote:
On 03/23/2018 09:25 PM, Weimin Pan wrote:

-  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+  struct type *real_type = check_typedef (type);
+  if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT)
     {
       CORE_ADDR *first_dont_print;
       CORE_ADDR addr;
@@ -658,15 +659,14 @@ cp_print_static_field (struct type *type,
       addr = value_address (val);
       obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
             sizeof (CORE_ADDR));
-      type = check_typedef (type);
-      cp_print_value_fields (type, value_enclosing_type (val),
+      cp_print_value_fields (real_type, value_enclosing_type (val),

This is still passing the resolved type down instead of the
original type.

I did not point this out because cp_print_value_fields does a check_typedef anyway, so it doesn't change anything.  But it's true that to be consistent it would be better to always pass down the original type, and let the callee decide whether it wants to resolve the typedef or not.  Please consider this comment when preparing the next version.


Please note the check_typedef() call (now redundant and removed) before calling cp_print_value_fields().
So passing the resolved type is correct.

Thanks,
Weimin

Thanks,

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]