diff options
author | Felix Willgerodt <felix.willgerodt@intel.com> | 2021-03-09 11:34:55 +0100 |
---|---|---|
committer | Felix Willgerodt <felix.willgerodt@intel.com> | 2021-03-09 11:34:55 +0100 |
commit | 611aa09d994fc5a8a9444075e65f0d6d4ebf4922 (patch) | |
tree | effc6393a6e4c210d02a40ce547454402215ed99 /gdb/f-exp.y | |
parent | gdb/fotran: add support for the 'shape' keyword (diff) | |
download | binutils-gdb-611aa09d994fc5a8a9444075e65f0d6d4ebf4922.tar.gz binutils-gdb-611aa09d994fc5a8a9444075e65f0d6d4ebf4922.tar.bz2 binutils-gdb-611aa09d994fc5a8a9444075e65f0d6d4ebf4922.zip |
gdb/fortran: Add 'LOC' intrinsic support.
LOC(X) returns the address of X as an integer:
https://gcc.gnu.org/onlinedocs/gfortran/LOC.html
Before:
(gdb) p LOC(r)
No symbol "LOC" in current context.
After:
(gdb) p LOC(r)
$1 = 0xffffdf48
gdb/ChangeLog:
2021-03-09 Felix Willgerodt <felix.willgerodt@intel.com>
* f-exp.h (eval_op_f_loc): Declare.
(expr::fortran_loc_operation): New typedef.
* f-exp.y (exp): Handle UNOP_FORTRAN_LOC after parsing an
UNOP_INTRINSIC.
(f77_keywords): Add LOC keyword.
* f-lang.c (eval_op_f_loc): New function.
* std-operator.def (UNOP_FORTRAN_LOC): New operator.
gdb/testsuite/ChangeLog:
2020-03-09 Felix Willgerodt <felix.willgerodt@intel.com>
* gdb.fortran/intrinsics.exp: Add LOC tests.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r-- | gdb/f-exp.y | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y index dcc28b8e600..ce11b09b18e 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -333,6 +333,9 @@ exp : UNOP_INTRINSIC '(' exp ')' case UNOP_FORTRAN_SHAPE: pstate->wrap<fortran_array_shape_operation> (); break; + case UNOP_FORTRAN_LOC: + pstate->wrap<fortran_loc_operation> (); + break; default: gdb_assert_not_reached ("unhandled intrinsic"); } @@ -1155,6 +1158,7 @@ static const struct token f77_keywords[] = { "rank", UNOP_INTRINSIC, UNOP_FORTRAN_RANK, false }, { "size", UNOP_OR_BINOP_INTRINSIC, FORTRAN_ARRAY_SIZE, false }, { "shape", UNOP_INTRINSIC, UNOP_FORTRAN_SHAPE, false }, + { "loc", UNOP_INTRINSIC, UNOP_FORTRAN_LOC, false }, }; /* Implementation of a dynamically expandable buffer for processing input |