aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
diff options
context:
space:
mode:
authorBernhard Heckel <bernhard.heckel@intel.com>2022-10-13 15:17:23 +0200
committerIjaz, Abdul B <abdul.b.ijaz@intel.com>2024-02-02 08:57:16 +0100
commitf18fc7e56fbb605aa38643881eb0228313466551 (patch)
treed97a46d5aa4592514b7842f84a9a541371fed236 /gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
parent2e07108364e2c8494a41919a56ca4a40092c9d58 (diff)
downloadbinutils-f18fc7e56fbb605aa38643881eb0228313466551.zip
binutils-f18fc7e56fbb605aa38643881eb0228313466551.tar.gz
binutils-f18fc7e56fbb605aa38643881eb0228313466551.tar.bz2
gdb, types: Resolve pointer types dynamically
This commit allows pointers to be dynamic types (on the outmost level). Similar to references, a pointer is considered a dynamic type if its target type is a dynamic type and it is on the outmost level. Also this commit removes the redundant code inside function "value_check_printable" for handling of DW_AT_associated type. The pointer resolution follows the one of references. This change generally makes the GDB output more verbose. We are able to print more details about a pointer's target like the dimension of an array. In Fortran, if we have a pointer to a dynamic type type buffer real, dimension(:), pointer :: ptr end type buffer type(buffer), pointer :: buffer_ptr allocate (buffer_ptr) allocate (buffer_ptr%ptr (5)) which then gets allocated, we now resolve the dynamic type before printing the pointer's type: Before: (gdb) ptype buffer_ptr type = PTR TO -> ( Type buffer real(kind=4) :: alpha(:) End Type buffer ) After: (gdb) ptype buffer_ptr type = PTR TO -> ( Type buffer real(kind=4) :: alpha(5) End Type buffer ) Similarly in C++ we can dynamically resolve e.g. pointers to arrays: int len = 3; int arr[len]; int (*ptr)[len]; int ptr = &arr; Once the pointer is assigned one gets: Before: (gdb) p ptr $1 = (int (*)[variable length]) 0x123456 (gdb) ptype ptr type = int (*)[variable length] After: (gdb) p ptr $1 = (int (*)[3]) 0x123456 (gdb) ptype ptr type = int (*)[3] For more examples see the modified/added test cases. Tested-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org> Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.fortran/pointer-to-pointer.exp')
-rw-r--r--gdb/testsuite/gdb.fortran/pointer-to-pointer.exp2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
index da1be8b..dfff519 100644
--- a/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
+++ b/gdb/testsuite/gdb.fortran/pointer-to-pointer.exp
@@ -41,7 +41,7 @@ gdb_test "print buffer" \
gdb_test "ptype buffer" \
[multi_line \
"type = PTR TO -> \\( Type l_buffer" \
- " $real4 :: alpha\\(:\\)" \
+ " $real4 :: alpha\\(5\\)" \
"End Type l_buffer \\)" ]
gdb_test "ptype buffer%alpha" "type = $real4 \\(5\\)"