Commit Graph

3 Commits

Author SHA1 Message Date
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Andrew Burgess b6d03bb2b6 gdb/fortran: Additional builtin procedures
Add some additional builtin procedures for Fortran, these are MOD,
CEILING, FLOOR, MODULO, and CMPLX.

gdb/ChangeLog:

	* f-exp.y (BINOP_INTRINSIC): New token.
	(exp): New parser rule handling BINOP_INTRINSIC.
	(f77_keywords): Add new builtin procedures.
	* f-lang.c (evaluate_subexp_f): Handle BINOP_MOD, UNOP_FORTRAN_CEILING,
	UNOP_FORTRAN_FLOOR, BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX.
	(operator_length_f): Handle UNOP_FORTRAN_CEILING,
	UNOP_FORTRAN_FLOOR, BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX.
	(print_unop_subexp_f): New function.
	(print_binop_subexp_f): New function.
	(print_subexp_f): Handle UNOP_FORTRAN_CEILING, UNOP_FORTRAN_FLOOR,
	BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX.
	(dump_subexp_body_f): Likewise.
	(operator_check_f): Likewise.
	* fortran-operator.def: Add UNOP_FORTRAN_CEILING, UNOP_FORTRAN_FLOOR,
	BINOP_FORTRAN_MODULO, BINOP_FORTRAN_CMPLX

gdb/testsuite/ChangeLog:

	* gdb.fortran/intrinsics.exp: Extend to cover MOD, CEILING, FLOOR,
	MODULO, CMPLX.
2019-04-30 10:10:24 +01:00
Andrew Burgess 83228e93ef gdb/fortran: Introduce fortran-operator.def file
Future commits will add more Fortran specific expression operators.

In preparation for these new operators, this commit adds a new
fortran-operator.def file similar to how GDB already has
ada-operator.def.

I've moved UNOP_KIND the Fortran specific operator I introduced in
commit 4d00f5d8f6 into this file, and renamed it to make it clearer
that the operator is Fortran specific.  I've then updated the Fortran
exp_descriptor table (exp_descriptor_f) to use entirely Fortran
specific functions that now handle UNOP_FORTRAN_KIND (the new name for
UNOP_KIND).

There should be no visible changes for standard users after this
commit, though for developers, the output when 'set debug expression
1' is now better, before:

  (gdb) p kind (l1)
  Dump of expression @ 0x2ccc7a0, before conversion to prefix form:
  	Language fortran, 5 elements, 16 bytes each.
  	Index                Opcode         Hex Value  String Value
  	    0          OP_VAR_VALUE  42  *...............
  	    1               OP_NULL  47730176  .N..............
  	    2          BINOP_INTDIV  47729184   J..............
  	    3          OP_VAR_VALUE  42  *...............
  	    4             UNOP_KIND  78  N...............
  Dump of expression @ 0x2ccc7a0, after conversion to prefix form:
  Expression: `Invalid expression
  (gdb)

and after:

  (gdb) p kind (l1)
  Dump of expression @ 0x294d0b0, before conversion to prefix form:
  	Language fortran, 5 elements, 16 bytes each.
  	Index                Opcode         Hex Value  String Value
  	    0          OP_VAR_VALUE  40  (...............
  	    1   unknown opcode: 224  44088544  ................
  	    2   unknown opcode: 208  44087504  ................
  	    3          OP_VAR_VALUE  40  (...............
  	    4     UNOP_FORTRAN_KIND  119  w...............
  Dump of expression @ 0x294d0b0, after conversion to prefix form:
  Expression: `KIND(test::l1)'
  	Language fortran, 5 elements, 16 bytes each.

  	    0  UNOP_FORTRAN_KIND
  	    1    OP_VAR_VALUE          Block @0x2a0bce0, symbol @0x2a0b8d0 (l1)
  $1 = 1
  (gdb)

gdb/ChangeLog:

	* gdb/expprint.c (dump_subexp_body_standard): Remove use of
	UNOP_KIND.
	* gdb/expression.h (exp_opcode): Include 'fortran-operator.def'.
	* gdb/f-exp.y (exp): Rename UNOP_KIND to UNOP_FORTRAN_KIND.
	* gdb/f-lang.c (evaluate_subexp_f): Likewise.
	(operator_length_f): New fuction.
	(print_subexp_f): New function.
	(op_name_f): New function.
	(dump_subexp_body_f): New function.
	(operator_check_f): New function.
	(exp_descriptor_f): Replace standard expression handling functions
	with new functions.
	* gdb/fortran-operator.def: New file.
	* gdb/parse.c (operator_length_standard): Remove use of UNOP_KIND.
	* gdb/std-operator.def: Remove UNOP_KIND.
2019-04-30 10:09:27 +01:00