This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH V4 3/6] Typeprint: Resolve any dynamic target type of a pointer.
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Bernhard Heckel <bernhard dot heckel at intel dot com>
- Cc: Yao Qi <qiyaoltc at gmail dot com>, brobecker at adacore dot com, gdb-patches at sourceware dot org
- Date: Thu, 13 Oct 2016 14:41:04 +0100
- Subject: Re: [PATCH V4 3/6] Typeprint: Resolve any dynamic target type of a pointer.
- Authentication-results: sourceware.org; auth=none
- References: <1473230295-809-1-git-send-email-bernhard.heckel@intel.com> <1473230295-809-4-git-send-email-bernhard.heckel@intel.com> <861szvayzg.fsf@gmail.com> <57F4DE0E.2030505@intel.com>
Bernhard Heckel <bernhard.heckel@intel.com> writes:
>>> +extern "C" {
>>> +#include <stddef.h>
>>> +}
>>> +
>> Why do you include stddef.h?
> definition of NULL
> + typeof (vla) *ptr = NULL;
>
It is c++, so we can include <cstddef> for NULL.
>>> diff --git a/gdb/typeprint.c b/gdb/typeprint.c
>>> index e77513e..e3d84c7 100644
>>> --- a/gdb/typeprint.c
>>> +++ b/gdb/typeprint.c
>>> @@ -485,6 +485,25 @@ whatis_exp (char *exp, int show)
>>> printf_filtered (" */\n");
>>> }
>>> + /* Resolve any dynamic target type, as we might print
>>> + additional information about the target.
>>> + For example, in Fortran and C we are printing the dimension of the
>>> + dynamic array the pointer is pointing to. */
>>> + if (TYPE_CODE (type) == TYPE_CODE_PTR
>>> + && is_dynamic_type (type) == 1)
>> is_dynamic_type returns bool-like value, so don't check it with 1.
>> Looks we need to check is_dynamic_type (TYPE_TARGET_TYPE (type)), no?
> is_dynamic_type takes care of target types for pointer and reference types.
> So, we can keep it.
OK, no problem.
--
Yao (齐尧)