Support arch-dependent fill
[binutils-gdb.git] / gdb / symfile.h
index 35444756fb21636320da5a8b2178b22e8833d72f..d4f3fd90385dd19fb66fe516ec0e688b4a3a829b 100644 (file)
@@ -1,8 +1,6 @@
 /* Definitions for reading symbol files into GDB.
 
-   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 1990-2004, 2007-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -116,6 +114,11 @@ struct symfile_segment_data
   int *segment_info;
 };
 
+/* Callback for quick_symbol_functions->map_symbol_filenames.  */
+
+typedef void (symbol_filename_ftype) (const char *filename,
+                                     const char *fullname, void *data);
+
 /* The "quick" symbol functions exist so that symbol readers can
    avoiding an initial read of all the symbols.  For example, symbol
    readers might choose to use the "partial symbol table" utilities,
@@ -147,22 +150,24 @@ struct quick_symbol_functions
   /* Forget all cached full file names for OBJFILE.  */
   void (*forget_cached_source_info) (struct objfile *objfile);
 
-  /* Look up the symbol table, in OBJFILE, of a source file named
-     NAME.  If there is no '/' in the name, a match after a '/' in the
-     symbol table's file name will also work.  FULL_PATH is the
-     absolute file name, and REAL_PATH is the same, run through
-     gdb_realpath.
-
-     If no such symbol table can be found, returns 0.
-
-     Otherwise, sets *RESULT to the symbol table and returns 1.  This
-     might return 1 and set *RESULT to NULL if the requested file is
-     an include file that does not have a symtab of its own.  */
-  int (*lookup_symtab) (struct objfile *objfile,
-                       const char *name,
-                       const char *full_path,
-                       const char *real_path,
-                       struct symtab **result);
+  /* Expand and iterate over each "partial" symbol table in OBJFILE
+     where the source file is named NAME.
+
+     If NAME is not absolute, a match after a '/' in the symbol
+     table's file name will also work.  FULL_PATH is the absolute file
+     name, and REAL_PATH is the same, run through gdb_realpath.
+
+     If a match is found, the "partial" symbol table is expanded.
+     Then, this calls iterate_over_some_symtabs (or equivalent) over
+     all newly-created symbol tables, passing CALLBACK and DATA to it.
+     The result of this call is returned.  */
+  int (*map_symtabs_matching_filename) (struct objfile *objfile,
+                                       const char *name,
+                                       const char *full_path,
+                                       const char *real_path,
+                                       int (*callback) (struct symtab *,
+                                                        void *),
+                                       void *data);
 
   /* Check to see if the symbol is defined in a "partial" symbol table
      of OBJFILE.  KIND should be either GLOBAL_BLOCK or STATIC_BLOCK,
@@ -217,24 +222,24 @@ struct quick_symbol_functions
   void (*expand_symtabs_with_filename) (struct objfile *objfile,
                                        const char *filename);
 
-  /* Return the file name of the file holding the symbol in OBJFILE
+  /* Return the file name of the file holding the global symbol in OBJFILE
      named NAME.  If no such symbol exists in OBJFILE, return NULL.  */
   const char *(*find_symbol_file) (struct objfile *objfile, const char *name);
 
   /* Find global or static symbols in all tables that are in NAMESPACE 
      and for which MATCH (symbol name, NAME) == 0, passing each to 
-     CALLBACK, reading in partial symbol symbol tables as needed.  Look
+     CALLBACK, reading in partial symbol tables as needed.  Look
      through global symbols if GLOBAL and otherwise static symbols.
      Passes NAME, NAMESPACE, and DATA to CALLBACK with each symbol
      found.  After each block is processed, passes NULL to CALLBACK.
-     MATCH must be weaker than strcmp_iw in the sense that
-     strcmp_iw(x,y) == 0 --> MATCH(x,y) == 0.  ORDERED_COMPARE, if
-     non-null, must be an ordering relation compatible with strcmp_iw
-     in the sense that  
-            strcmp(x,y) == 0 --> ORDERED_COMPARE(x,y) == 0 
+     MATCH must be weaker than strcmp_iw_ordered in the sense that
+     strcmp_iw_ordered(x,y) == 0 --> MATCH(x,y) == 0.  ORDERED_COMPARE,
+     if non-null, must be an ordering relation compatible with
+     strcmp_iw_ordered in the sense that
+            strcmp_iw_ordered(x,y) == 0 --> ORDERED_COMPARE(x,y) == 0
      and 
-            strcmp(x,y) <= 0 --> ORDERED_COMPARE(x,y) <= 0
-     (allowing strcmp(x,y) < 0 while ORDERED_COMPARE(x, y) == 0).
+            strcmp_iw_ordered(x,y) <= 0 --> ORDERED_COMPARE(x,y) <= 0
+     (allowing strcmp_iw_ordered(x,y) < 0 while ORDERED_COMPARE(x, y) == 0).
      CALLBACK returns 0 to indicate that the scan should continue, or
      non-zero to indicate that the scan should be terminated.  */
 
