aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/read.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/read.h')
-rw-r--r--gdb/dwarf2/read.h123
1 files changed, 102 insertions, 21 deletions
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 4e3f8d7..2f9ad05 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -54,6 +54,7 @@ struct dwarf2_cu;
struct dwarf2_debug_sections;
struct dwarf2_per_bfd;
struct dwarf2_per_cu;
+struct file_entry;
struct mapped_index;
struct mapped_debug_names;
struct signatured_type;
@@ -127,7 +128,6 @@ struct dwarf2_per_cu
lto_artificial (false),
queued (false),
m_header_read_in (false),
- mark (false),
files_read (false),
scanned (false),
section (section),
@@ -195,10 +195,6 @@ public:
it private at the moment. */
mutable packed<bool, 1> m_header_read_in;
- /* A temporary mark bit used when iterating over all CUs in
- expand_symtabs_matching. */
- packed<unsigned int, 1> mark;
-
/* True if we've tried to read the file table. There will be no
point in trying to read it again next time. */
packed<bool, 1> files_read;
@@ -673,6 +669,36 @@ public:
std::string captured_debug_dir;
};
+/* Scoped object to remove all units from PER_BFD and clear other associated
+ fields in case of failure. */
+
+struct scoped_remove_all_units
+{
+ explicit scoped_remove_all_units (dwarf2_per_bfd &per_bfd)
+ : m_per_bfd (&per_bfd)
+ {}
+
+ DISABLE_COPY_AND_ASSIGN (scoped_remove_all_units);
+
+ ~scoped_remove_all_units ()
+ {
+ if (m_per_bfd == nullptr)
+ return;
+
+ m_per_bfd->all_units.clear ();
+ m_per_bfd->num_comp_units = 0;
+ m_per_bfd->num_type_units = 0;
+ }
+
+ /* Disable this object. Call this to keep the units of M_PER_BFD on the
+ success path. */
+ void disable () { m_per_bfd = nullptr; }
+
+private:
+ /* This is nullptr if the object is disabled. */
+ dwarf2_per_bfd *m_per_bfd;
+};
+
/* An iterator for all_units that is based on index. This
approach makes it possible to iterate over all_units safely,
when some caller in the loop may add new units. */
@@ -1192,25 +1218,44 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
bool need_fullname) override;
};
-/* If FILE_MATCHER is NULL or if PER_CU has
- dwarf2_per_cu_quick_data::MARK set (see
- dw_expand_symtabs_matching_file_matcher), expand the CU and call
- EXPANSION_NOTIFY on it. */
+/* This is used to track whether a CU has already been visited during
+ symbol expansion. It is an auto-resizing bool vector. */
+class auto_bool_vector
+{
+public:
-extern bool dw2_expand_symtabs_matching_one
- (dwarf2_per_cu *per_cu,
- dwarf2_per_objfile *per_objfile,
- expand_symtabs_file_matcher file_matcher,
- expand_symtabs_expansion_listener expansion_notify,
- expand_symtabs_lang_matcher lang_matcher);
+ auto_bool_vector () = default;
+
+ /* Return true if element I is set. */
+ bool is_set (size_t i) const
+ {
+ if (i < m_vec.size ())
+ return m_vec[i];
+ return false;
+ }
+
+ /* Set a value in this vector, growing it automatically. */
+ void set (size_t i, bool value)
+ {
+ if (m_vec.size () < i + 1)
+ m_vec.resize (i + 1);
+ m_vec[i] = value;
+ }
+
+private:
+ std::vector<bool> m_vec;
+};
-/* If FILE_MATCHER is non-NULL, set all the
- dwarf2_per_cu_quick_data::MARK of the current DWARF2_PER_OBJFILE
- that match FILE_MATCHER. */
+/* If FILE_MATCHER is NULL and if CUS_TO_SKIP does not include the
+ CU's index, expand the CU and call LISTENER on it. */
-extern void dw_expand_symtabs_matching_file_matcher
- (dwarf2_per_objfile *per_objfile,
- expand_symtabs_file_matcher file_matcher);
+extern bool dw2_search_one
+ (dwarf2_per_cu *per_cu,
+ dwarf2_per_objfile *per_objfile,
+ auto_bool_vector &cus_to_skip,
+ search_symtabs_file_matcher file_matcher,
+ search_symtabs_expansion_listener listener,
+ search_symtabs_lang_matcher lang_matcher);
/* Return pointer to string at .debug_str offset STR_OFFSET. */
@@ -1321,4 +1366,40 @@ extern file_and_directory &find_file_and_directory (die_info *die,
extern const dwarf2_section_info &get_section_for_ref
(const attribute &attr, dwarf2_cu *cu);
+/* A convenience function to find the proper .debug_line section for a CU. */
+
+extern struct dwarf2_section_info *get_debug_line_section
+ (struct dwarf2_cu *cu);
+
+/* Start a subfile for DWARF. FILENAME is the name of the file and
+ DIRNAME the name of the source directory which contains FILENAME
+ or NULL if not known.
+ This routine tries to keep line numbers from identical absolute and
+ relative file names in a common subfile.
+
+ Using the `list' example from the GDB testsuite, which resides in
+ /srcdir and compiling it with Irix6.2 cc in /compdir using a filename
+ of /srcdir/list0.c yields the following debugging information for list0.c:
+
+ DW_AT_name: /srcdir/list0.c
+ DW_AT_comp_dir: /compdir
+ files.files[0].name: list0.h
+ files.files[0].dir: /srcdir
+ files.files[1].name: list0.c
+ files.files[1].dir: /srcdir
+
+ The line number information for list0.c has to end up in a single
+ subfile, so that `break /srcdir/list0.c:1' works as expected.
+ start_subfile will ensure that this happens provided that we pass the
+ concatenation of files.files[1].dir and files.files[1].name as the
+ subfile's name. */
+extern void dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe,
+ const line_header &lh);
+
+/* A helper function that decides if a given symbol is an Ada Pragma
+ Import or Pragma Export. */
+
+extern bool is_ada_import_or_export (dwarf2_cu *cu, const char *name,
+ const char *linkagename);
+
#endif /* GDB_DWARF2_READ_H */