From: "Kempke, Nils-Christian" <nils-christian.kempke@intel.com>
To: Tom Tromey <tom@tromey.com>,
"Kempke,
Nils-Christian via Gdb-patches" <gdb-patches@sourceware.org>
Subject: RE: [PATCH 2/2] gdb: Resolve dynamic target types of pointers.
Date: Tue, 19 Apr 2022 06:59:10 +0000 [thread overview]
Message-ID: <CY4PR1101MB20717DB30486E989FCB54FBBB8F29@CY4PR1101MB2071.namprd11.prod.outlook.com> (raw)
In-Reply-To: <87ee1y1fzn.fsf@tromey.com>
> -----Original Message-----
> From: Tom Tromey <tom@tromey.com>
> Sent: Friday, April 15, 2022 6:14 PM
> To: Kempke, Nils-Christian via Gdb-patches <gdb-patches@sourceware.org>
> Cc: Tom Tromey <tom@tromey.com>; Kempke, Nils-Christian <nils-
> christian.kempke@intel.com>
> Subject: Re: [PATCH 2/2] gdb: Resolve dynamic target types of pointers.
>
> > Thanks for the feedback. Sorry that it took me so long to reply - the mail
> > somehow got lost..
>
> No need to apologize! I'm constantly months behind and/or dropping email.
>
> >> > + if (type->code () == TYPE_CODE_PTR && is_dynamic_type (type))
> >> > + {
> >> > + CORE_ADDR addr;
> >> > + if (nullptr != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type)))
> >> > + addr = value_address (val);
> >> > + else
> >> > + addr = value_as_address (val);
> >>
> >> This seems weird to me. When does value_as_address fail?
>
> > This if else has been introduced because of the way ifort/icc describe
> pointers
> > vs. gcc/gfortran and icx/ifx.
>
> > <1><AAA> DW_TAG_variable
> > <> DW_AT_type: <BBB>
> > <> DW_AT_location: (location of the pointer)
> > <1><BBB> DW_TAG_pointer_type
> > DW_AT_type: <CCC>
> > <1><CCC> DW_TAG_array_type
> > <> DW_AT_type: <DDD>
> > <> DW_AT_data_location: (location of the array)
> > <2><EEE> DW_TAG_subrange_type
>
> > Fortran:
>
> > <1><AAA> DW_TAG_variable
> > <> DW_AT_type: <BBB>
> > <> DW_AT_location: (location of the pointer)
> > <1><BBB> DW_TAG_array_type
> > <> DW_AT_type: <CCC>
> > <> DW_AT_data_location: (location of the array)
> > <2><DDD> DW_TAG_subrange_type
>
> > When printing this pointer to array in gfortran/ifx the pointer print function
> is
> > not actually called - since the DWARF does not emit a pointer here.
> Instead,
> > the normal array print is invoked which will use the DW_AT_data_location.
> > So we do not run into this same problem
>
> I still do not understand, sorry.
>
> For me this looks like two different types. In one situation, the type
> is a pointer to an array. In the second, it's just an array. So, I
> would expect them to print differently.
>
> Are you saying these should print identically? If so, that's fine --
> but then it seems like something to do in the Fortran code, not in
> c-valprint.c.
Yes, that is true. So, in Fortran pointers are just aliases for the underlying objects
> Maybe in the code the check for TYPE_DATA_LOCATION is a proxy for
> checking that the pointer is a pointer to a Fortran array? I guess I
> could understand that, but it doesn't seem like a good approach, because
> what if some C compiler starts emitting this?
>
> >> I'm curious why the code added here is not also needed in f-valprint.c.
>
> > The reason here is simply that Fortran does not have this implemented for
> > Itself. Instead the fortran f_langugage inherits from language_defn (the all
> > languages base class) which simply delegates the value-print to
> > c_value_print / so changing it there suffices.
>
> If Fortran-specific printing is needed, this will have to change.
>
> Tom
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2022-04-19 6:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 13:26 [PATCH 0/2] Resolve dynamic types for pointers Nils-Christian Kempke
2022-01-18 13:26 ` [PATCH 1/2] gdb/types: Resolve dynamic properties of pointer types Nils-Christian Kempke
2022-01-28 18:30 ` Tom Tromey
2022-01-31 8:15 ` Kempke, Nils-Christian
2022-01-18 13:26 ` [PATCH 2/2] gdb: Resolve dynamic target types of pointers Nils-Christian Kempke
2022-02-10 19:47 ` Tom Tromey
2022-04-14 10:22 ` Kempke, Nils-Christian
2022-04-15 16:14 ` Tom Tromey
2022-04-19 6:59 ` Kempke, Nils-Christian [this message]
2022-05-13 14:45 ` Kempke, Nils-Christian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CY4PR1101MB20717DB30486E989FCB54FBBB8F29@CY4PR1101MB2071.namprd11.prod.outlook.com \
--to=nils-christian.kempke@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).