gdb/fortran: add support for ASSOCIATED builtin
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 24 Feb 2021 12:50:00 +0000 (12:50 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 25 Feb 2021 10:09:11 +0000 (10:09 +0000)
commitfaeb9f13c179a4c78bc295a0d0bbd788239704d9
treee711b096230391385126b9dc36c0f4c807221266
parent170f4b23b6df18f6f9eb178530b96d3b056818ed
gdb/fortran: add support for ASSOCIATED builtin

This commit adds support for the ASSOCIATED builtin to the Fortran
expression evaluator.  The ASSOCIATED builtin takes one or two
arguments.

When passed a single pointer argument GDB returns a boolean indicating
if the pointer is associated with anything.

When passed two arguments the second argument should either be some a
pointer could point at or a second pointer.

If the second argument is a pointer target, then the result from
associated indicates if the pointer is pointing at this target.

If the second argument is another pointer, then the result from
associated indicates if the two pointers are pointing at the same
thing.

gdb/ChangeLog:

* f-exp.y (f77_keywords): Add 'associated'.
* f-lang.c (fortran_associated): New function.
(evaluate_subexp_f): Handle FORTRAN_ASSOCIATED.
(operator_length_f): Likewise.
(print_unop_or_binop_subexp_f): New function.
(print_subexp_f): Make use of print_unop_or_binop_subexp_f for
FORTRAN_ASSOCIATED, FORTRAN_LBOUND, and FORTRAN_UBOUND.
(dump_subexp_body_f): Handle FORTRAN_ASSOCIATED.
(operator_check_f): Likewise.
* std-operator.def: Add FORTRAN_ASSOCIATED.

gdb/testsuite/ChangeLog:

* gdb.fortran/associated.exp: New file.
* gdb.fortran/associated.f90: New file.
gdb/ChangeLog
gdb/f-exp.y
gdb/f-lang.c
gdb/std-operator.def
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/associated.exp [new file with mode: 0644]
gdb/testsuite/gdb.fortran/associated.f90 [new file with mode: 0644]
This page took 0.024355 seconds and 4 git commands to generate.