| 1 | /* Fortran language support definitions for GDB, the GNU debugger. |
| 2 | |
| 3 | Copyright (C) 1992-2019 Free Software Foundation, Inc. |
| 4 | |
| 5 | Contributed by Motorola. Adapted from the C definitions by Farooq Butt |
| 6 | (fmbutt@engage.sps.mot.com). |
| 7 | |
| 8 | This file is part of GDB. |
| 9 | |
| 10 | This program is free software; you can redistribute it and/or modify |
| 11 | it under the terms of the GNU General Public License as published by |
| 12 | the Free Software Foundation; either version 3 of the License, or |
| 13 | (at your option) any later version. |
| 14 | |
| 15 | This program is distributed in the hope that it will be useful, |
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | GNU General Public License for more details. |
| 19 | |
| 20 | You should have received a copy of the GNU General Public License |
| 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 22 | |
| 23 | #ifndef F_LANG_H |
| 24 | #define F_LANG_H |
| 25 | |
| 26 | struct type_print_options; |
| 27 | struct parser_state; |
| 28 | |
| 29 | extern int f_parse (struct parser_state *); |
| 30 | |
| 31 | /* Implement the la_print_typedef language method for Fortran. */ |
| 32 | |
| 33 | extern void f_print_typedef (struct type *type, struct symbol *new_symbol, |
| 34 | struct ui_file *stream); |
| 35 | |
| 36 | extern void f_print_type (struct type *, const char *, struct ui_file *, int, |
| 37 | int, const struct type_print_options *); |
| 38 | |
| 39 | extern void f_val_print (struct type *, int, CORE_ADDR, |
| 40 | struct ui_file *, int, |
| 41 | struct value *, |
| 42 | const struct value_print_options *); |
| 43 | |
| 44 | /* Language-specific data structures */ |
| 45 | |
| 46 | /* A common block. */ |
| 47 | |
| 48 | struct common_block |
| 49 | { |
| 50 | /* The number of entries in the block. */ |
| 51 | size_t n_entries; |
| 52 | |
| 53 | /* The contents of the block, allocated using the struct hack. All |
| 54 | pointers in the array are non-NULL. */ |
| 55 | struct symbol *contents[1]; |
| 56 | }; |
| 57 | |
| 58 | extern LONGEST f77_get_upperbound (struct type *); |
| 59 | |
| 60 | extern LONGEST f77_get_lowerbound (struct type *); |
| 61 | |
| 62 | extern void f77_get_dynamic_array_length (struct type *); |
| 63 | |
| 64 | extern int calc_f77_array_dims (struct type *); |
| 65 | |
| 66 | |
| 67 | /* Fortran (F77) types */ |
| 68 | |
| 69 | struct builtin_f_type |
| 70 | { |
| 71 | struct type *builtin_character; |
| 72 | struct type *builtin_integer; |
| 73 | struct type *builtin_integer_s2; |
| 74 | struct type *builtin_integer_s8; |
| 75 | struct type *builtin_logical; |
| 76 | struct type *builtin_logical_s1; |
| 77 | struct type *builtin_logical_s2; |
| 78 | struct type *builtin_logical_s8; |
| 79 | struct type *builtin_real; |
| 80 | struct type *builtin_real_s8; |
| 81 | struct type *builtin_real_s16; |
| 82 | struct type *builtin_complex_s8; |
| 83 | struct type *builtin_complex_s16; |
| 84 | struct type *builtin_complex_s32; |
| 85 | struct type *builtin_void; |
| 86 | }; |
| 87 | |
| 88 | /* Return the Fortran type table for the specified architecture. */ |
| 89 | extern const struct builtin_f_type *builtin_f_type (struct gdbarch *gdbarch); |
| 90 | |
| 91 | /* Ensures that function argument VALUE is in the appropriate form to |
| 92 | pass to a Fortran function. Returns a possibly new value that should |
| 93 | be used instead of VALUE. |
| 94 | |
| 95 | When IS_ARTIFICIAL is true this indicates an artificial argument, |
| 96 | e.g. hidden string lengths which the GNU Fortran argument passing |
| 97 | convention specifies as being passed by value. |
| 98 | |
| 99 | When IS_ARTIFICIAL is false, the argument is passed by pointer. If the |
| 100 | value is already in target memory then return a value that is a pointer |
| 101 | to VALUE. If VALUE is not in memory (e.g. an integer literal), allocate |
| 102 | space in the target, copy VALUE in, and return a pointer to the in |
| 103 | memory copy. */ |
| 104 | |
| 105 | extern struct value *fortran_argument_convert (struct value *value, |
| 106 | bool is_artificial); |
| 107 | |
| 108 | /* Ensures that function argument TYPE is appropriate to inform the debugger |
| 109 | that ARG should be passed as a pointer. Returns the potentially updated |
| 110 | argument type. |
| 111 | |
| 112 | If ARG is of type pointer then the type of ARG is returned, otherwise |
| 113 | TYPE is returned untouched. |
| 114 | |
| 115 | This function exists to augment the types of Fortran function call |
| 116 | parameters to be pointers to the reported value, when the corresponding ARG |
| 117 | has also been wrapped in a pointer (by fortran_argument_convert). This |
| 118 | informs the debugger that these arguments should be passed as a pointer |
| 119 | rather than as the pointed to type. */ |
| 120 | |
| 121 | extern struct type *fortran_preserve_arg_pointer (struct value *arg, |
| 122 | struct type *type); |
| 123 | |
| 124 | #endif /* F_LANG_H */ |