1*5796c8dcSSimon Schubert /* Fortran language support definitions for GDB, the GNU debugger. 2*5796c8dcSSimon Schubert 3*5796c8dcSSimon Schubert Copyright (C) 1992, 1993, 1994, 1995, 1998, 2000, 2005, 2007, 2008, 2009 4*5796c8dcSSimon Schubert Free Software Foundation, Inc. 5*5796c8dcSSimon Schubert 6*5796c8dcSSimon Schubert Contributed by Motorola. Adapted from the C definitions by Farooq Butt 7*5796c8dcSSimon Schubert (fmbutt@engage.sps.mot.com). 8*5796c8dcSSimon Schubert 9*5796c8dcSSimon Schubert This file is part of GDB. 10*5796c8dcSSimon Schubert 11*5796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 12*5796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 13*5796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 14*5796c8dcSSimon Schubert (at your option) any later version. 15*5796c8dcSSimon Schubert 16*5796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 17*5796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 18*5796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19*5796c8dcSSimon Schubert GNU General Public License for more details. 20*5796c8dcSSimon Schubert 21*5796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 22*5796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 23*5796c8dcSSimon Schubert 24*5796c8dcSSimon Schubert extern int f_parse (void); 25*5796c8dcSSimon Schubert 26*5796c8dcSSimon Schubert extern void f_error (char *); /* Defined in f-exp.y */ 27*5796c8dcSSimon Schubert 28*5796c8dcSSimon Schubert extern void f_print_type (struct type *, char *, struct ui_file *, int, 29*5796c8dcSSimon Schubert int); 30*5796c8dcSSimon Schubert 31*5796c8dcSSimon Schubert extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, 32*5796c8dcSSimon Schubert struct ui_file *, int, 33*5796c8dcSSimon Schubert const struct value_print_options *); 34*5796c8dcSSimon Schubert 35*5796c8dcSSimon Schubert /* Language-specific data structures */ 36*5796c8dcSSimon Schubert 37*5796c8dcSSimon Schubert /* In F90 subrange expression, either bound could be empty, indicating that 38*5796c8dcSSimon Schubert its value is by default that of the corresponding bound of the array or 39*5796c8dcSSimon Schubert string. So we have four sorts of subrange in F90. This enumeration type 40*5796c8dcSSimon Schubert is to identify this. */ 41*5796c8dcSSimon Schubert 42*5796c8dcSSimon Schubert enum f90_range_type 43*5796c8dcSSimon Schubert { 44*5796c8dcSSimon Schubert BOTH_BOUND_DEFAULT, /* "(:)" */ 45*5796c8dcSSimon Schubert LOW_BOUND_DEFAULT, /* "(:high)" */ 46*5796c8dcSSimon Schubert HIGH_BOUND_DEFAULT, /* "(low:)" */ 47*5796c8dcSSimon Schubert NONE_BOUND_DEFAULT /* "(low:high)" */ 48*5796c8dcSSimon Schubert }; 49*5796c8dcSSimon Schubert 50*5796c8dcSSimon Schubert struct common_entry 51*5796c8dcSSimon Schubert { 52*5796c8dcSSimon Schubert struct symbol *symbol; /* The symbol node corresponding 53*5796c8dcSSimon Schubert to this component */ 54*5796c8dcSSimon Schubert struct common_entry *next; /* The next component */ 55*5796c8dcSSimon Schubert }; 56*5796c8dcSSimon Schubert 57*5796c8dcSSimon Schubert struct saved_f77_common 58*5796c8dcSSimon Schubert { 59*5796c8dcSSimon Schubert char *name; /* Name of COMMON */ 60*5796c8dcSSimon Schubert char *owning_function; /* Name of parent function */ 61*5796c8dcSSimon Schubert int secnum; /* Section # of .bss */ 62*5796c8dcSSimon Schubert CORE_ADDR offset; /* Offset from .bss for 63*5796c8dcSSimon Schubert this block */ 64*5796c8dcSSimon Schubert struct common_entry *entries; /* List of block's components */ 65*5796c8dcSSimon Schubert struct common_entry *end_of_entries; /* ptr. to end of components */ 66*5796c8dcSSimon Schubert struct saved_f77_common *next; /* Next saved COMMON block */ 67*5796c8dcSSimon Schubert }; 68*5796c8dcSSimon Schubert 69*5796c8dcSSimon Schubert typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR; 70*5796c8dcSSimon Schubert 71*5796c8dcSSimon Schubert typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR; 72*5796c8dcSSimon Schubert 73*5796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */ 74*5796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */ 75*5796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */ 76*5796c8dcSSimon Schubert 77*5796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *); 78*5796c8dcSSimon Schubert 79*5796c8dcSSimon Schubert #define UNINITIALIZED_SECNUM -1 80*5796c8dcSSimon Schubert #define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM) 81*5796c8dcSSimon Schubert 82*5796c8dcSSimon Schubert #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */ 83*5796c8dcSSimon Schubert #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */ 84*5796c8dcSSimon Schubert #define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */ 85*5796c8dcSSimon Schubert 86*5796c8dcSSimon Schubert /* When reasonable array bounds cannot be fetched, such as when 87*5796c8dcSSimon Schubert you ask to 'mt print symbols' and there is no stack frame and 88*5796c8dcSSimon Schubert therefore no way of knowing the bounds of stack-based arrays, 89*5796c8dcSSimon Schubert we have to assign default bounds, these are as good as any... */ 90*5796c8dcSSimon Schubert 91*5796c8dcSSimon Schubert #define DEFAULT_UPPER_BOUND 999999 92*5796c8dcSSimon Schubert #define DEFAULT_LOWER_BOUND -999999 93*5796c8dcSSimon Schubert 94*5796c8dcSSimon Schubert extern char *real_main_name; /* Name of main function */ 95*5796c8dcSSimon Schubert extern int real_main_c_value; /* C_value field of main function */ 96*5796c8dcSSimon Schubert 97*5796c8dcSSimon Schubert extern int f77_get_upperbound (struct type *); 98*5796c8dcSSimon Schubert 99*5796c8dcSSimon Schubert extern int f77_get_lowerbound (struct type *); 100*5796c8dcSSimon Schubert 101*5796c8dcSSimon Schubert extern void f77_get_dynamic_array_length (struct type *); 102*5796c8dcSSimon Schubert 103*5796c8dcSSimon Schubert extern int calc_f77_array_dims (struct type *); 104*5796c8dcSSimon Schubert 105*5796c8dcSSimon Schubert 106*5796c8dcSSimon Schubert /* Fortran (F77) types */ 107*5796c8dcSSimon Schubert 108*5796c8dcSSimon Schubert struct builtin_f_type 109*5796c8dcSSimon Schubert { 110*5796c8dcSSimon Schubert struct type *builtin_character; 111*5796c8dcSSimon Schubert struct type *builtin_integer; 112*5796c8dcSSimon Schubert struct type *builtin_integer_s2; 113*5796c8dcSSimon Schubert struct type *builtin_logical; 114*5796c8dcSSimon Schubert struct type *builtin_logical_s1; 115*5796c8dcSSimon Schubert struct type *builtin_logical_s2; 116*5796c8dcSSimon Schubert struct type *builtin_real; 117*5796c8dcSSimon Schubert struct type *builtin_real_s8; 118*5796c8dcSSimon Schubert struct type *builtin_real_s16; 119*5796c8dcSSimon Schubert struct type *builtin_complex_s8; 120*5796c8dcSSimon Schubert struct type *builtin_complex_s16; 121*5796c8dcSSimon Schubert struct type *builtin_complex_s32; 122*5796c8dcSSimon Schubert struct type *builtin_void; 123*5796c8dcSSimon Schubert }; 124*5796c8dcSSimon Schubert 125*5796c8dcSSimon Schubert /* Return the Fortran type table for the specified architecture. */ 126*5796c8dcSSimon Schubert extern const struct builtin_f_type *builtin_f_type (struct gdbarch *gdbarch); 127*5796c8dcSSimon Schubert 128