GDB (API)
/home/stan/gdb/src/gdb/symtab.h
Go to the documentation of this file.
00001 /* Symbol table definitions for GDB.
00002 
00003    Copyright (C) 1986-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 (SYMTAB_H)
00021 #define SYMTAB_H 1
00022 
00023 #include "vec.h"
00024 #include "gdb_vecs.h"
00025 #include "gdbtypes.h"
00026 
00027 /* Opaque declarations.  */
00028 struct ui_file;
00029 struct frame_info;
00030 struct symbol;
00031 struct obstack;
00032 struct objfile;
00033 struct block;
00034 struct blockvector;
00035 struct axs_value;
00036 struct agent_expr;
00037 struct program_space;
00038 struct language_defn;
00039 struct probe;
00040 struct common_block;
00041 
00042 /* Some of the structures in this file are space critical.
00043    The space-critical structures are:
00044 
00045      struct general_symbol_info
00046      struct symbol
00047      struct partial_symbol
00048 
00049    These structures are laid out to encourage good packing.
00050    They use ENUM_BITFIELD and short int fields, and they order the
00051    structure members so that fields less than a word are next
00052    to each other so they can be packed together.  */
00053 
00054 /* Rearranged: used ENUM_BITFIELD and rearranged field order in
00055    all the space critical structures (plus struct minimal_symbol).
00056    Memory usage dropped from 99360768 bytes to 90001408 bytes.
00057    I measured this with before-and-after tests of
00058    "HEAD-old-gdb -readnow HEAD-old-gdb" and
00059    "HEAD-new-gdb -readnow HEAD-old-gdb" on native i686-pc-linux-gnu,
00060    red hat linux 8, with LD_LIBRARY_PATH=/usr/lib/debug,
00061    typing "maint space 1" at the first command prompt.
00062 
00063    Here is another measurement (from andrew c):
00064      # no /usr/lib/debug, just plain glibc, like a normal user
00065      gdb HEAD-old-gdb
00066      (gdb) break internal_error
00067      (gdb) run
00068      (gdb) maint internal-error
00069      (gdb) backtrace
00070      (gdb) maint space 1
00071 
00072    gdb gdb_6_0_branch  2003-08-19  space used: 8896512
00073    gdb HEAD            2003-08-19  space used: 8904704
00074    gdb HEAD            2003-08-21  space used: 8396800 (+symtab.h)
00075    gdb HEAD            2003-08-21  space used: 8265728 (+gdbtypes.h)
00076 
00077    The third line shows the savings from the optimizations in symtab.h.
00078    The fourth line shows the savings from the optimizations in
00079    gdbtypes.h.  Both optimizations are in gdb HEAD now.
00080 
00081    --chastain 2003-08-21  */
00082 
00083 /* Struct for storing C++ specific information.  Allocated when needed.  */
00084 
00085 struct cplus_specific
00086 {
00087   const char *demangled_name;
00088 };
00089 
00090 /* Define a structure for the information that is common to all symbol types,
00091    including minimal symbols, partial symbols, and full symbols.  In a
00092    multilanguage environment, some language specific information may need to
00093    be recorded along with each symbol.  */
00094 
00095 /* This structure is space critical.  See space comments at the top.  */
00096 
00097 struct general_symbol_info
00098 {
00099   /* Name of the symbol.  This is a required field.  Storage for the
00100      name is allocated on the objfile_obstack for the associated
00101      objfile.  For languages like C++ that make a distinction between
00102      the mangled name and demangled name, this is the mangled
00103      name.  */
00104 
00105   const char *name;
00106 
00107   /* Value of the symbol.  Which member of this union to use, and what
00108      it means, depends on what kind of symbol this is and its
00109      SYMBOL_CLASS.  See comments there for more details.  All of these
00110      are in host byte order (though what they point to might be in
00111      target byte order, e.g. LOC_CONST_BYTES).  */
00112 
00113   union
00114   {
00115     LONGEST ivalue;
00116 
00117     struct block *block;
00118 
00119     const gdb_byte *bytes;
00120 
00121     CORE_ADDR address;
00122 
00123     /* A common block.  Used with LOC_COMMON_BLOCK.  */
00124 
00125     struct common_block *common_block;
00126 
00127     /* For opaque typedef struct chain.  */
00128 
00129     struct symbol *chain;
00130   }
00131   value;
00132 
00133   /* Since one and only one language can apply, wrap the language specific
00134      information inside a union.  */
00135 
00136   union
00137   {
00138     /* A pointer to an obstack that can be used for storage associated
00139        with this symbol.  This is only used by Ada, and only when the
00140        'ada_mangled' field is zero.  */
00141     struct obstack *obstack;
00142 
00143     /* This is used by languages which wish to store a demangled name.
00144        currently used by Ada, Java, and Objective C.  */
00145     struct mangled_lang
00146     {
00147       const char *demangled_name;
00148     }
00149     mangled_lang;
00150 
00151     struct cplus_specific *cplus_specific;
00152   }
00153   language_specific;
00154 
00155   /* Record the source code language that applies to this symbol.
00156      This is used to select one of the fields from the language specific
00157      union above.  */
00158 
00159   ENUM_BITFIELD(language) language : 8;
00160 
00161   /* This is only used by Ada.  If set, then the 'mangled_lang' field
00162      of language_specific is valid.  Otherwise, the 'obstack' field is
00163      valid.  */
00164   unsigned int ada_mangled : 1;
00165 
00166   /* Which section is this symbol in?  This is an index into
00167      section_offsets for this objfile.  Negative means that the symbol
00168      does not get relocated relative to a section.  */
00169 
00170   short section;
00171 };
00172 
00173 extern void symbol_set_demangled_name (struct general_symbol_info *,
00174                                        const char *,
00175                                        struct obstack *);
00176 
00177 extern const char *symbol_get_demangled_name
00178   (const struct general_symbol_info *);
00179 
00180 extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
00181 
00182 /* Note that all the following SYMBOL_* macros are used with the
00183    SYMBOL argument being either a partial symbol, a minimal symbol or
00184    a full symbol.  All three types have a ginfo field.  In particular
00185    the SYMBOL_SET_LANGUAGE, SYMBOL_DEMANGLED_NAME, etc.
00186    macros cannot be entirely substituted by
00187    functions, unless the callers are changed to pass in the ginfo
00188    field only, instead of the SYMBOL parameter.  */
00189 
00190 #define SYMBOL_VALUE(symbol)            (symbol)->ginfo.value.ivalue
00191 #define SYMBOL_VALUE_ADDRESS(symbol)    (symbol)->ginfo.value.address
00192 #define SYMBOL_VALUE_BYTES(symbol)      (symbol)->ginfo.value.bytes
00193 #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->ginfo.value.common_block
00194 #define SYMBOL_BLOCK_VALUE(symbol)      (symbol)->ginfo.value.block
00195 #define SYMBOL_VALUE_CHAIN(symbol)      (symbol)->ginfo.value.chain
00196 #define SYMBOL_LANGUAGE(symbol)         (symbol)->ginfo.language
00197 #define SYMBOL_SECTION(symbol)          (symbol)->ginfo.section
00198 #define SYMBOL_OBJ_SECTION(objfile, symbol)                     \
00199   (((symbol)->ginfo.section >= 0)                               \
00200    ? (&(((objfile)->sections)[(symbol)->ginfo.section]))        \
00201    : NULL)
00202 
00203 /* Initializes the language dependent portion of a symbol
00204    depending upon the language for the symbol.  */
00205 #define SYMBOL_SET_LANGUAGE(symbol,language,obstack)    \
00206   (symbol_set_language (&(symbol)->ginfo, (language), (obstack)))
00207 extern void symbol_set_language (struct general_symbol_info *symbol,
00208                                  enum language language,
00209                                  struct obstack *obstack);
00210 
00211 /* Set just the linkage name of a symbol; do not try to demangle
00212    it.  Used for constructs which do not have a mangled name,
00213    e.g. struct tags.  Unlike SYMBOL_SET_NAMES, linkage_name must
00214    be terminated and either already on the objfile's obstack or
00215    permanently allocated.  */
00216 #define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
00217   (symbol)->ginfo.name = (linkage_name)
00218 
00219 /* Set the linkage and natural names of a symbol, by demangling
00220    the linkage name.  */
00221 #define SYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile)     \
00222   symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, objfile)
00223 extern void symbol_set_names (struct general_symbol_info *symbol,
00224                               const char *linkage_name, int len, int copy_name,
00225                               struct objfile *objfile);
00226 
00227 /* Now come lots of name accessor macros.  Short version as to when to
00228    use which: Use SYMBOL_NATURAL_NAME to refer to the name of the
00229    symbol in the original source code.  Use SYMBOL_LINKAGE_NAME if you
00230    want to know what the linker thinks the symbol's name is.  Use
00231    SYMBOL_PRINT_NAME for output.  Use SYMBOL_DEMANGLED_NAME if you
00232    specifically need to know whether SYMBOL_NATURAL_NAME and
00233    SYMBOL_LINKAGE_NAME are different.  */
00234 
00235 /* Return SYMBOL's "natural" name, i.e. the name that it was called in
00236    the original source code.  In languages like C++ where symbols may
00237    be mangled for ease of manipulation by the linker, this is the
00238    demangled name.  */
00239 
00240 #define SYMBOL_NATURAL_NAME(symbol) \
00241   (symbol_natural_name (&(symbol)->ginfo))
00242 extern const char *symbol_natural_name
00243   (const struct general_symbol_info *symbol);
00244 
00245 /* Return SYMBOL's name from the point of view of the linker.  In
00246    languages like C++ where symbols may be mangled for ease of
00247    manipulation by the linker, this is the mangled name; otherwise,
00248    it's the same as SYMBOL_NATURAL_NAME.  */
00249 
00250 #define SYMBOL_LINKAGE_NAME(symbol)     (symbol)->ginfo.name
00251 
00252 /* Return the demangled name for a symbol based on the language for
00253    that symbol.  If no demangled name exists, return NULL.  */
00254 #define SYMBOL_DEMANGLED_NAME(symbol) \
00255   (symbol_demangled_name (&(symbol)->ginfo))
00256 extern const char *symbol_demangled_name
00257   (const struct general_symbol_info *symbol);
00258 
00259 /* Macro that returns a version of the name of a symbol that is
00260    suitable for output.  In C++ this is the "demangled" form of the
00261    name if demangle is on and the "mangled" form of the name if
00262    demangle is off.  In other languages this is just the symbol name.
00263    The result should never be NULL.  Don't use this for internal
00264    purposes (e.g. storing in a hashtable): it's only suitable for output.
00265 
00266    N.B. symbol may be anything with a ginfo member,
00267    e.g., struct symbol or struct minimal_symbol.  */
00268 
00269 #define SYMBOL_PRINT_NAME(symbol)                                       \
00270   (demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol))
00271 extern int demangle;
00272 
00273 /* Macro that returns the name to be used when sorting and searching symbols.
00274    In  C++, Chill, and Java, we search for the demangled form of a name,
00275    and so sort symbols accordingly.  In Ada, however, we search by mangled
00276    name.  If there is no distinct demangled name, then SYMBOL_SEARCH_NAME
00277    returns the same value (same pointer) as SYMBOL_LINKAGE_NAME.  */
00278 #define SYMBOL_SEARCH_NAME(symbol)                                       \
00279    (symbol_search_name (&(symbol)->ginfo))
00280 extern const char *symbol_search_name (const struct general_symbol_info *);
00281 
00282 /* Return non-zero if NAME matches the "search" name of SYMBOL.
00283    Whitespace and trailing parentheses are ignored.
00284    See strcmp_iw for details about its behavior.  */
00285 #define SYMBOL_MATCHES_SEARCH_NAME(symbol, name)                        \
00286   (strcmp_iw (SYMBOL_SEARCH_NAME (symbol), (name)) == 0)
00287 
00288 /* Classification types for a minimal symbol.  These should be taken as
00289    "advisory only", since if gdb can't easily figure out a
00290    classification it simply selects mst_unknown.  It may also have to
00291    guess when it can't figure out which is a better match between two
00292    types (mst_data versus mst_bss) for example.  Since the minimal
00293    symbol info is sometimes derived from the BFD library's view of a
00294    file, we need to live with what information bfd supplies.  */
00295 
00296 enum minimal_symbol_type
00297 {
00298   mst_unknown = 0,              /* Unknown type, the default */
00299   mst_text,                     /* Generally executable instructions */
00300   mst_text_gnu_ifunc,           /* Executable code returning address
00301                                    of executable code */
00302   mst_slot_got_plt,             /* GOT entries for .plt sections */
00303   mst_data,                     /* Generally initialized data */
00304   mst_bss,                      /* Generally uninitialized data */
00305   mst_abs,                      /* Generally absolute (nonrelocatable) */
00306   /* GDB uses mst_solib_trampoline for the start address of a shared
00307      library trampoline entry.  Breakpoints for shared library functions
00308      are put there if the shared library is not yet loaded.
00309      After the shared library is loaded, lookup_minimal_symbol will
00310      prefer the minimal symbol from the shared library (usually
00311      a mst_text symbol) over the mst_solib_trampoline symbol, and the
00312      breakpoints will be moved to their true address in the shared
00313      library via breakpoint_re_set.  */
00314   mst_solib_trampoline,         /* Shared library trampoline code */
00315   /* For the mst_file* types, the names are only guaranteed to be unique
00316      within a given .o file.  */
00317   mst_file_text,                /* Static version of mst_text */
00318   mst_file_data,                /* Static version of mst_data */
00319   mst_file_bss                  /* Static version of mst_bss */
00320 };
00321 
00322 /* Define a simple structure used to hold some very basic information about
00323    all defined global symbols (text, data, bss, abs, etc).  The only required
00324    information is the general_symbol_info.
00325 
00326    In many cases, even if a file was compiled with no special options for
00327    debugging at all, as long as was not stripped it will contain sufficient
00328    information to build a useful minimal symbol table using this structure.
00329    Even when a file contains enough debugging information to build a full
00330    symbol table, these minimal symbols are still useful for quickly mapping
00331    between names and addresses, and vice versa.  They are also sometimes
00332    used to figure out what full symbol table entries need to be read in.  */
00333 
00334 struct minimal_symbol
00335 {
00336 
00337   /* The general symbol info required for all types of symbols.
00338 
00339      The SYMBOL_VALUE_ADDRESS contains the address that this symbol
00340      corresponds to.  */
00341 
00342   struct general_symbol_info ginfo;
00343 
00344   /* Size of this symbol.  end_psymtab in dbxread.c uses this
00345      information to calculate the end of the partial symtab based on the
00346      address of the last symbol plus the size of the last symbol.  */
00347 
00348   unsigned long size;
00349 
00350   /* Which source file is this symbol in?  Only relevant for mst_file_*.  */
00351   const char *filename;
00352 
00353   /* Classification type for this minimal symbol.  */
00354 
00355   ENUM_BITFIELD(minimal_symbol_type) type : 8;
00356 
00357   /* Non-zero if this symbol was created by gdb.
00358      Such symbols do not appear in the output of "info var|fun".  */
00359   unsigned int created_by_gdb : 1;
00360 
00361   /* Two flag bits provided for the use of the target.  */
00362   unsigned int target_flag_1 : 1;
00363   unsigned int target_flag_2 : 1;
00364 
00365   /* Nonzero iff the size of the minimal symbol has been set.
00366      Symbol size information can sometimes not be determined, because
00367      the object file format may not carry that piece of information.  */
00368   unsigned int has_size : 1;
00369 
00370   /* Minimal symbols with the same hash key are kept on a linked
00371      list.  This is the link.  */
00372 
00373   struct minimal_symbol *hash_next;
00374 
00375   /* Minimal symbols are stored in two different hash tables.  This is
00376      the `next' pointer for the demangled hash table.  */
00377 
00378   struct minimal_symbol *demangled_hash_next;
00379 };
00380 
00381 #define MSYMBOL_TARGET_FLAG_1(msymbol)  (msymbol)->target_flag_1
00382 #define MSYMBOL_TARGET_FLAG_2(msymbol)  (msymbol)->target_flag_2
00383 #define MSYMBOL_SIZE(msymbol)           ((msymbol)->size + 0)
00384 #define SET_MSYMBOL_SIZE(msymbol, sz)           \
00385   do                                            \
00386     {                                           \
00387       (msymbol)->size = sz;                     \
00388       (msymbol)->has_size = 1;                  \
00389     } while (0)
00390 #define MSYMBOL_HAS_SIZE(msymbol)       ((msymbol)->has_size + 0)
00391 #define MSYMBOL_TYPE(msymbol)           (msymbol)->type
00392 
00393 #include "minsyms.h"
00394 
00395 
00396 
00397 /* Represent one symbol name; a variable, constant, function or typedef.  */
00398 
00399 /* Different name domains for symbols.  Looking up a symbol specifies a
00400    domain and ignores symbol definitions in other name domains.  */
00401 
00402 typedef enum domain_enum_tag
00403 {
00404   /* UNDEF_DOMAIN is used when a domain has not been discovered or
00405      none of the following apply.  This usually indicates an error either
00406      in the symbol information or in gdb's handling of symbols.  */
00407 
00408   UNDEF_DOMAIN,
00409 
00410   /* VAR_DOMAIN is the usual domain.  In C, this contains variables,
00411      function names, typedef names and enum type values.  */
00412 
00413   VAR_DOMAIN,
00414 
00415   /* STRUCT_DOMAIN is used in C to hold struct, union and enum type names.
00416      Thus, if `struct foo' is used in a C program, it produces a symbol named
00417      `foo' in the STRUCT_DOMAIN.  */
00418 
00419   STRUCT_DOMAIN,
00420 
00421   /* LABEL_DOMAIN may be used for names of labels (for gotos).  */
00422 
00423   LABEL_DOMAIN,
00424 
00425   /* Fortran common blocks.  Their naming must be separate from VAR_DOMAIN.
00426      They also always use LOC_COMMON_BLOCK.  */
00427   COMMON_BLOCK_DOMAIN
00428 } domain_enum;
00429 
00430 extern const char *domain_name (domain_enum);
00431 
00432 /* Searching domains, used for `search_symbols'.  Element numbers are
00433    hardcoded in GDB, check all enum uses before changing it.  */
00434 
00435 enum search_domain
00436 {
00437   /* Everything in VAR_DOMAIN minus FUNCTIONS_DOMAIN and
00438      TYPES_DOMAIN.  */
00439   VARIABLES_DOMAIN = 0,
00440 
00441   /* All functions -- for some reason not methods, though.  */
00442   FUNCTIONS_DOMAIN = 1,
00443 
00444   /* All defined types */
00445   TYPES_DOMAIN = 2,
00446 
00447   /* Any type.  */
00448   ALL_DOMAIN = 3
00449 };
00450 
00451 extern const char *search_domain_name (enum search_domain);
00452 
00453 /* An address-class says where to find the value of a symbol.  */
00454 
00455 enum address_class
00456 {
00457   /* Not used; catches errors.  */
00458 
00459   LOC_UNDEF,
00460 
00461   /* Value is constant int SYMBOL_VALUE, host byteorder.  */
00462 
00463   LOC_CONST,
00464 
00465   /* Value is at fixed address SYMBOL_VALUE_ADDRESS.  */
00466 
00467   LOC_STATIC,
00468 
00469   /* Value is in register.  SYMBOL_VALUE is the register number
00470      in the original debug format.  SYMBOL_REGISTER_OPS holds a
00471      function that can be called to transform this into the
00472      actual register number this represents in a specific target
00473      architecture (gdbarch).
00474 
00475      For some symbol formats (stabs, for some compilers at least),
00476      the compiler generates two symbols, an argument and a register.
00477      In some cases we combine them to a single LOC_REGISTER in symbol
00478      reading, but currently not for all cases (e.g. it's passed on the
00479      stack and then loaded into a register).  */
00480 
00481   LOC_REGISTER,
00482 
00483   /* It's an argument; the value is at SYMBOL_VALUE offset in arglist.  */
00484 
00485   LOC_ARG,
00486 
00487   /* Value address is at SYMBOL_VALUE offset in arglist.  */
00488 
00489   LOC_REF_ARG,
00490 
00491   /* Value is in specified register.  Just like LOC_REGISTER except the
00492      register holds the address of the argument instead of the argument
00493      itself.  This is currently used for the passing of structs and unions
00494      on sparc and hppa.  It is also used for call by reference where the
00495      address is in a register, at least by mipsread.c.  */
00496 
00497   LOC_REGPARM_ADDR,
00498 
00499   /* Value is a local variable at SYMBOL_VALUE offset in stack frame.  */
00500 
00501   LOC_LOCAL,
00502 
00503   /* Value not used; definition in SYMBOL_TYPE.  Symbols in the domain
00504      STRUCT_DOMAIN all have this class.  */
00505 
00506   LOC_TYPEDEF,
00507 
00508   /* Value is address SYMBOL_VALUE_ADDRESS in the code.  */
00509 
00510   LOC_LABEL,
00511 
00512   /* In a symbol table, value is SYMBOL_BLOCK_VALUE of a `struct block'.
00513      In a partial symbol table, SYMBOL_VALUE_ADDRESS is the start address
00514      of the block.  Function names have this class.  */
00515 
00516   LOC_BLOCK,
00517 
00518   /* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_BYTES, in
00519      target byte order.  */
00520 
00521   LOC_CONST_BYTES,
00522 
00523   /* Value is at fixed address, but the address of the variable has
00524      to be determined from the minimal symbol table whenever the
00525      variable is referenced.
00526      This happens if debugging information for a global symbol is
00527      emitted and the corresponding minimal symbol is defined
00528      in another object file or runtime common storage.
00529      The linker might even remove the minimal symbol if the global
00530      symbol is never referenced, in which case the symbol remains
00531      unresolved.
00532      
00533      GDB would normally find the symbol in the minimal symbol table if it will
00534      not find it in the full symbol table.  But a reference to an external
00535      symbol in a local block shadowing other definition requires full symbol
00536      without possibly having its address available for LOC_STATIC.  Testcase
00537      is provided as `gdb.dwarf2/dw2-unresolved.exp'.  */
00538 
00539   LOC_UNRESOLVED,
00540 
00541   /* The variable does not actually exist in the program.
00542      The value is ignored.  */
00543 
00544   LOC_OPTIMIZED_OUT,
00545 
00546   /* The variable's address is computed by a set of location
00547      functions (see "struct symbol_computed_ops" below).  */
00548   LOC_COMPUTED,
00549 
00550   /* The variable uses general_symbol_info->value->common_block field.
00551      It also always uses COMMON_BLOCK_DOMAIN.  */
00552   LOC_COMMON_BLOCK,
00553 
00554   /* Not used, just notes the boundary of the enum.  */
00555   LOC_FINAL_VALUE
00556 };
00557 
00558 /* The methods needed to implement LOC_COMPUTED.  These methods can
00559    use the symbol's .aux_value for additional per-symbol information.
00560 
00561    At present this is only used to implement location expressions.  */
00562 
00563 struct symbol_computed_ops
00564 {
00565 
00566   /* Return the value of the variable SYMBOL, relative to the stack
00567      frame FRAME.  If the variable has been optimized out, return
00568      zero.
00569 
00570      Iff `read_needs_frame (SYMBOL)' is zero, then FRAME may be zero.  */
00571 
00572   struct value *(*read_variable) (struct symbol * symbol,
00573                                   struct frame_info * frame);
00574 
00575   /* Read variable SYMBOL like read_variable at (callee) FRAME's function
00576      entry.  SYMBOL should be a function parameter, otherwise
00577      NO_ENTRY_VALUE_ERROR will be thrown.  */
00578   struct value *(*read_variable_at_entry) (struct symbol *symbol,
00579                                            struct frame_info *frame);
00580 
00581   /* Return non-zero if we need a frame to find the value of the SYMBOL.  */
00582   int (*read_needs_frame) (struct symbol * symbol);
00583 
00584   /* Write to STREAM a natural-language description of the location of
00585      SYMBOL, in the context of ADDR.  */
00586   void (*describe_location) (struct symbol * symbol, CORE_ADDR addr,
00587                              struct ui_file * stream);
00588 
00589   /* Non-zero if this symbol's address computation is dependent on PC.  */
00590   unsigned char location_has_loclist;
00591 
00592   /* Tracepoint support.  Append bytecodes to the tracepoint agent
00593      expression AX that push the address of the object SYMBOL.  Set
00594      VALUE appropriately.  Note --- for objects in registers, this
00595      needn't emit any code; as long as it sets VALUE properly, then
00596      the caller will generate the right code in the process of
00597      treating this as an lvalue or rvalue.  */
00598 
00599   void (*tracepoint_var_ref) (struct symbol *symbol, struct gdbarch *gdbarch,
00600                               struct agent_expr *ax, struct axs_value *value);
00601 };
00602 
00603 /* The methods needed to implement LOC_BLOCK for inferior functions.
00604    These methods can use the symbol's .aux_value for additional
00605    per-symbol information.  */
00606 
00607 struct symbol_block_ops
00608 {
00609   /* Fill in *START and *LENGTH with DWARF block data of function
00610      FRAMEFUNC valid for inferior context address PC.  Set *LENGTH to
00611      zero if such location is not valid for PC; *START is left
00612      uninitialized in such case.  */
00613   void (*find_frame_base_location) (struct symbol *framefunc, CORE_ADDR pc,
00614                                     const gdb_byte **start, size_t *length);
00615 };
00616 
00617 /* Functions used with LOC_REGISTER and LOC_REGPARM_ADDR.  */
00618 
00619 struct symbol_register_ops
00620 {
00621   int (*register_number) (struct symbol *symbol, struct gdbarch *gdbarch);
00622 };
00623 
00624 /* Objects of this type are used to find the address class and the
00625    various computed ops vectors of a symbol.  */
00626 
00627 struct symbol_impl
00628 {
00629   enum address_class aclass;
00630 
00631   /* Used with LOC_COMPUTED.  */
00632   const struct symbol_computed_ops *ops_computed;
00633 
00634   /* Used with LOC_BLOCK.  */
00635   const struct symbol_block_ops *ops_block;
00636 
00637   /* Used with LOC_REGISTER and LOC_REGPARM_ADDR.  */
00638   const struct symbol_register_ops *ops_register;
00639 };
00640 
00641 /* The number of bits we reserve in a symbol for the aclass index.
00642    This is a #define so that we can have a assertion elsewhere to
00643    verify that we have reserved enough space for synthetic address
00644    classes.  */
00645 
00646 #define SYMBOL_ACLASS_BITS 6
00647 
00648 /* This structure is space critical.  See space comments at the top.  */
00649 
00650 struct symbol
00651 {
00652 
00653   /* The general symbol info required for all types of symbols.  */
00654 
00655   struct general_symbol_info ginfo;
00656 
00657   /* Data type of value */
00658 
00659   struct type *type;
00660 
00661   /* The symbol table containing this symbol.  This is the file
00662      associated with LINE.  It can be NULL during symbols read-in but it is
00663      never NULL during normal operation.  */
00664   struct symtab *symtab;
00665 
00666   /* Domain code.  */
00667 
00668   ENUM_BITFIELD(domain_enum_tag) domain : 6;
00669 
00670   /* Address class.  This holds an index into the 'symbol_impls'
00671      table.  The actual enum address_class value is stored there,
00672      alongside any per-class ops vectors.  */
00673 
00674   unsigned int aclass_index : SYMBOL_ACLASS_BITS;
00675 
00676   /* Whether this is an argument.  */
00677 
00678   unsigned is_argument : 1;
00679 
00680   /* Whether this is an inlined function (class LOC_BLOCK only).  */
00681   unsigned is_inlined : 1;
00682 
00683   /* True if this is a C++ function symbol with template arguments.
00684      In this case the symbol is really a "struct template_symbol".  */
00685   unsigned is_cplus_template_function : 1;
00686 
00687   /* Line number of this symbol's definition, except for inlined
00688      functions.  For an inlined function (class LOC_BLOCK and
00689      SYMBOL_INLINED set) this is the line number of the function's call
00690      site.  Inlined function symbols are not definitions, and they are
00691      never found by symbol table lookup.
00692 
00693      FIXME: Should we really make the assumption that nobody will try
00694      to debug files longer than 64K lines?  What about machine
00695      generated programs?  */
00696 
00697   unsigned short line;
00698 
00699   /* An arbitrary data pointer, allowing symbol readers to record
00700      additional information on a per-symbol basis.  Note that this data
00701      must be allocated using the same obstack as the symbol itself.  */
00702   /* So far it is only used by LOC_COMPUTED to
00703      find the location information.  For a LOC_BLOCK symbol
00704      for a function in a compilation unit compiled with DWARF 2
00705      information, this is information used internally by the DWARF 2
00706      code --- specifically, the location expression for the frame
00707      base for this function.  */
00708   /* FIXME drow/2003-02-21: For the LOC_BLOCK case, it might be better
00709      to add a magic symbol to the block containing this information,
00710      or to have a generic debug info annotation slot for symbols.  */
00711 
00712   void *aux_value;
00713 
00714   struct symbol *hash_next;
00715 };
00716 
00717 extern const struct symbol_impl *symbol_impls;
00718 
00719 #define SYMBOL_DOMAIN(symbol)   (symbol)->domain
00720 #define SYMBOL_IMPL(symbol)             (symbol_impls[(symbol)->aclass_index])
00721 #define SYMBOL_ACLASS_INDEX(symbol)     (symbol)->aclass_index
00722 #define SYMBOL_CLASS(symbol)            (SYMBOL_IMPL (symbol).aclass)
00723 #define SYMBOL_IS_ARGUMENT(symbol)      (symbol)->is_argument
00724 #define SYMBOL_INLINED(symbol)          (symbol)->is_inlined
00725 #define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \
00726   (symbol)->is_cplus_template_function
00727 #define SYMBOL_TYPE(symbol)             (symbol)->type
00728 #define SYMBOL_LINE(symbol)             (symbol)->line
00729 #define SYMBOL_SYMTAB(symbol)           (symbol)->symtab
00730 #define SYMBOL_COMPUTED_OPS(symbol)     (SYMBOL_IMPL (symbol).ops_computed)
00731 #define SYMBOL_BLOCK_OPS(symbol)        (SYMBOL_IMPL (symbol).ops_block)
00732 #define SYMBOL_REGISTER_OPS(symbol)     (SYMBOL_IMPL (symbol).ops_register)
00733 #define SYMBOL_LOCATION_BATON(symbol)   (symbol)->aux_value
00734 #define SYMBOL_OBJFILE(symbol)          (SYMBOL_SYMTAB (symbol)->objfile)
00735 
00736 extern int register_symbol_computed_impl (enum address_class,
00737                                           const struct symbol_computed_ops *);
00738 
00739 extern int register_symbol_block_impl (enum address_class aclass,
00740                                        const struct symbol_block_ops *ops);
00741 
00742 extern int register_symbol_register_impl (enum address_class,
00743                                           const struct symbol_register_ops *);
00744 
00745 /* An instance of this type is used to represent a C++ template
00746    function.  It includes a "struct symbol" as a kind of base class;
00747    users downcast to "struct template_symbol *" when needed.  A symbol
00748    is really of this type iff SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is
00749    true.  */
00750 
00751 struct template_symbol
00752 {
00753   /* The base class.  */
00754   struct symbol base;
00755 
00756   /* The number of template arguments.  */
00757   int n_template_arguments;
00758 
00759   /* The template arguments.  This is an array with
00760      N_TEMPLATE_ARGUMENTS elements.  */
00761   struct symbol **template_arguments;
00762 };
00763 
00764 
00765 /* Each item represents a line-->pc (or the reverse) mapping.  This is
00766    somewhat more wasteful of space than one might wish, but since only
00767    the files which are actually debugged are read in to core, we don't
00768    waste much space.  */
00769 
00770 struct linetable_entry
00771 {
00772   int line;
00773   CORE_ADDR pc;
00774 };
00775 
00776 /* The order of entries in the linetable is significant.  They should
00777    be sorted by increasing values of the pc field.  If there is more than
00778    one entry for a given pc, then I'm not sure what should happen (and
00779    I not sure whether we currently handle it the best way).
00780 
00781    Example: a C for statement generally looks like this
00782 
00783    10   0x100   - for the init/test part of a for stmt.
00784    20   0x200
00785    30   0x300
00786    10   0x400   - for the increment part of a for stmt.
00787 
00788    If an entry has a line number of zero, it marks the start of a PC
00789    range for which no line number information is available.  It is
00790    acceptable, though wasteful of table space, for such a range to be
00791    zero length.  */
00792 
00793 struct linetable
00794 {
00795   int nitems;
00796 
00797   /* Actually NITEMS elements.  If you don't like this use of the
00798      `struct hack', you can shove it up your ANSI (seriously, if the
00799      committee tells us how to do it, we can probably go along).  */
00800   struct linetable_entry item[1];
00801 };
00802 
00803 /* How to relocate the symbols from each section in a symbol file.
00804    Each struct contains an array of offsets.
00805    The ordering and meaning of the offsets is file-type-dependent;
00806    typically it is indexed by section numbers or symbol types or
00807    something like that.
00808 
00809    To give us flexibility in changing the internal representation
00810    of these offsets, the ANOFFSET macro must be used to insert and
00811    extract offset values in the struct.  */
00812 
00813 struct section_offsets
00814 {
00815   CORE_ADDR offsets[1];         /* As many as needed.  */
00816 };
00817 
00818 #define ANOFFSET(secoff, whichone) \
00819   ((whichone == -1)                       \
00820    ? (internal_error (__FILE__, __LINE__, \
00821                       _("Section index is uninitialized")), -1) \
00822    : secoff->offsets[whichone])
00823 
00824 /* The size of a section_offsets table for N sections.  */
00825 #define SIZEOF_N_SECTION_OFFSETS(n) \
00826   (sizeof (struct section_offsets) \
00827    + sizeof (((struct section_offsets *) 0)->offsets) * ((n)-1))
00828 
00829 /* Each source file or header is represented by a struct symtab.
00830    These objects are chained through the `next' field.  */
00831 
00832 struct symtab
00833 {
00834   /* Unordered chain of all existing symtabs of this objfile.  */
00835 
00836   struct symtab *next;
00837 
00838   /* List of all symbol scope blocks for this symtab.  May be shared
00839      between different symtabs (and normally is for all the symtabs
00840      in a given compilation unit).  */
00841 
00842   struct blockvector *blockvector;
00843 
00844   /* Table mapping core addresses to line numbers for this file.
00845      Can be NULL if none.  Never shared between different symtabs.  */
00846 
00847   struct linetable *linetable;
00848 
00849   /* Section in objfile->section_offsets for the blockvector and
00850      the linetable.  Probably always SECT_OFF_TEXT.  */
00851 
00852   int block_line_section;
00853 
00854   /* If several symtabs share a blockvector, exactly one of them
00855      should be designated the primary, so that the blockvector
00856      is relocated exactly once by objfile_relocate.  */
00857 
00858   unsigned int primary : 1;
00859 
00860   /* Symtab has been compiled with both optimizations and debug info so that
00861      GDB may stop skipping prologues as variables locations are valid already
00862      at function entry points.  */
00863 
00864   unsigned int locations_valid : 1;
00865 
00866   /* DWARF unwinder for this CU is valid even for epilogues (PC at the return
00867      instruction).  This is supported by GCC since 4.5.0.  */
00868 
00869   unsigned int epilogue_unwind_valid : 1;
00870 
00871   /* The macro table for this symtab.  Like the blockvector, this
00872      may be shared between different symtabs --- and normally is for
00873      all the symtabs in a given compilation unit.  */
00874   struct macro_table *macro_table;
00875 
00876   /* Name of this source file.  This pointer is never NULL.  */
00877 
00878   char *filename;
00879 
00880   /* Directory in which it was compiled, or NULL if we don't know.  */
00881 
00882   char *dirname;
00883 
00884   /* Total number of lines found in source file.  */
00885 
00886   int nlines;
00887 
00888   /* line_charpos[N] is the position of the (N-1)th line of the
00889      source file.  "position" means something we can lseek() to; it
00890      is not guaranteed to be useful any other way.  */
00891 
00892   int *line_charpos;
00893 
00894   /* Language of this source file.  */
00895 
00896   enum language language;
00897 
00898   /* String that identifies the format of the debugging information, such
00899      as "stabs", "dwarf 1", "dwarf 2", "coff", etc.  This is mostly useful
00900      for automated testing of gdb but may also be information that is
00901      useful to the user.  */
00902 
00903   const char *debugformat;
00904 
00905   /* String of producer version information.  May be zero.  */
00906 
00907   const char *producer;
00908 
00909   /* Full name of file as found by searching the source path.
00910      NULL if not yet known.  */
00911 
00912   char *fullname;
00913 
00914   /* Object file from which this symbol information was read.  */
00915 
00916   struct objfile *objfile;
00917 
00918   /* struct call_site entries for this compilation unit or NULL.  */
00919 
00920   htab_t call_site_htab;
00921 
00922   /* If non-NULL, then this points to a NULL-terminated vector of
00923      included symbol tables.  When searching the static or global
00924      block of this symbol table, the corresponding block of all
00925      included symbol tables will also be searched.  Note that this
00926      list must be flattened -- the symbol reader is responsible for
00927      ensuring that this vector contains the transitive closure of all
00928      included symbol tables.  */
00929 
00930   struct symtab **includes;
00931 
00932   /* If this is an included symbol table, this points to one includer
00933      of the table.  This user is considered the canonical symbol table
00934      containing this one.  An included symbol table may itself be
00935      included by another.  */
00936 
00937   struct symtab *user;
00938 };
00939 
00940 #define BLOCKVECTOR(symtab)     (symtab)->blockvector
00941 #define LINETABLE(symtab)       (symtab)->linetable
00942 #define SYMTAB_PSPACE(symtab)   (symtab)->objfile->pspace
00943 
00944 typedef struct symtab *symtab_ptr;
00945 DEF_VEC_P (symtab_ptr);
00946 
00947 
00948 
00949 /* The virtual function table is now an array of structures which have the
00950    form { int16 offset, delta; void *pfn; }. 
00951 
00952    In normal virtual function tables, OFFSET is unused.
00953    DELTA is the amount which is added to the apparent object's base
00954    address in order to point to the actual object to which the
00955    virtual function should be applied.
00956    PFN is a pointer to the virtual function.
00957 
00958    Note that this macro is g++ specific (FIXME).  */
00959 
00960 #define VTBL_FNADDR_OFFSET 2
00961 
00962 /* External variables and functions for the objects described above.  */
00963 
00964 /* True if we are nested inside psymtab_to_symtab.  */
00965 
00966 extern int currently_reading_symtab;
00967 
00968 /* symtab.c lookup functions */
00969 
00970 extern const char multiple_symbols_ask[];
00971 extern const char multiple_symbols_all[];
00972 extern const char multiple_symbols_cancel[];
00973 
00974 const char *multiple_symbols_select_mode (void);
00975 
00976 int symbol_matches_domain (enum language symbol_language, 
00977                            domain_enum symbol_domain,
00978                            domain_enum domain);
00979 
00980 /* lookup a symbol table by source file name.  */
00981 
00982 extern struct symtab *lookup_symtab (const char *);
00983 
00984 /* An object of this type is passed as the 'is_a_field_of_this'
00985    argument to lookup_symbol and lookup_symbol_in_language.  */
00986 
00987 struct field_of_this_result
00988 {
00989   /* The type in which the field was found.  If this is NULL then the
00990      symbol was not found in 'this'.  If non-NULL, then one of the
00991      other fields will be non-NULL as well.  */
00992 
00993   struct type *type;
00994 
00995   /* If the symbol was found as an ordinary field of 'this', then this
00996      is non-NULL and points to the particular field.  */
00997 
00998   struct field *field;
00999 
01000   /* If the symbol was found as an function field of 'this', then this
01001      is non-NULL and points to the particular field.  */
01002 
01003   struct fn_fieldlist *fn_field;
01004 };
01005 
01006 /* lookup a symbol by name (optional block) in language.  */
01007 
01008 extern struct symbol *lookup_symbol_in_language (const char *,
01009                                                  const struct block *,
01010                                                  const domain_enum,
01011                                                  enum language,
01012                                                  struct field_of_this_result *);
01013 
01014 /* lookup a symbol by name (optional block, optional symtab)
01015    in the current language.  */
01016 
01017 extern struct symbol *lookup_symbol (const char *, const struct block *,
01018                                      const domain_enum,
01019                                      struct field_of_this_result *);
01020 
01021 /* A default version of lookup_symbol_nonlocal for use by languages
01022    that can't think of anything better to do.  */
01023 
01024 extern struct symbol *basic_lookup_symbol_nonlocal (const char *,
01025                                                     const struct block *,
01026                                                     const domain_enum);
01027 
01028 /* Some helper functions for languages that need to write their own
01029    lookup_symbol_nonlocal functions.  */
01030 
01031 /* Lookup a symbol in the static block associated to BLOCK, if there
01032    is one; do nothing if BLOCK is NULL or a global block.  */
01033 
01034 extern struct symbol *lookup_symbol_static (const char *name,
01035                                             const struct block *block,
01036                                             const domain_enum domain);
01037 
01038 /* Lookup a symbol in all files' global blocks (searching psymtabs if
01039    necessary).  */
01040 
01041 extern struct symbol *lookup_symbol_global (const char *name,
01042                                             const struct block *block,
01043                                             const domain_enum domain);
01044 
01045 /* Lookup a symbol within the block BLOCK.  This, unlike
01046    lookup_symbol_block, will set SYMTAB and BLOCK_FOUND correctly, and
01047    will fix up the symbol if necessary.  */
01048 
01049 extern struct symbol *lookup_symbol_aux_block (const char *name,
01050                                                const struct block *block,
01051                                                const domain_enum domain);
01052 
01053 extern struct symbol *lookup_language_this (const struct language_defn *lang,
01054                                             const struct block *block);
01055 
01056 /* Lookup a symbol only in the file static scope of all the objfiles.  */
01057 
01058 struct symbol *lookup_static_symbol_aux (const char *name,
01059                                          const domain_enum domain);
01060 
01061 
01062 /* lookup a symbol by name, within a specified block.  */
01063 
01064 extern struct symbol *lookup_block_symbol (const struct block *, const char *,
01065                                            const domain_enum);
01066 
01067 /* lookup a [struct, union, enum] by name, within a specified block.  */
01068 
01069 extern struct type *lookup_struct (const char *, const struct block *);
01070 
01071 extern struct type *lookup_union (const char *, const struct block *);
01072 
01073 extern struct type *lookup_enum (const char *, const struct block *);
01074 
01075 /* from blockframe.c: */
01076 
01077 /* lookup the function symbol corresponding to the address.  */
01078 
01079 extern struct symbol *find_pc_function (CORE_ADDR);
01080 
01081 /* lookup the function corresponding to the address and section.  */
01082 
01083 extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *);
01084 
01085 extern int find_pc_partial_function_gnu_ifunc (CORE_ADDR pc, const char **name,
01086                                                CORE_ADDR *address,
01087                                                CORE_ADDR *endaddr,
01088                                                int *is_gnu_ifunc_p);
01089 
01090 /* lookup function from address, return name, start addr and end addr.  */
01091 
01092 extern int find_pc_partial_function (CORE_ADDR, const char **, CORE_ADDR *,
01093                                      CORE_ADDR *);
01094 
01095 extern void clear_pc_function_cache (void);
01096 
01097 /* lookup partial symbol table by address and section.  */
01098 
01099 extern struct symtab *find_pc_sect_symtab_via_partial (CORE_ADDR,
01100                                                        struct obj_section *);
01101 
01102 /* lookup full symbol table by address.  */
01103 
01104 extern struct symtab *find_pc_symtab (CORE_ADDR);
01105 
01106 /* lookup full symbol table by address and section.  */
01107 
01108 extern struct symtab *find_pc_sect_symtab (CORE_ADDR, struct obj_section *);
01109 
01110 extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
01111 
01112 extern void reread_symbols (void);
01113 
01114 extern struct type *lookup_transparent_type (const char *);
01115 extern struct type *basic_lookup_transparent_type (const char *);
01116 
01117 
01118 /* Macro for name of symbol to indicate a file compiled with gcc.  */
01119 #ifndef GCC_COMPILED_FLAG_SYMBOL
01120 #define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled."
01121 #endif
01122 
01123 /* Macro for name of symbol to indicate a file compiled with gcc2.  */
01124 #ifndef GCC2_COMPILED_FLAG_SYMBOL
01125 #define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled."
01126 #endif
01127 
01128 extern int in_gnu_ifunc_stub (CORE_ADDR pc);
01129 
01130 /* Functions for resolving STT_GNU_IFUNC symbols which are implemented only
01131    for ELF symbol files.  */
01132 
01133 struct gnu_ifunc_fns
01134 {
01135   /* See elf_gnu_ifunc_resolve_addr for its real implementation.  */
01136   CORE_ADDR (*gnu_ifunc_resolve_addr) (struct gdbarch *gdbarch, CORE_ADDR pc);
01137 
01138   /* See elf_gnu_ifunc_resolve_name for its real implementation.  */
01139   int (*gnu_ifunc_resolve_name) (const char *function_name,
01140                                  CORE_ADDR *function_address_p);
01141 
01142   /* See elf_gnu_ifunc_resolver_stop for its real implementation.  */
01143   void (*gnu_ifunc_resolver_stop) (struct breakpoint *b);
01144 
01145   /* See elf_gnu_ifunc_resolver_return_stop for its real implementation.  */
01146   void (*gnu_ifunc_resolver_return_stop) (struct breakpoint *b);
01147 };
01148 
01149 #define gnu_ifunc_resolve_addr gnu_ifunc_fns_p->gnu_ifunc_resolve_addr
01150 #define gnu_ifunc_resolve_name gnu_ifunc_fns_p->gnu_ifunc_resolve_name
01151 #define gnu_ifunc_resolver_stop gnu_ifunc_fns_p->gnu_ifunc_resolver_stop
01152 #define gnu_ifunc_resolver_return_stop \
01153   gnu_ifunc_fns_p->gnu_ifunc_resolver_return_stop
01154 
01155 extern const struct gnu_ifunc_fns *gnu_ifunc_fns_p;
01156 
01157 extern CORE_ADDR find_solib_trampoline_target (struct frame_info *, CORE_ADDR);
01158 
01159 struct symtab_and_line
01160 {
01161   /* The program space of this sal.  */
01162   struct program_space *pspace;
01163 
01164   struct symtab *symtab;
01165   struct obj_section *section;
01166   /* Line number.  Line numbers start at 1 and proceed through symtab->nlines.
01167      0 is never a valid line number; it is used to indicate that line number
01168      information is not available.  */
01169   int line;
01170 
01171   CORE_ADDR pc;
01172   CORE_ADDR end;
01173   int explicit_pc;
01174   int explicit_line;
01175 
01176   /* The probe associated with this symtab_and_line.  */
01177   struct probe *probe;
01178 };
01179 
01180 extern void init_sal (struct symtab_and_line *sal);
01181 
01182 struct symtabs_and_lines
01183 {
01184   struct symtab_and_line *sals;
01185   int nelts;
01186 };
01187 
01188 
01189 /* Given a pc value, return line number it is in.  Second arg nonzero means
01190    if pc is on the boundary use the previous statement's line number.  */
01191 
01192 extern struct symtab_and_line find_pc_line (CORE_ADDR, int);
01193 
01194 /* Same function, but specify a section as well as an address.  */
01195 
01196 extern struct symtab_and_line find_pc_sect_line (CORE_ADDR,
01197                                                  struct obj_section *, int);
01198 
01199 /* Given a symtab and line number, return the pc there.  */
01200 
01201 extern int find_line_pc (struct symtab *, int, CORE_ADDR *);
01202 
01203 extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
01204                                CORE_ADDR *);
01205 
01206 extern void resolve_sal_pc (struct symtab_and_line *);
01207 
01208 /* Symbol-reading stuff in symfile.c and solib.c.  */
01209 
01210 extern void clear_solib (void);
01211 
01212 /* source.c */
01213 
01214 extern int identify_source_line (struct symtab *, int, int, CORE_ADDR);
01215 
01216 /* Flags passed as 4th argument to print_source_lines.  */
01217 
01218 enum print_source_lines_flags
01219   {
01220     /* Do not print an error message.  */
01221     PRINT_SOURCE_LINES_NOERROR = (1 << 0),
01222 
01223     /* Print the filename in front of the source lines.  */
01224     PRINT_SOURCE_LINES_FILENAME = (1 << 1)
01225   };
01226 
01227 extern void print_source_lines (struct symtab *, int, int,
01228                                 enum print_source_lines_flags);
01229 
01230 extern void forget_cached_source_info_for_objfile (struct objfile *);
01231 extern void forget_cached_source_info (void);
01232 
01233 extern void select_source_symtab (struct symtab *);
01234 
01235 extern VEC (char_ptr) *default_make_symbol_completion_list_break_on
01236   (const char *text, const char *word, const char *break_on,
01237    enum type_code code);
01238 extern VEC (char_ptr) *default_make_symbol_completion_list (const char *,
01239                                                             const char *,
01240                                                             enum type_code);
01241 extern VEC (char_ptr) *make_symbol_completion_list (const char *, const char *);
01242 extern VEC (char_ptr) *make_symbol_completion_type (const char *, const char *,
01243                                                     enum type_code);
01244 extern VEC (char_ptr) *make_symbol_completion_list_fn (struct cmd_list_element *,
01245                                                        const char *,
01246                                                        const char *);
01247 
01248 extern VEC (char_ptr) *make_file_symbol_completion_list (const char *,
01249                                                          const char *,
01250                                                          const char *);
01251 
01252 extern VEC (char_ptr) *make_source_files_completion_list (const char *,
01253                                                           const char *);
01254 
01255 /* symtab.c */
01256 
01257 int matching_obj_sections (struct obj_section *, struct obj_section *);
01258 
01259 extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
01260 
01261 extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
01262                                                        int);
01263 
01264 extern void skip_prologue_sal (struct symtab_and_line *);
01265 
01266 /* symfile.c */
01267 
01268 extern void clear_symtab_users (int add_flags);
01269 
01270 extern enum language deduce_language_from_filename (const char *);
01271 
01272 /* symtab.c */
01273 
01274 extern int in_prologue (struct gdbarch *gdbarch,
01275                         CORE_ADDR pc, CORE_ADDR func_start);
01276 
01277 extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch,
01278                                           CORE_ADDR func_addr);
01279 
01280 extern struct symbol *fixup_symbol_section (struct symbol *,
01281                                             struct objfile *);
01282 
01283 /* Symbol searching */
01284 /* Note: struct symbol_search, search_symbols, et.al. are declared here,
01285    instead of making them local to symtab.c, for gdbtk's sake.  */
01286 
01287 /* When using search_symbols, a list of the following structs is returned.
01288    Callers must free the search list using free_search_symbols!  */
01289 struct symbol_search
01290 {
01291   /* The block in which the match was found.  Could be, for example,
01292      STATIC_BLOCK or GLOBAL_BLOCK.  */
01293   int block;
01294 
01295   /* Information describing what was found.
01296 
01297      If symtab and symbol are NOT NULL, then information was found
01298      for this match.  */
01299   struct symtab *symtab;
01300   struct symbol *symbol;
01301 
01302   /* If msymbol is non-null, then a match was made on something for
01303      which only minimal_symbols exist.  */
01304   struct bound_minimal_symbol msymbol;
01305 
01306   /* A link to the next match, or NULL for the end.  */
01307   struct symbol_search *next;
01308 };
01309 
01310 extern void search_symbols (char *, enum search_domain, int, char **,
01311                             struct symbol_search **);
01312 extern void free_search_symbols (struct symbol_search *);
01313 extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search
01314                                                          **);
01315 
01316 /* The name of the ``main'' function.
01317    FIXME: cagney/2001-03-20: Can't make main_name() const since some
01318    of the calling code currently assumes that the string isn't
01319    const.  */
01320 extern void set_main_name (const char *name);
01321 extern /*const */ char *main_name (void);
01322 extern enum language language_of_main;
01323 
01324 /* Check global symbols in objfile.  */
01325 struct symbol *lookup_global_symbol_from_objfile (const struct objfile *,
01326                                                   const char *name,
01327                                                   const domain_enum domain);
01328 
01329 /* Return 1 if the supplied producer string matches the ARM RealView
01330    compiler (armcc).  */
01331 int producer_is_realview (const char *producer);
01332 
01333 void fixup_section (struct general_symbol_info *ginfo,
01334                     CORE_ADDR addr, struct objfile *objfile);
01335 
01336 struct objfile *lookup_objfile_from_block (const struct block *block);
01337 
01338 extern int symtab_create_debug;
01339 
01340 extern int basenames_may_differ;
01341 
01342 int compare_filenames_for_search (const char *filename,
01343                                   const char *search_name);
01344 
01345 int iterate_over_some_symtabs (const char *name,
01346                                const char *real_path,
01347                                int (*callback) (struct symtab *symtab,
01348                                                 void *data),
01349                                void *data,
01350                                struct symtab *first,
01351                                struct symtab *after_last);
01352 
01353 void iterate_over_symtabs (const char *name,
01354                            int (*callback) (struct symtab *symtab,
01355                                             void *data),
01356                            void *data);
01357 
01358 DEF_VEC_I (CORE_ADDR);
01359 
01360 VEC (CORE_ADDR) *find_pcs_for_symtab_line (struct symtab *symtab, int line,
01361                                            struct linetable_entry **best_entry);
01362 
01363 /* Callback for LA_ITERATE_OVER_SYMBOLS.  The callback will be called
01364    once per matching symbol SYM, with DATA being the argument of the
01365    same name that was passed to LA_ITERATE_OVER_SYMBOLS.  The callback
01366    should return nonzero to indicate that LA_ITERATE_OVER_SYMBOLS
01367    should continue iterating, or zero to indicate that the iteration
01368    should end.  */
01369 
01370 typedef int (symbol_found_callback_ftype) (struct symbol *sym, void *data);
01371 
01372 void iterate_over_symbols (const struct block *block, const char *name,
01373                            const domain_enum domain,
01374                            symbol_found_callback_ftype *callback,
01375                            void *data);
01376 
01377 struct cleanup *demangle_for_lookup (const char *name, enum language lang,
01378                                      const char **result_name);
01379 
01380 struct symbol *allocate_symbol (struct objfile *);
01381 
01382 void initialize_symbol (struct symbol *);
01383 
01384 struct template_symbol *allocate_template_symbol (struct objfile *);
01385 
01386 #endif /* !defined(SYMTAB_H) */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines