15796c8dcSSimon Schubert /* Fortran language support definitions for GDB, the GNU debugger. 25796c8dcSSimon Schubert 3*cf7f2e2dSJohn Marino Copyright (C) 1992, 1993, 1994, 1995, 1998, 2000, 2005, 2007, 2008, 2009, 4*cf7f2e2dSJohn Marino 2010 Free Software Foundation, Inc. 55796c8dcSSimon Schubert 65796c8dcSSimon Schubert Contributed by Motorola. Adapted from the C definitions by Farooq Butt 75796c8dcSSimon Schubert (fmbutt@engage.sps.mot.com). 85796c8dcSSimon Schubert 95796c8dcSSimon Schubert This file is part of GDB. 105796c8dcSSimon Schubert 115796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 125796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 135796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 145796c8dcSSimon Schubert (at your option) any later version. 155796c8dcSSimon Schubert 165796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 175796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 185796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 195796c8dcSSimon Schubert GNU General Public License for more details. 205796c8dcSSimon Schubert 215796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 225796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 235796c8dcSSimon Schubert 245796c8dcSSimon Schubert extern int f_parse (void); 255796c8dcSSimon Schubert 265796c8dcSSimon Schubert extern void f_error (char *); /* Defined in f-exp.y */ 275796c8dcSSimon Schubert 28*cf7f2e2dSJohn Marino extern void f_print_type (struct type *, const char *, struct ui_file *, int, 295796c8dcSSimon Schubert int); 305796c8dcSSimon Schubert 315796c8dcSSimon Schubert extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, 325796c8dcSSimon Schubert struct ui_file *, int, 33*cf7f2e2dSJohn Marino const struct value *, 345796c8dcSSimon Schubert const struct value_print_options *); 355796c8dcSSimon Schubert 365796c8dcSSimon Schubert /* Language-specific data structures */ 375796c8dcSSimon Schubert 385796c8dcSSimon Schubert /* In F90 subrange expression, either bound could be empty, indicating that 395796c8dcSSimon Schubert its value is by default that of the corresponding bound of the array or 405796c8dcSSimon Schubert string. So we have four sorts of subrange in F90. This enumeration type 415796c8dcSSimon Schubert is to identify this. */ 425796c8dcSSimon Schubert 435796c8dcSSimon Schubert enum f90_range_type 445796c8dcSSimon Schubert { 455796c8dcSSimon Schubert BOTH_BOUND_DEFAULT, /* "(:)" */ 465796c8dcSSimon Schubert LOW_BOUND_DEFAULT, /* "(:high)" */ 475796c8dcSSimon Schubert HIGH_BOUND_DEFAULT, /* "(low:)" */ 485796c8dcSSimon Schubert NONE_BOUND_DEFAULT /* "(low:high)" */ 495796c8dcSSimon Schubert }; 505796c8dcSSimon Schubert 515796c8dcSSimon Schubert struct common_entry 525796c8dcSSimon Schubert { 535796c8dcSSimon Schubert struct symbol *symbol; /* The symbol node corresponding 545796c8dcSSimon Schubert to this component */ 555796c8dcSSimon Schubert struct common_entry *next; /* The next component */ 565796c8dcSSimon Schubert }; 575796c8dcSSimon Schubert 585796c8dcSSimon Schubert struct saved_f77_common 595796c8dcSSimon Schubert { 605796c8dcSSimon Schubert char *name; /* Name of COMMON */ 615796c8dcSSimon Schubert char *owning_function; /* Name of parent function */ 625796c8dcSSimon Schubert int secnum; /* Section # of .bss */ 635796c8dcSSimon Schubert CORE_ADDR offset; /* Offset from .bss for 645796c8dcSSimon Schubert this block */ 655796c8dcSSimon Schubert struct common_entry *entries; /* List of block's components */ 665796c8dcSSimon Schubert struct common_entry *end_of_entries; /* ptr. to end of components */ 675796c8dcSSimon Schubert struct saved_f77_common *next; /* Next saved COMMON block */ 685796c8dcSSimon Schubert }; 695796c8dcSSimon Schubert 705796c8dcSSimon Schubert typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR; 715796c8dcSSimon Schubert 725796c8dcSSimon Schubert typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR; 735796c8dcSSimon Schubert 745796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */ 755796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */ 765796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */ 775796c8dcSSimon Schubert 785796c8dcSSimon Schubert extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *); 795796c8dcSSimon Schubert 805796c8dcSSimon Schubert #define UNINITIALIZED_SECNUM -1 815796c8dcSSimon Schubert #define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM) 825796c8dcSSimon Schubert 835796c8dcSSimon Schubert #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */ 845796c8dcSSimon Schubert #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */ 855796c8dcSSimon Schubert #define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */ 865796c8dcSSimon Schubert 875796c8dcSSimon Schubert /* When reasonable array bounds cannot be fetched, such as when 885796c8dcSSimon Schubert you ask to 'mt print symbols' and there is no stack frame and 895796c8dcSSimon Schubert therefore no way of knowing the bounds of stack-based arrays, 905796c8dcSSimon Schubert we have to assign default bounds, these are as good as any... */ 915796c8dcSSimon Schubert 925796c8dcSSimon Schubert #define DEFAULT_UPPER_BOUND 999999 935796c8dcSSimon Schubert #define DEFAULT_LOWER_BOUND -999999 945796c8dcSSimon Schubert 955796c8dcSSimon Schubert extern char *real_main_name; /* Name of main function */ 965796c8dcSSimon Schubert extern int real_main_c_value; /* C_value field of main function */ 975796c8dcSSimon Schubert 985796c8dcSSimon Schubert extern int f77_get_upperbound (struct type *); 995796c8dcSSimon Schubert 1005796c8dcSSimon Schubert extern int f77_get_lowerbound (struct type *); 1015796c8dcSSimon Schubert 1025796c8dcSSimon Schubert extern void f77_get_dynamic_array_length (struct type *); 1035796c8dcSSimon Schubert 1045796c8dcSSimon Schubert extern int calc_f77_array_dims (struct type *); 1055796c8dcSSimon Schubert 1065796c8dcSSimon Schubert 1075796c8dcSSimon Schubert /* Fortran (F77) types */ 1085796c8dcSSimon Schubert 1095796c8dcSSimon Schubert struct builtin_f_type 1105796c8dcSSimon Schubert { 1115796c8dcSSimon Schubert struct type *builtin_character; 1125796c8dcSSimon Schubert struct type *builtin_integer; 1135796c8dcSSimon Schubert struct type *builtin_integer_s2; 1145796c8dcSSimon Schubert struct type *builtin_logical; 1155796c8dcSSimon Schubert struct type *builtin_logical_s1; 1165796c8dcSSimon Schubert struct type *builtin_logical_s2; 117*cf7f2e2dSJohn Marino struct type *builtin_logical_s8; 1185796c8dcSSimon Schubert struct type *builtin_real; 1195796c8dcSSimon Schubert struct type *builtin_real_s8; 1205796c8dcSSimon Schubert struct type *builtin_real_s16; 1215796c8dcSSimon Schubert struct type *builtin_complex_s8; 1225796c8dcSSimon Schubert struct type *builtin_complex_s16; 1235796c8dcSSimon Schubert struct type *builtin_complex_s32; 1245796c8dcSSimon Schubert struct type *builtin_void; 1255796c8dcSSimon Schubert }; 1265796c8dcSSimon Schubert 1275796c8dcSSimon Schubert /* Return the Fortran type table for the specified architecture. */ 1285796c8dcSSimon Schubert extern const struct builtin_f_type *builtin_f_type (struct gdbarch *gdbarch); 1295796c8dcSSimon Schubert 130