GDB (API)
/home/stan/gdb/src/gdb/ada-lang.h
Go to the documentation of this file.
00001 /* Ada language support definitions for GDB, the GNU debugger.
00002 
00003    Copyright (C) 1992-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #if !defined (ADA_LANG_H)
00021 #define ADA_LANG_H 1
00022 
00023 struct frame_info;
00024 struct inferior;
00025 struct type_print_options;
00026 
00027 #include "value.h"
00028 #include "gdbtypes.h"
00029 #include "breakpoint.h"
00030 
00031 /* Names of specific files known to be part of the runtime
00032    system and that might consider (confusing) debugging information.
00033    Each name (a basic regular expression string) is followed by a
00034    comma.  FIXME: Should be part of a configuration file.  */
00035 #if defined(__alpha__) && defined(__osf__)
00036 #define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
00037    "^[agis]-.*\\.ad[bs]$", \
00038    "/usr/shlib/libpthread\\.so",
00039 #elif defined (__linux__)
00040 #define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
00041    "^[agis]-.*\\.ad[bs]$", \
00042    "/lib.*/libpthread\\.so[.0-9]*$", "/lib.*/libpthread\\.a$", \
00043    "/lib.*/libc\\.so[.0-9]*$", "/lib.*/libc\\.a$",
00044 #endif
00045 
00046 #if !defined (ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS)
00047 #define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
00048    "^unwind-seh.c$", \
00049    "^[agis]-.*\\.ad[bs]$",
00050 #endif
00051 
00052 /* Names of compiler-generated auxiliary functions probably of no
00053    interest to users.  Each name (a basic regular expression string)
00054    is followed by a comma.  */
00055 #define ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS \
00056    "___clean[.$a-zA-Z0-9_]*$", \
00057    "___finalizer[.$a-zA-Z0-9_]*$",
00058 
00059 /* The maximum number of frame levels searched for non-local,
00060  * non-global symbols.  This limit exists as a precaution to prevent
00061  * infinite search loops when the stack is screwed up.  */
00062 #define MAX_ENCLOSING_FRAME_LEVELS 7
00063 
00064 /* Maximum number of steps followed in looking for the ultimate
00065    referent of a renaming.  This prevents certain infinite loops that
00066    can otherwise result.  */
00067 #define MAX_RENAMING_CHAIN_LENGTH 10
00068 
00069 struct block;
00070 
00071 /* Corresponding encoded/decoded names and opcodes for Ada user-definable
00072    operators.  */
00073 struct ada_opname_map
00074 {
00075   const char *encoded;
00076   const char *decoded;
00077   enum exp_opcode op;
00078 };
00079 
00080 /* Table of Ada operators in encoded and decoded forms.  */
00081 /* Defined in ada-lang.c */
00082 extern const struct ada_opname_map ada_opname_table[];
00083 
00084 /* A tuple representing one instance of a symbol-lookup operation.  */
00085 
00086 struct ada_symbol_info
00087 {
00088   /* The symbol that was found.  */
00089   struct symbol *sym;
00090 
00091   /* The block where the symbol was found.  */
00092   const struct block *block;
00093 };
00094 
00095 /* Denotes a type of renaming symbol (see ada_parse_renaming).  */
00096 enum ada_renaming_category
00097   {
00098     /* Indicates a symbol that does not encode a renaming.  */
00099     ADA_NOT_RENAMING,
00100 
00101     /* For symbols declared
00102          Foo : TYPE renamed OBJECT;  */
00103     ADA_OBJECT_RENAMING,
00104 
00105     /* For symbols declared
00106          Foo : exception renames EXCEPTION;  */
00107     ADA_EXCEPTION_RENAMING,
00108     /* For packages declared
00109           package Foo renames PACKAGE; */
00110     ADA_PACKAGE_RENAMING,
00111     /* For subprograms declared
00112           SUBPROGRAM_SPEC renames SUBPROGRAM;
00113        (Currently not used).  */
00114     ADA_SUBPROGRAM_RENAMING
00115   };
00116 
00117 /* The different types of catchpoints that we introduced for catching
00118    Ada exceptions.  */
00119 
00120 enum ada_exception_catchpoint_kind
00121 {
00122   ada_catch_exception,
00123   ada_catch_exception_unhandled,
00124   ada_catch_assert
00125 };
00126 
00127 /* Ada task structures.  */
00128 
00129 struct ada_task_info
00130 {
00131   /* The PTID of the thread that this task runs on.  This ptid is computed
00132      in a target-dependent way from the associated Task Control Block.  */
00133   ptid_t ptid;
00134 
00135   /* The ID of the task.  */
00136   CORE_ADDR task_id;
00137 
00138   /* The name of the task.  */
00139   char name[257];
00140 
00141   /* The current state of the task.  */
00142   int state;
00143 
00144   /* The priority associated to the task.  */
00145   int priority;
00146 
00147   /* If non-zero, the task ID of the parent task.  */
00148   CORE_ADDR parent;
00149 
00150   /* If the task is waiting on a task entry, this field contains
00151      the ID of the other task.  Zero otherwise.  */
00152   CORE_ADDR called_task;
00153 
00154   /* If the task is accepting a rendezvous with another task, this field
00155      contains the ID of the calling task.  Zero otherwise.  */
00156   CORE_ADDR caller_task;
00157 };
00158 
00159 /* Assuming V points to an array of S objects,  make sure that it contains at
00160    least M objects, updating V and S as necessary.  */
00161 
00162 #define GROW_VECT(v, s, m)                                    \
00163    if ((s) < (m)) (v) = grow_vect (v, &(s), m, sizeof *(v));
00164 
00165 extern void *grow_vect (void *, size_t *, size_t, int);
00166 
00167 extern int ada_get_field_index (const struct type *type,
00168                                 const char *field_name,
00169                                 int maybe_missing);
00170 
00171 extern int ada_parse (void);    /* Defined in ada-exp.y */
00172 
00173 extern void ada_error (char *); /* Defined in ada-exp.y */
00174 
00175                         /* Defined in ada-typeprint.c */
00176 extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
00177                             int, const struct type_print_options *);
00178 
00179 extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
00180                                struct ui_file *stream);
00181 
00182 extern void ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
00183                            struct ui_file *, int,
00184                            const struct value *,
00185                            const struct value_print_options *);
00186 
00187 extern void ada_value_print (struct value *, struct ui_file *,
00188                              const struct value_print_options *);
00189 
00190                                 /* Defined in ada-lang.c */
00191 
00192 extern void ada_emit_char (int, struct type *, struct ui_file *, int, int);
00193 
00194 extern void ada_printchar (int, struct type *, struct ui_file *);
00195 
00196 extern void ada_printstr (struct ui_file *, struct type *, const gdb_byte *,
00197                           unsigned int, const char *, int,
00198                           const struct value_print_options *);
00199 
00200 struct value *ada_convert_actual (struct value *actual,
00201                                   struct type *formal_type0);
00202 
00203 extern struct value *ada_value_subscript (struct value *, int,
00204                                           struct value **);
00205 
00206 extern void ada_fixup_array_indexes_type (struct type *index_desc_type);
00207 
00208 extern struct type *ada_array_element_type (struct type *, int);
00209 
00210 extern int ada_array_arity (struct type *);
00211 
00212 struct type *ada_type_of_array (struct value *, int);
00213 
00214 extern struct value *ada_coerce_to_simple_array_ptr (struct value *);
00215 
00216 struct value *ada_coerce_to_simple_array (struct value *);
00217 
00218 extern int ada_is_simple_array_type (struct type *);
00219 
00220 extern int ada_is_array_descriptor_type (struct type *);
00221 
00222 extern int ada_is_bogus_array_descriptor (struct type *);
00223 
00224 extern LONGEST ada_discrete_type_low_bound (struct type *);
00225 
00226 extern LONGEST ada_discrete_type_high_bound (struct type *);
00227 
00228 extern struct value *ada_get_decoded_value (struct value *value);
00229 
00230 extern struct type *ada_get_decoded_type (struct type *type);
00231 
00232 extern const char *ada_decode_symbol (const struct general_symbol_info *);
00233 
00234 extern const char *ada_decode (const char*);
00235 
00236 extern enum language ada_update_initial_language (enum language);
00237 
00238 extern void clear_ada_sym_cache (void);
00239 
00240 extern int ada_lookup_symbol_list (const char *, const struct block *,
00241                                    domain_enum, struct ada_symbol_info**);
00242 
00243 extern char *ada_fold_name (const char *);
00244 
00245 extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
00246                                          domain_enum, int *);
00247 
00248 extern void ada_lookup_encoded_symbol
00249   (const char *name, const struct block *block, domain_enum namespace,
00250    struct ada_symbol_info *symbol_info);
00251 
00252 extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
00253 
00254 extern void ada_fill_in_ada_prototype (struct symbol *);
00255 
00256 extern int user_select_syms (struct ada_symbol_info *, int, int);
00257 
00258 extern int get_selections (int *, int, int, int, char *);
00259 
00260 extern int ada_scan_number (const char *, int, LONGEST *, int *);
00261 
00262 extern struct type *ada_parent_type (struct type *);
00263 
00264 extern int ada_is_ignored_field (struct type *, int);
00265 
00266 extern int ada_is_constrained_packed_array_type (struct type *);
00267 
00268 extern struct value *ada_value_primitive_packed_val (struct value *,
00269                                                      const gdb_byte *,
00270                                                      long, int, int,
00271                                                      struct type *);
00272 
00273 extern struct type *ada_coerce_to_simple_array_type (struct type *);
00274 
00275 extern int ada_is_character_type (struct type *);
00276 
00277 extern int ada_is_string_type (struct type *);
00278 
00279 extern int ada_is_tagged_type (struct type *, int);
00280 
00281 extern int ada_is_tag_type (struct type *);
00282 
00283 extern struct type *ada_tag_type (struct value *);
00284 
00285 extern struct value *ada_value_tag (struct value *);
00286 
00287 extern const char *ada_tag_name (struct value *);
00288 
00289 extern struct value *ada_tag_value_at_base_address (struct value *obj);
00290 
00291 extern int ada_is_parent_field (struct type *, int);
00292 
00293 extern int ada_is_wrapper_field (struct type *, int);
00294 
00295 extern int ada_is_variant_part (struct type *, int);
00296 
00297 extern struct type *ada_variant_discrim_type (struct type *, struct type *);
00298 
00299 extern int ada_is_others_clause (struct type *, int);
00300 
00301 extern int ada_in_variant (LONGEST, struct type *, int);
00302 
00303 extern char *ada_variant_discrim_name (struct type *);
00304 
00305 extern struct value *ada_value_struct_elt (struct value *, char *, int);
00306 
00307 extern int ada_is_aligner_type (struct type *);
00308 
00309 extern struct type *ada_aligned_type (struct type *);
00310 
00311 extern const gdb_byte *ada_aligned_value_addr (struct type *,
00312                                                const gdb_byte *);
00313 
00314 extern const char *ada_attribute_name (enum exp_opcode);
00315 
00316 extern int ada_is_fixed_point_type (struct type *);
00317 
00318 extern int ada_is_system_address_type (struct type *);
00319 
00320 extern DOUBLEST ada_delta (struct type *);
00321 
00322 extern DOUBLEST ada_fixed_to_float (struct type *, LONGEST);
00323 
00324 extern LONGEST ada_float_to_fixed (struct type *, DOUBLEST);
00325 
00326 extern struct type *ada_system_address_type (void);
00327 
00328 extern int ada_which_variant_applies (struct type *, struct type *,
00329                                       const gdb_byte *);
00330 
00331 extern struct type *ada_to_fixed_type (struct type *, const gdb_byte *,
00332                                        CORE_ADDR, struct value *,
00333                                        int check_tag);
00334 
00335 extern struct value *ada_to_fixed_value (struct value *val);
00336 
00337 extern struct type *ada_template_to_fixed_record_type_1 (struct type *type,
00338                                                          const gdb_byte *valaddr,
00339                                                          CORE_ADDR address,
00340                                                          struct value *dval0,
00341                                                          int keep_dynamic_fields);
00342 
00343 extern int ada_name_prefix_len (const char *);
00344 
00345 extern const char *ada_type_name (struct type *);
00346 
00347 extern struct type *ada_find_parallel_type (struct type *,
00348                                             const char *suffix);
00349 
00350 extern LONGEST get_int_var_value (char *, int *);
00351 
00352 extern struct symbol *ada_find_renaming_symbol (struct symbol *name_sym,
00353                                                 const struct block *block);
00354 
00355 extern int ada_prefer_type (struct type *, struct type *);
00356 
00357 extern struct type *ada_get_base_type (struct type *);
00358 
00359 extern struct type *ada_check_typedef (struct type *);
00360 
00361 extern char *ada_encode (const char *);
00362 
00363 extern const char *ada_enum_name (const char *);
00364 
00365 extern int ada_is_modular_type (struct type *);
00366 
00367 extern ULONGEST ada_modulus (struct type *);
00368 
00369 extern struct value *ada_value_ind (struct value *);
00370 
00371 extern void ada_print_scalar (struct type *, LONGEST, struct ui_file *);
00372 
00373 extern int ada_is_range_type_name (const char *);
00374 
00375 extern enum ada_renaming_category ada_parse_renaming (struct symbol *,
00376                                                       const char **,
00377                                                       int *, const char **);
00378 
00379 extern void ada_find_printable_frame (struct frame_info *fi);
00380 
00381 extern char *ada_breakpoint_rewrite (char *, int *);
00382 
00383 extern char *ada_main_name (void);
00384 
00385 extern char *ada_name_for_lookup (const char *name);
00386 
00387 extern void create_ada_exception_catchpoint
00388   (struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
00389    char *excep_string, char *cond_string, int tempflag, int disabled,
00390    int from_tty);
00391 
00392 /* Tasking-related: ada-tasks.c */
00393 
00394 extern int valid_task_id (int);
00395 
00396 extern int ada_get_task_number (ptid_t);
00397 
00398 typedef void (ada_task_list_iterator_ftype) (struct ada_task_info *task);
00399 extern void iterate_over_live_ada_tasks
00400   (ada_task_list_iterator_ftype *iterator);
00401 
00402 extern int ada_build_task_list (void);
00403 
00404 extern void print_ada_task_info (struct ui_out *uiout,
00405                                  char *taskno_str,
00406                                  struct inferior *inf);
00407 
00408 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines