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 V2 3/5] Fortran: Resolve dynamic target types of pointers.


On 05/07/2016 16:35, Joel Brobecker wrote:
Dynamic target types of pointers have to be resolved before
they can be further processed. If not, GDB wil show wrong
boundaries, size,... or even crash as it will access some
random memory.

2016-06-30  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Changelog:
	* NEWS: Added new fortran feature.
	* gdbtypes.c (resolve_dynamic_pointer_types): Resolve
	  dynamic target types.
	* valops.c (value_ind): Throw error when pointer is
	  not associated.

gdb/Testsuite/Changelog:
	* gdb.fortran/pointers.f90: Add dynamic variables.
	* gdb.fortran/pointers.exp: Test dynamic variables.
	* gdb.fortran/print_type.exp: Test pointer to dynamic
	  types.
I am wondering if this might be causing problems or unnecessary
resolutions. For instance, at least for languages such as Ada,
you don't really need to resolve the pointer type's target type
when just trying to print the pointer's value. In my experience,
this is the type of thing that should be done at type/value printing
time, or when dereferencing the pointer (Eg. during expression
evaluation).

Hi Joel,

we could resolve the target when we actually access it -> value_ind.
As far as I know there is one corner case, when we print the address and the target type has
an DATA_LOCATION attribute. But I don't find the code at the moment.

Nevertheless, with your input it is becomes questionable if we should resolve structures and references. Fields of structures could be resolved when we access them -> value_struct_elt. What do you think?

Let me take a second look on this...

BR
Bernhard
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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