@@ -253,10 +258,10 @@ struct quick_symbol_functions
      file is skipped.  If FILE_MATCHER is NULL such file is not skipped.
 
      Otherwise, if KIND does not match this symbol is skipped.
-     
-     If even KIND matches, then NAME_MATCHER is called for each symbol defined
-     in the file.  The symbol's "natural" name and DATA are passed to
-     NAME_MATCHER.
+
+     If even KIND matches, then NAME_MATCHER is called for each symbol
+     defined in the file.  The symbol "search" name and DATA are passed
+     to NAME_MATCHER.
 
      If NAME_MATCHER returns zero, then this symbol is skipped.
 
@@ -264,11 +269,12 @@ struct quick_symbol_functions
 
      DATA is user data that is passed unmodified to the callback
      functions.  */
-  void (*expand_symtabs_matching) (struct objfile *objfile,
-                                  int (*file_matcher) (const char *, void *),
-                                  int (*name_matcher) (const char *, void *),
-                                  enum search_domain kind,
-                                  void *data);
+  void (*expand_symtabs_matching)
+    (struct objfile *objfile,
+     int (*file_matcher) (const char *, void *),
+     int (*name_matcher) (const char *, void *),
+     enum search_domain kind,
+     void *data);
 
   /* Return the symbol table from OBJFILE that contains PC and
      SECTION.  Return NULL if there is no such symbol table.  This
@@ -283,12 +289,12 @@ struct quick_symbol_functions
                                         int warn_if_readin);
 
   /* Call a callback for every file defined in OBJFILE whose symtab is
-     not already read in.  FUN is the callback.  It is passed the file's name,
-     the file's full name, and the DATA passed to this function.  */
+     not already read in.  FUN is the callback.  It is passed the file's
+     FILENAME, the file's FULLNAME (if need_fullname is non-zero), and
+     the DATA passed to this function.  */
   void (*map_symbol_filenames) (struct objfile *objfile,
-                               void (*fun) (const char *, const char *,
-                                            void *),
-                               void *data);
+                               symbol_filename_ftype *fun, void *data,
+                               int need_fullname);
 };
 
 /* Structure to keep track of symbol reading functions for various
@@ -553,7 +559,57 @@ extern struct cleanup *increment_reading_symtab (void);
 
 /* From dwarf2read.c */
 
-extern int dwarf2_has_info (struct objfile *);
+/* Names for a dwarf2 debugging section.  The field NORMAL is the normal
+   section name (usually from the DWARF standard), while the field COMPRESSED
+   is the name of compressed sections.  If your object file format doesn't
+   support compressed sections, the field COMPRESSED can be NULL.  Likewise,
+   the debugging section is not supported, the field NORMAL can be NULL too.
+   It doesn't make sense to have a NULL NORMAL field but a non-NULL COMPRESSED
+   field.  */
+
+struct dwarf2_section_names {
+  const char *normal;
+  const char *compressed;
+};
+
+/* List of names for dward2 debugging sections.  Also most object file formats
+   use the standardized (ie ELF) names, some (eg XCOFF) have customized names
+   due to restrictions.
+   The table for the standard names is defined in dwarf2read.c.  Please
+   update all instances of dwarf2_debug_sections if you add a field to this
+   structure.  It is always safe to use { NULL, NULL } in this case.  */
+
+struct dwarf2_debug_sections {
+  struct dwarf2_section_names info;
+  struct dwarf2_section_names abbrev;
+  struct dwarf2_section_names line;
+  struct dwarf2_section_names loc;
+  struct dwarf2_section_names macinfo;
+  struct dwarf2_section_names macro;
+  struct dwarf2_section_names str;
+  struct dwarf2_section_names ranges;
+  struct dwarf2_section_names types;
+  struct dwarf2_section_names frame;
+  struct dwarf2_section_names eh_frame;
+  struct dwarf2_section_names gdb_index;
+  /* This field has no meaning, but exists solely to catch changes to
+     this structure which are not reflected in some instance.  */
+  int sentinel;
+};
+
+extern int dwarf2_has_info (struct objfile *,
+                            const struct dwarf2_debug_sections *);
+
+/* Dwarf2 sections that can be accessed by dwarf2_get_section_info.  */
+enum dwarf2_section_enum {
+  DWARF2_DEBUG_FRAME,
+  DWARF2_EH_FRAME
+};
+
+extern void dwarf2_get_section_info (struct objfile *,
+                                     enum dwarf2_section_enum,
+                                    asection **, gdb_byte **,
+                                    bfd_size_type *);
 
 extern int dwarf2_initialize_objfile (struct objfile *);
 extern void dwarf2_build_psymtabs (struct objfile *);