binutils-gdb/gdb/testsuite/gdb.fortran
Ijaz, Abdul B b0fdcd4706 fortran: Fix arrays of variable length strings for FORTRAN
Before this change resolve_dynamic_array_or_string was called for
all TYPE_CODE_ARRAY and TYPE_CODE_STRING types, but, in the end,
this function always called create_array_type_with_stride, which
creates a TYPE_CODE_ARRAY type.

Suppose we have

subroutine vla_array (arr1, arr2)
  character (len=*):: arr1 (:)
  character (len=5):: arr2 (:)

  print *, arr1 ! break-here
  print *, arr2
end subroutine vla_array

The "print arr1" and "print arr2" command at the "break-here" line
gives the following output:

(gdb) print arr1
$1 = <incomplete type>
(gdb) print arr2
$2 = ('abcde', 'abcde', 'abcde')
(gdb) ptype arr1
type = Type
End Type
(gdb) ptype arr2
type = character*5 (3)

Dwarf info using Intel® Fortran Compiler for such case contains following:
 <1><fd>: Abbrev Number: 12 (DW_TAG_string_type)
    <fe>   DW_AT_name        : (indirect string, offset: 0xd2): .str.ARR1
    <102>   DW_AT_string_length: 3 byte block: 97 23 8 (DW_OP_push_object_address; DW_OP_plus_uconst: 8)

After this change resolve_dynamic_array_or_string now calls
create_array_type_with_stride or create_string_type, so if the
incoming dynamic type is a TYPE_CODE_STRING then we'll get back a
TYPE_CODE_STRING type.  Now gdb shows following:

(gdb) p arr1
$1 = ('abddefghij', 'abddefghij', 'abddefghij', 'abddefghij', 'abddefghij')
(gdb) p arr2
$2 = ('abcde', 'abcde', 'abcde')
(gdb) ptype arr1
type = character*10 (5)
(gdb) ptype arr2
type = character*5 (3)

In case of GFortran, compiler emits DW_TAG_structure_type for string type
arguments of the subroutine and it has only DW_AT_declaration tag.  This
results in <incomplete type> in gdb.  So, following issue is raised in gcc
bugzilla "https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101826".

Fixing above issue introduce regression in gdb.fortran/mixed-lang-stack.exp,
i.e. the test forces the language to C/C++ and print a Fortran string value.
The string value is a dynamic type with code TYPE_CODE_STRING.

Before this commit the dynamic type resolution would always convert this to
a TYPE_CODE_ARRAY of characters, which the C value printing could handle.

But now after this commit we get a TYPE_CODE_STRING, which
neither the C value printing, or the generic value printing code can
support.  And so, I've added support for TYPE_CODE_STRING to the generic
value printing, all characters of strings are printed together till the
first null character.

Lastly, in gdb.opt/fortran-string.exp and gdb.fortran/string-types.exp
tests it expects type of character array in 'character (3)' format but now
after this change we get 'character*3', so tests are updated accordingly.

Approved-By: Tom Tromey <tom@tromey.com>
2024-10-29 09:28:41 +01:00
..
allocated.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
allocated.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-bounds-high.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-bounds-high.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-bounds.exp [gdb/testsuite] Fix gdb.fortran/array-bounds.exp on arm 2024-06-07 08:12:34 +02:00
array-bounds.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-element.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-element.f Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-indices.exp [gdb/testsuite] Fix duplicates in gdb.fortran/array-{indices,repeat}.exp 2024-06-17 23:26:03 +02:00
array-no-bounds.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-no-bounds.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-repeat.exp [gdb/testsuite] Fix duplicates in gdb.fortran/array-{indices,repeat}.exp 2024-06-17 23:26:03 +02:00
array-repeat.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-slices-bad.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
array-slices-bad.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-slices-repeat.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-slices-sub-slices.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
array-slices-sub-slices.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
array-slices.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
array-slices.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
associated.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
associated.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
assumedrank.exp gdb/testsuite: introduce dwarf5 option to gdb_compile 2024-10-23 14:16:37 -03:00
assumedrank.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
backtrace.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
backtrace.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
block-data.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
block-data.f Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
call-no-debug-func.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
call-no-debug-prog.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
call-no-debug.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
charset.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
charset.f90
class-allocatable-array.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
class-allocatable-array.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
common-block.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
common-block.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
completion.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
completion.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
complex.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
complex.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
debug-expr.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
debug-expr.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
derived-type-function.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
derived-type-function.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
derived-type-striding.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
derived-type-striding.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
derived-type.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
derived-type.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
dot-ops.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
dynamic-ptype-whatis.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
dynamic-ptype-whatis.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
empty-string.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
empty-string.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
entry-point.exp gdb/testsuite: extend XFAIL to gdb.fortran/entry-point.exp to clang too 2024-08-02 09:06:26 -03:00
entry-point.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
exprs.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
function-calls.exp gdb: rename unwindonsignal to unwind-on-signal 2024-03-25 17:25:07 +00:00
function-calls.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
huge.exp [gdb/testsuite] Fix duplicates in gdb.fortran/huge.exp 2024-06-20 15:37:48 +02:00
huge.F90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
info-main.exp [gdb/testsuite] Use save_vars to restore GDBFLAGS 2024-05-03 15:07:33 +02:00
info-main.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
info-modules.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
info-types-2.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
info-types.exp [gdb/testsuite] Fix timeout in gdb.fortran/info-types.exp 2024-09-23 21:40:16 +02:00
info-types.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intrinsic-precedence.c Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intrinsic-precedence.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intrinsic-precedence.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intrinsics.exp [gdb/exp] Fix gdb.fortran/intrinsics.exp fail on arm 2024-07-31 13:11:48 +02:00
intrinsics.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intvar-array.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intvar-array.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intvar-dynamic-types.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
intvar-dynamic-types.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
lbound-ubound.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
lbound-ubound.F90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
library-module-lib.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
library-module-main.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
library-module.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
limited-length.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
limited-length.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
logical.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
logical.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
max-depth.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
max-depth.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mixed-lang-stack.c Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mixed-lang-stack.cpp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mixed-lang-stack.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mixed-lang-stack.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
module.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
module.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
multi-dim.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
multi-dim.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
namelist.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
namelist.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nested-funcs-2.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nested-funcs-2.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nested-funcs.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nested-funcs.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
oop_extend_type.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
oop_extend_type.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
pointer-to-pointer.exp gdb, types: Resolve pointer types dynamically 2024-02-02 08:57:16 +01:00
pointer-to-pointer.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
pointers.exp gdb, types: Resolve pointer types dynamically 2024-02-02 08:57:16 +01:00
pointers.f90 gdb, types: Resolve pointer types dynamically 2024-02-02 08:57:16 +01:00
print_type.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
print-formatted.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
print-formatted.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
printing-types.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
printing-types.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
ptr-indentation.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
ptr-indentation.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
ptype-on-functions.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
ptype-on-functions.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
rank.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
rank.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
shape.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
shape.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
short-circuit-argument-list.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
short-circuit-argument-list.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
size.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
size.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
sizeof.exp gdb, testsuite, fortran: Fix sizeof intrinsic for Fortran pointers 2024-02-02 08:57:16 +01:00
sizeof.f90 gdb, testsuite, fortran: Fix sizeof intrinsic for Fortran pointers 2024-02-02 08:57:16 +01:00
string-types.exp fortran: Fix arrays of variable length strings for FORTRAN 2024-10-29 09:28:41 +01:00
string-types.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
subarray.exp [gdb/testsuite] Don't use set auto-solib-add off 2024-06-10 10:43:10 +02:00
subarray.f Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
type-kinds.exp [gdb/exp] Fix gdb.fortran/intrinsics.exp fail on arm 2024-07-31 13:11:48 +02:00
type.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
types.exp [gdb] Fix common misspellings 2024-10-06 07:59:48 +02:00
vla-alloc-assoc.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
vla-array.exp fortran: Fix arrays of variable length strings for FORTRAN 2024-10-29 09:28:41 +01:00
vla-array.f90 fortran: Fix arrays of variable length strings for FORTRAN 2024-10-29 09:28:41 +01:00
vla-datatypes.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
vla-datatypes.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-history.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-ptr-info.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-ptype-sub.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
vla-ptype.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-sizeof.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-sub.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-type.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-type.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-value-sub-arbitrary.exp [gdb] Fix common misspellings 2024-10-06 07:59:48 +02:00
vla-value-sub-finish.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
vla-value-sub.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
vla-value.exp [gdb/testsuite] Fix trailing-text-in-parentheses duplicates 2024-07-31 15:04:25 +02:00
vla.f90 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
whatis_type.exp Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00