Return gdbpy_ref from some Python string functions
[deliverable/binutils-gdb.git] / gdb / dwarf2read.h
index 46a10520ec2a18508adfa7f6616788c6b27e16a6..67ebc1902b2a4236d0e529c25213c655920ac4ef 100644 (file)
 #ifndef DWARF2READ_H
 #define DWARF2READ_H
 
+#include <unordered_map>
+#include "dwarf-index-cache.h"
 #include "filename-seen-cache.h"
 #include "gdb_obstack.h"
 
+/* Hold 'maintenance (set|show) dwarf' commands.  */
+extern struct cmd_list_element *set_dwarf_cmdlist;
+extern struct cmd_list_element *show_dwarf_cmdlist;
+
 typedef struct dwarf2_per_cu_data *dwarf2_per_cu_ptr;
 DEF_VEC_P (dwarf2_per_cu_ptr);
 
@@ -89,6 +95,9 @@ struct tu_stats
 struct dwarf2_debug_sections;
 struct mapped_index;
 struct mapped_debug_names;
+struct signatured_type;
+struct die_info;
+typedef struct die_info *die_info_ptr;
 
 /* Collection of data recorded per objfile.
    This hangs off of dwarf2_objfile_data_key.  */
@@ -105,6 +114,30 @@ struct dwarf2_per_objfile : public allocate_on_obstack
 
   DISABLE_COPY_AND_ASSIGN (dwarf2_per_objfile);
 
+  /* Return the CU/TU given its index.
+
+     This is intended for loops like:
+
+     for (i = 0; i < (dwarf2_per_objfile->n_comp_units
+                     + dwarf2_per_objfile->n_type_units); ++i)
+       {
+         dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
+
+         ...;
+       }
+  */
+  dwarf2_per_cu_data *get_cutu (int index);
+
+  /* Return the CU given its index.
+     This differs from get_cutu in that it's for when you know INDEX refers to a
+     CU.  */
+  dwarf2_per_cu_data *get_cu (int index);
+
+  /* Return the TU given its index.
+     This differs from get_cutu in that it's for when you know INDEX refers to a
+     TU.  */
+  signatured_type *get_tu (int index);
+
   /* Free all cached compilation units.  */
   void free_cached_comp_units ();
 private:
@@ -140,21 +173,10 @@ public:
 
   /* Table of all the compilation units.  This is used to locate
      the target compilation unit of a particular reference.  */
-  struct dwarf2_per_cu_data **all_comp_units = NULL;
-
-  /* The number of compilation units in ALL_COMP_UNITS.  */
-  int n_comp_units = 0;
-
-  /* The number of .debug_types-related CUs.  */
-  int n_type_units = 0;
+  std::vector<dwarf2_per_cu_data *> all_comp_units;
 
-  /* The number of elements allocated in all_type_units.
-     If there are skeleton-less TUs, we add them to all_type_units lazily.  */
-  int n_allocated_type_units = 0;
-
-  /* The .debug_types-related CUs (TUs).
-     This is stored in malloc space because we may realloc it.  */
-  struct signatured_type **all_type_units = NULL;
+  /* The .debug_types-related CUs (TUs).  */
+  std::vector<signatured_type *> all_type_units;
 
   /* Table of struct type_unit_group objects.
      The hash key is the DW_AT_stmt_list value.  */
@@ -180,11 +202,11 @@ public:
   bool dwp_checked = false;
 
   /* The DWP file if there is one, or NULL.  */
-  struct dwp_file *dwp_file = NULL;
+  std::unique_ptr<struct dwp_file> dwp_file;
 
   /* The shared '.dwz' file, if one exists.  This is used when the
      original data was compressed using 'dwz -m'.  */
-  struct dwz_file *dwz_file = NULL;
+  std::unique_ptr<struct dwz_file> dwz_file;
 
   /* A flag indicating whether this objfile has a section loaded at a
      VMA of 0.  */
@@ -195,7 +217,7 @@ public:
   bool using_index = false;
 
   /* The mapped index, or NULL if .gdb_index is missing or not being used.  */
-  mapped_index *index_table = NULL;
+  std::unique_ptr<mapped_index> index_table;
 
   /* The mapped index, or NULL if .debug_names is missing or not being used.  */
   std::unique_ptr<mapped_debug_names> debug_names_table;
@@ -219,7 +241,7 @@ public:
   htab_t die_type_hash {};
 
   /* The CUs we recently read.  */
-  VEC (dwarf2_per_cu_ptr) *just_read_cus = NULL;
+  std::vector<dwarf2_per_cu_data *> just_read_cus;
 
   /* Table containing line_header indexed by offset and offset_in_dwz.  */
   htab_t line_header_hash {};
@@ -227,6 +249,15 @@ public:
   /* Table containing all filenames.  This is an optional because the
      table is lazily constructed on first access.  */
   gdb::optional<filename_seen_cache> filenames_cache;
+
+  /* If we loaded the index from an external file, this contains the
+     resources associated to the open file, memory mapping, etc.  */
+  std::unique_ptr<index_cache_resource> index_cache_res;
+
+  /* Mapping from abstract origin DIE to concrete DIEs that reference it as
+     DW_AT_abstract_origin.  */
+  std::unordered_map<die_info_ptr, std::vector<die_info_ptr>>
+    abstract_to_concrete;
 };
 
 /* Get the dwarf2_per_objfile associated to OBJFILE.  */
This page took 0.027152 seconds and 4 git commands to generate.