aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-02-24 12:50:00 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-02-25 10:09:11 +0000
commitfaeb9f13c179a4c78bc295a0d0bbd788239704d9 (patch)
treee711b096230391385126b9dc36c0f4c807221266 /gdb/f-exp.y
parent170f4b23b6df18f6f9eb178530b96d3b056818ed (diff)
downloadgdb-faeb9f13c179a4c78bc295a0d0bbd788239704d9.zip
gdb-faeb9f13c179a4c78bc295a0d0bbd788239704d9.tar.gz
gdb-faeb9f13c179a4c78bc295a0d0bbd788239704d9.tar.bz2
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.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 64f5fd5..f5360c1 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1048,6 +1048,7 @@ static const struct token f77_keywords[] =
{ "lbound", UNOP_OR_BINOP_INTRINSIC, FORTRAN_LBOUND, false },
{ "ubound", UNOP_OR_BINOP_INTRINSIC, FORTRAN_UBOUND, false },
{ "allocated", UNOP_INTRINSIC, UNOP_FORTRAN_ALLOCATED, false },
+ { "associated", UNOP_OR_BINOP_INTRINSIC, FORTRAN_ASSOCIATED, false },
};
/* Implementation of a dynamically expandable buffer for processing input