summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-16 06:37:15 -0700
committerTom Tromey <tom@tromey.com>2019-01-17 15:42:05 -0700
commitf252c6d5dc49cb27838e153e863f16ea7895859e (patch)
tree4b84a64f29b3e1318eead66fc233483a04a931a5
parentb669c95337903d39aa2254e8ea0405c0ac117d24 (diff)
downloadbinutils-gdb-f252c6d5dc49cb27838e153e863f16ea7895859e.tar.gz
Make psymtab range adapter a method on objfile
This removes the objfile_psymtabs class in favor of a method on objfile and on psymtab_storage. 2019-01-16 Tom Tromey <tom@tromey.com> * objfiles.h (struct objfile) <psymtabs>: New method. (class objfile_psymtabs): Remove. * psymtab.h (class psymtab_storage) <partial_symtab_range>: New typedef. <range>: New method. (require_partial_symbols): Change return type. * psymtab.c (require_partial_symbols) (psym_expand_symtabs_matching): Update. * mdebugread.c (parse_partial_symbols): Update. * dbxread.c (dbx_end_psymtab): Update.
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/dbxread.c2
-rw-r--r--gdb/mdebugread.c2
-rw-r--r--gdb/objfiles.h21
-rw-r--r--gdb/psymtab.c6
-rw-r--r--gdb/psymtab.h15
6 files changed, 38 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d3b16f64c51..4e562fc0090 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,16 @@
+2019-01-16 Tom Tromey <tom@tromey.com>
+
+ * objfiles.h (struct objfile) <psymtabs>: New method.
+ (class objfile_psymtabs): Remove.
+ * psymtab.h (class psymtab_storage) <partial_symtab_range>: New
+ typedef.
+ <range>: New method.
+ (require_partial_symbols): Change return type.
+ * psymtab.c (require_partial_symbols)
+ (psym_expand_symtabs_matching): Update.
+ * mdebugread.c (parse_partial_symbols): Update.
+ * dbxread.c (dbx_end_psymtab): Update.
+
2019-01-15 Tom Tromey <tom@tromey.com>
* symtab.c (lookup_objfile_from_block)
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 25bcc2778c5..60d384b27fe 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2011,7 +2011,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
address, set it to our starting address. Take care to not set our
own ending address to our starting address. */
- for (partial_symtab *p1 : objfile_psymtabs (objfile))
+ for (partial_symtab *p1 : objfile->psymtabs ())
if (!p1->text_high_valid && p1->text_low_valid && p1 != pst)
p1->set_text_high (pst->raw_text_low ());
}
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 4bdf9731cfe..accf07c2780 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -3684,7 +3684,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
&& save_pst->text_low_valid
&& !(objfile->flags & OBJF_REORDERED))
{
- for (partial_symtab *iter : objfile_psymtabs (objfile))
+ for (partial_symtab *iter : objfile->psymtabs ())
{
if (save_pst != iter
&& save_pst->raw_text_low () >= iter->raw_text_low ()
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 2cf61957ec1..5299a3c8e5e 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -293,6 +293,14 @@ struct objfile
DISABLE_COPY_AND_ASSIGN (objfile);
+ /* A range adapter that makes it possible to iterate over all
+ psymtabs in one objfile. */
+
+ psymtab_storage::partial_symtab_range psymtabs ()
+ {
+ return partial_symtabs->range ();
+ }
+
/* Reset the storage for the partial symbol tables. */
void reset_psymtabs ()
@@ -642,19 +650,6 @@ private:
struct objfile *m_objfile;
};
-/* A range adapter that makes it possible to iterate over all
- psymtabs in one objfile. */
-
-class objfile_psymtabs : public next_adapter<struct partial_symtab>
-{
-public:
-
- explicit objfile_psymtabs (struct objfile *objfile)
- : next_adapter<struct partial_symtab> (objfile->partial_symtabs->psymtabs)
- {
- }
-};
-
#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
if (osect->the_bfd_section == NULL) \
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 776f59c3acb..17db29759c4 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -104,7 +104,7 @@ psymtab_storage::allocate_psymtab ()
/* See psymtab.h. */
-objfile_psymtabs
+psymtab_storage::partial_symtab_range
require_partial_symbols (struct objfile *objfile, int verbose)
{
if ((objfile->flags & OBJF_PSYMTABS_READ) == 0)
@@ -129,7 +129,7 @@ require_partial_symbols (struct objfile *objfile, int verbose)
}
}
- return objfile_psymtabs (objfile);
+ return objfile->psymtabs ();
}
/* Helper function for psym_map_symtabs_matching_filename that
@@ -1341,7 +1341,7 @@ psym_expand_symtabs_matching
for (partial_symtab *ps : require_partial_symbols (objfile, 1))
ps->searched_flag = PST_NOT_SEARCHED;
- for (partial_symtab *ps : objfile_psymtabs (objfile))
+ for (partial_symtab *ps : objfile->psymtabs ())
{
QUIT;
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index 26aeb29646e..3ee5eee0b65 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -92,6 +92,16 @@ public:
struct partial_symtab *allocate_psymtab ();
+ typedef next_adapter<struct partial_symtab> partial_symtab_range;
+
+ /* A range adapter that makes it possible to iterate over all
+ psymtabs in one objfile. */
+
+ partial_symtab_range range ()
+ {
+ return partial_symtab_range (psymtabs);
+ }
+
/* Each objfile points to a linked list of partial symtabs derived from
this file, one partial symtab structure for each compilation unit
@@ -144,8 +154,7 @@ extern const struct quick_symbol_functions dwarf2_debug_names_functions;
are loaded. This function returns a range adapter suitable for
iterating over the psymtabs of OBJFILE. */
-class objfile_psymtabs;
-extern objfile_psymtabs require_partial_symbols (struct objfile *objfile,
- int verbose);
+extern psymtab_storage::partial_symtab_range require_partial_symbols
+ (struct objfile *objfile, int verbose);
#endif /* PSYMTAB_H */