[PATCH 0/4] Dynamic properties of pointers

Nils-Christian Kempke nils-christian.kempke@intel.com
Tue Sep 20 07:26:25 GMT 2022


Hi,

this series was partly posted to the mailing list before here:

https://sourceware.org/pipermail/gdb-patches/2022-January/185233.html

The original posting contained a different (probably much worse) version
of patch 2 and 3 of this series:

	gdb, typeprint: fix pointer/reference typeprint for icc/ifort
	gdb/types: Resolve pointer types dynamically 

Back then it seems now that I had not fully understood what happened -
thanks to Tom for his insightful review and comments!

The originally posted series attempted to allow pointer types to be
considered as dynamic types within GDB and tried to then resolve dynamic
properties of pointers when e.g. printing them.

This series, or rather patch 2 does mainly the same.  It enables GDB to
mark pointers that point to dynamic types (such as arrays) as dynamic
types similar as it is already done for references.

We tried to also have this new 'feature' for icc/icpc/ifort and ran into
some problems, which caused the addition of Patch 1 and Patch 3.  Patch
1 was added as the newer versions of icc emit a deprecated warning which
is unexpected within the testsuite.  Patch 3 was added because of the
way icc/icpc/ifort emit references and pointers.  Patch 3 was partly
also visible in the original series - but it was poorly done there and
not separated properly leading to much confusion.
Patch 3 still seems a bit like a hack to me - but is also seemed
reasonable to do it like this.  If anyone has a better idea on patch 3 -
I am happy to change it.  I expect this part to be the most
controversial.

Patch 4 is just a small addition from the Fortran side, which also
originally motivated this series.  Fortran pointers can have the dynamic
property DW_AT_associated - telling dynamically whether a pointer is
associated or not.  As we are now able to resolve dynamic properties we
could also fix the sizeof intrinsic operator (Fortran allows for
printing the size of a pointer-to-array) since we dynamically resolve
array sizes of pointer-to-arrays.

Any feedback is welcome!

Cheers!
Nils

Bernhard Heckel (1):
  gdb/types: Resolve pointer types dynamically

Nils-Christian Kempke (3):
  gdb, testsuite: handle icc and icpc deprecated remarks
  gdb, typeprint: fix pointer/reference typeprint for icc/ifort
  gdb/fortran: Fix sizeof intrinsic for Fortran

 gdb/eval.c                                    |   3 +
 gdb/gdbtypes.c                                |  77 +++++++-
 gdb/testsuite/gdb.cp/vla-cxx.cc               |   4 +
 gdb/testsuite/gdb.cp/vla-cxx.exp              |  33 ++++
 gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp       |  16 +-
 .../gdb.fortran/pointer-to-pointer.exp        |   2 +-
 gdb/testsuite/gdb.fortran/pointers.exp        | 178 ++++++++++++++++++
 gdb/testsuite/gdb.fortran/pointers.f90        |  29 +++
 gdb/testsuite/gdb.fortran/sizeof.exp          | 110 +++++++++++
 gdb/testsuite/gdb.fortran/sizeof.f90          | 108 +++++++++++
 gdb/testsuite/lib/gdb.exp                     |  18 ++
 gdb/valprint.c                                |  24 ++-
 12 files changed, 582 insertions(+), 20 deletions(-)
 create mode 100644 gdb/testsuite/gdb.fortran/pointers.exp
 create mode 100644 gdb/testsuite/gdb.fortran/sizeof.exp
 create mode 100644 gdb/testsuite/gdb.fortran/sizeof.f90

-- 
2.25.1

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



More information about the Gdb-patches mailing list