From 611aa09d994fc5a8a9444075e65f0d6d4ebf4922 Mon Sep 17 00:00:00 2001 From: Felix Willgerodt Date: Tue, 9 Mar 2021 11:34:55 +0100 Subject: 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 * 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 * gdb.fortran/intrinsics.exp: Add LOC tests. --- gdb/f-exp.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gdb/f-exp.h') diff --git a/gdb/f-exp.h b/gdb/f-exp.h index 11f19af..b3d0e0e 100644 --- a/gdb/f-exp.h +++ b/gdb/f-exp.h @@ -73,6 +73,11 @@ extern struct value * eval_op_f_allocated (struct type *expect_type, enum noside noside, enum exp_opcode op, struct value *arg1); +extern struct value * eval_op_f_loc (struct type *expect_type, + struct expression *exp, + enum noside noside, + enum exp_opcode op, + struct value *arg1); /* Implement the evaluation of UNOP_FORTRAN_RANK. EXPECTED_TYPE, EXP, and NOSIDE are as for expression::evaluate (see expression.h). OP will @@ -131,6 +136,8 @@ using fortran_kind_operation = unop_operation; using fortran_allocated_operation = unop_operation; +using fortran_loc_operation = unop_operation; using fortran_mod_operation = binop_operation; using fortran_modulo_operation = binop_operation