* [PATCH 1/3] Remove some uses of "object_files"
2019-04-09 18:11 [PATCH 0/3] some minor objfile iteration improvements Tom Tromey
2019-04-09 18:09 ` [PATCH 2/3] Fix a couple of comments Tom Tromey
2019-04-09 18:09 ` [PATCH 3/3] Introduce a separate debug objfile iterator Tom Tromey
@ 2019-04-09 18:09 ` Tom Tromey
2019-04-10 1:49 ` Simon Marchi
2 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-04-09 18:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
The "object_files" macro is sometimes used when iterating over
objfiles. This patch removes a few such uses in favor of the new
range adapter.
gdb/ChangeLog
2019-04-09 Tom Tromey <tom@tromey.com>
* ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
* minsyms.c (lookup_minimal_symbol): Use foreach.
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline): Likewise.
* symfile.c (reread_symbols): Use foreach.
---
gdb/ChangeLog | 8 ++++++++
gdb/ia64-tdep.c | 3 +--
gdb/minsyms.c | 26 ++++++++++----------------
gdb/symfile.c | 3 +--
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 7b4d0a0bfa1..f46673986ba 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -2845,7 +2845,6 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
unw_word_t *dilap, void *arg)
{
struct obj_section *text_sec;
- struct objfile *objfile;
unw_word_t ip, addr;
unw_dyn_info_t di;
int ret;
@@ -2853,7 +2852,7 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
if (!libunwind_is_initialized ())
return -UNW_ENOINFO;
- for (objfile = object_files; objfile; objfile = objfile->next)
+ for (objfile *objfile : current_program_space->objfiles ())
{
void *buf = NULL;
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 51b65f51421..34198d122dc 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -308,7 +308,6 @@ struct bound_minimal_symbol
lookup_minimal_symbol (const char *name, const char *sfile,
struct objfile *objf)
{
- struct objfile *objfile;
found_minimal_symbols found;
unsigned int mangled_hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
@@ -323,10 +322,11 @@ lookup_minimal_symbol (const char *name, const char *sfile,
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- for (objfile = object_files;
- objfile != NULL && found.external_symbol.minsym == NULL;
- objfile = objfile->next)
+ for (objfile *objfile : current_program_space->objfiles ())
{
+ if (found.external_symbol.minsym != NULL)
+ break;
+
if (objf == NULL || objf == objfile
|| objf == objfile->separate_debug_objfile_backlink)
{
@@ -522,17 +522,17 @@ iterate_over_minimal_symbols
struct bound_minimal_symbol
lookup_minimal_symbol_text (const char *name, struct objfile *objf)
{
- struct objfile *objfile;
struct minimal_symbol *msymbol;
struct bound_minimal_symbol found_symbol = { NULL, NULL };
struct bound_minimal_symbol found_file_symbol = { NULL, NULL };
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
- for (objfile = object_files;
- objfile != NULL && found_symbol.minsym == NULL;
- objfile = objfile->next)
+ for (objfile *objfile : current_program_space->objfiles ())
{
+ if (found_symbol.minsym != NULL)
+ break;
+
if (objf == NULL || objf == objfile
|| objf == objfile->separate_debug_objfile_backlink)
{
@@ -574,14 +574,11 @@ struct minimal_symbol *
lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
struct objfile *objf)
{
- struct objfile *objfile;
struct minimal_symbol *msymbol;
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
- for (objfile = object_files;
- objfile != NULL;
- objfile = objfile->next)
+ for (objfile *objfile : current_program_space->objfiles ())
{
if (objf == NULL || objf == objfile
|| objf == objfile->separate_debug_objfile_backlink)
@@ -606,15 +603,12 @@ struct bound_minimal_symbol
lookup_minimal_symbol_solib_trampoline (const char *name,
struct objfile *objf)
{
- struct objfile *objfile;
struct minimal_symbol *msymbol;
struct bound_minimal_symbol found_symbol = { NULL, NULL };
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
- for (objfile = object_files;
- objfile != NULL;
- objfile = objfile->next)
+ for (objfile *objfile : current_program_space->objfiles ())
{
if (objf == NULL || objf == objfile
|| objf == objfile->separate_debug_objfile_backlink)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index dbfc306c521..ba82f1b83ca 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2427,7 +2427,6 @@ remove_symbol_file_command (const char *args, int from_tty)
void
reread_symbols (void)
{
- struct objfile *objfile;
long new_modtime;
struct stat new_statbuf;
int res;
@@ -2439,7 +2438,7 @@ reread_symbols (void)
This routine should then walk down each partial symbol table
and see if the symbol table that it originates from has been changed. */
- for (objfile = object_files; objfile; objfile = objfile->next)
+ for (objfile *objfile : current_program_space->objfiles ())
{
if (objfile->obfd == NULL)
continue;
--
2.17.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/3] Introduce a separate debug objfile iterator
2019-04-09 18:11 [PATCH 0/3] some minor objfile iteration improvements Tom Tromey
2019-04-09 18:09 ` [PATCH 2/3] Fix a couple of comments Tom Tromey
@ 2019-04-09 18:09 ` Tom Tromey
2019-04-10 2:01 ` Simon Marchi
2019-04-30 15:44 ` Sandra Loosemore
2019-04-09 18:09 ` [PATCH 1/3] Remove some uses of "object_files" Tom Tromey
2 siblings, 2 replies; 20+ messages in thread
From: Tom Tromey @ 2019-04-09 18:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This introduces a new iterator and range adapter for iteration over
the separate debug files of a given objfile. As in the current
approach, the requested objfile is returned first, followed by the
separate debug objfiles.
gdb/ChangeLog
2019-04-09 Tom Tromey <tom@tromey.com>
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_in_objfile_from_linkage_name): Use the iterator.
* objfiles.h (class separate_debug_iterator): New.
(class separate_debug_range): New.
(struct objfile) <separate_debug_objfiles>: New method.
(objfile_separate_debug_iterate): Don't declare.
* objfiles.c (separate_debug_iterator::operator++): Rename from
objfile_separate_debug_iterate.
(objfile_relocate, objfile_rebase, objfile_has_symbols): Use the
iterator.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Use the
iterator.
---
gdb/ChangeLog | 15 +++++++++++
gdb/minsyms.c | 5 +---
gdb/objfiles.c | 67 ++++++++++++++++++++++++-------------------------
gdb/objfiles.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++---
gdb/symtab.c | 12 +++------
5 files changed, 117 insertions(+), 50 deletions(-)
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 34198d122dc..8037329a862 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -696,7 +696,6 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
int lo;
int hi;
int newobj;
- struct objfile *objfile;
struct minimal_symbol *msymbol;
struct minimal_symbol *best_symbol = NULL;
struct objfile *best_objfile = NULL;
@@ -722,9 +721,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
gdb_assert (section != NULL);
- for (objfile = section->objfile;
- objfile != NULL;
- objfile = objfile_separate_debug_iterate (section->objfile, objfile))
+ for (struct objfile *objfile : section->objfile->separate_debug_objfiles ())
{
CORE_ADDR pc = pc_in;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index ada5edc42fa..71518ea5b24 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -446,44 +446,50 @@ entry_point_address (void)
return retval;
}
-/* Iterator on PARENT and every separate debug objfile of PARENT.
- The usage pattern is:
- for (objfile = parent;
- objfile;
- objfile = objfile_separate_debug_iterate (parent, objfile))
- ...
-*/
-
-struct objfile *
-objfile_separate_debug_iterate (const struct objfile *parent,
- const struct objfile *objfile)
+separate_debug_iterator &
+separate_debug_iterator::operator++ ()
{
+ gdb_assert (m_objfile != nullptr);
+
struct objfile *res;
/* If any, return the first child. */
- res = objfile->separate_debug_objfile;
+ res = m_objfile->separate_debug_objfile;
if (res)
- return res;
+ {
+ m_objfile = res;
+ return *this;
+ }
/* Common case where there is no separate debug objfile. */
- if (objfile == parent)
- return NULL;
+ if (m_objfile == m_parent)
+ {
+ m_objfile = nullptr;
+ return *this;
+ }
/* Return the brother if any. Note that we don't iterate on brothers of
the parents. */
- res = objfile->separate_debug_objfile_link;
+ res = m_objfile->separate_debug_objfile_link;
if (res)
- return res;
+ {
+ m_objfile = res;
+ return *this;
+ }
- for (res = objfile->separate_debug_objfile_backlink;
- res != parent;
+ for (res = m_objfile->separate_debug_objfile_backlink;
+ res != m_parent;
res = res->separate_debug_objfile_backlink)
{
gdb_assert (res != NULL);
if (res->separate_debug_objfile_link)
- return res->separate_debug_objfile_link;
+ {
+ m_objfile = res->separate_debug_objfile_link;
+ return *this;
+ }
}
- return NULL;
+ m_objfile = nullptr;
+ return *this;
}
/* Put one object file before a specified on in the global list.
@@ -860,15 +866,15 @@ void
objfile_relocate (struct objfile *objfile,
const struct section_offsets *new_offsets)
{
- struct objfile *debug_objfile;
int changed = 0;
changed |= objfile_relocate1 (objfile, new_offsets);
- for (debug_objfile = objfile->separate_debug_objfile;
- debug_objfile;
- debug_objfile = objfile_separate_debug_iterate (objfile, debug_objfile))
+ for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
{
+ if (debug_objfile == objfile)
+ continue;
+
section_addr_info objfile_addrs
= build_section_addr_info_from_objfile (objfile);
@@ -917,14 +923,9 @@ objfile_rebase1 (struct objfile *objfile, CORE_ADDR slide)
void
objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
{
- struct objfile *debug_objfile;
int changed = 0;
- changed |= objfile_rebase1 (objfile, slide);
-
- for (debug_objfile = objfile->separate_debug_objfile;
- debug_objfile;
- debug_objfile = objfile_separate_debug_iterate (objfile, debug_objfile))
+ for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
changed |= objfile_rebase1 (debug_objfile, slide);
/* Relocate breakpoints as necessary, after things are relocated. */
@@ -965,9 +966,7 @@ objfile_has_full_symbols (struct objfile *objfile)
int
objfile_has_symbols (struct objfile *objfile)
{
- struct objfile *o;
-
- for (o = objfile; o; o = objfile_separate_debug_iterate (objfile, o))
+ for (struct objfile *o : objfile->separate_debug_objfiles ())
if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
return 1;
return 0;
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 368d9f3abe2..168f7fc275b 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -318,6 +318,63 @@ struct objfile_per_bfd_storage
std::bitset<nr_languages> demangled_hash_languages;
};
+/* An iterator that first returns a parent objfile, and then each
+ separate debug objfile. */
+
+class separate_debug_iterator
+{
+public:
+
+ explicit separate_debug_iterator (struct objfile *objfile)
+ : m_objfile (objfile),
+ m_parent (objfile)
+ {
+ }
+
+ bool operator!= (const separate_debug_iterator &other)
+ {
+ return m_objfile != other.m_objfile;
+ }
+
+ separate_debug_iterator &operator++ ();
+
+ struct objfile *operator* ()
+ {
+ return m_objfile;
+ }
+
+private:
+
+ struct objfile *m_objfile;
+ struct objfile *m_parent;
+};
+
+/* A range adapter wrapping separate_debug_iterator. */
+
+class separate_debug_range
+{
+public:
+
+ explicit separate_debug_range (struct objfile *objfile)
+ : m_objfile (objfile)
+ {
+ }
+
+ separate_debug_iterator begin ()
+ {
+ return separate_debug_iterator (m_objfile);
+ }
+
+ separate_debug_iterator end ()
+ {
+ return separate_debug_iterator (nullptr);
+ }
+
+private:
+
+ struct objfile *m_objfile;
+};
+
/* Master structure for keeping track of each file from which
gdb reads symbols. There are several ways these get allocated: 1.
The main symbol file, symfile_objfile, set by the symbol-file command,
@@ -396,6 +453,14 @@ struct objfile
return msymbols_range (this);
}
+ /* Return a range adapter for iterating over all the separate debug
+ objfiles of this objfile. */
+
+ separate_debug_range separate_debug_objfiles ()
+ {
+ return separate_debug_range (this);
+ }
+
/* All struct objfile's are chained together by their next pointers.
The program space field "objfiles" (frequently referenced via
@@ -563,9 +628,6 @@ extern CORE_ADDR entry_point_address (void);
extern void build_objfile_section_table (struct objfile *);
-extern struct objfile *objfile_separate_debug_iterate (const struct objfile *,
- const struct objfile *);
-
extern void put_objfile_before (struct objfile *, struct objfile *);
extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d25f560f084..16e641a830b 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2246,11 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
const char *name,
const domain_enum domain)
{
- struct objfile *objfile;
-
- for (objfile = main_objfile;
- objfile;
- objfile = objfile_separate_debug_iterate (main_objfile, objfile))
+ for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
@@ -2327,7 +2323,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
domain_enum domain)
{
enum language lang = current_language->la_language;
- struct objfile *main_objfile, *cur_objfile;
+ struct objfile *main_objfile;
demangle_result_storage storage;
const char *modified_name = demangle_for_lookup (linkage_name, lang, storage);
@@ -2337,9 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
else
main_objfile = objfile;
- for (cur_objfile = main_objfile;
- cur_objfile;
- cur_objfile = objfile_separate_debug_iterate (main_objfile, cur_objfile))
+ for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result;
--
2.17.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/3] Fix a couple of comments
2019-04-09 18:11 [PATCH 0/3] some minor objfile iteration improvements Tom Tromey
@ 2019-04-09 18:09 ` Tom Tromey
2019-04-10 1:51 ` Simon Marchi
2019-04-09 18:09 ` [PATCH 3/3] Introduce a separate debug objfile iterator Tom Tromey
2019-04-09 18:09 ` [PATCH 1/3] Remove some uses of "object_files" Tom Tromey
2 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-04-09 18:09 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
While working on objfiles I noticed a typo in one comment, and another
comment that, as far as I can tell, has been obsolete for a very long
time.
gdb/ChangeLog
2019-04-09 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Remove old comment.
* objfiles.c (free_all_objfiles): Fix a typo.
---
gdb/ChangeLog | 5 +++++
gdb/objfiles.c | 2 +-
gdb/symfile.c | 6 ------
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1c95e068842..ada5edc42fa 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -699,7 +699,7 @@ free_all_objfiles (void)
{
struct so_list *so;
- /* Any objfile referencewould become stale. */
+ /* Any objfile reference would become stale. */
for (so = master_so_list (); so; so = so->next)
gdb_assert (so->objfile == NULL);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ba82f1b83ca..dd9c4ae9856 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2432,12 +2432,6 @@ reread_symbols (void)
int res;
std::vector<struct objfile *> new_objfiles;
- /* With the addition of shared libraries, this should be modified,
- the load time should be saved in the partial symbol tables, since
- different tables may come from different source files. FIXME.
- This routine should then walk down each partial symbol table
- and see if the symbol table that it originates from has been changed. */
-
for (objfile *objfile : current_program_space->objfiles ())
{
if (objfile->obfd == NULL)
--
2.17.2
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 0/3] some minor objfile iteration improvements
@ 2019-04-09 18:11 Tom Tromey
2019-04-09 18:09 ` [PATCH 2/3] Fix a couple of comments Tom Tromey
` (2 more replies)
0 siblings, 3 replies; 20+ messages in thread
From: Tom Tromey @ 2019-04-09 18:11 UTC (permalink / raw)
To: gdb-patches
This series comes from some experiments I've been doing with objfile
reuse.
These particular patches just change gdb to use foreach in a few more
spots, introducing a new separate-debug-objfile iterator in the
process. Patch #2 is trivial, just fixing some obsolete comments I
noticed while working in this area.
Regression tested by the buildbot.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] Remove some uses of "object_files"
2019-04-09 18:09 ` [PATCH 1/3] Remove some uses of "object_files" Tom Tromey
@ 2019-04-10 1:49 ` Simon Marchi
2019-04-10 2:26 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Simon Marchi @ 2019-04-10 1:49 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2019-04-09 2:09 p.m., Tom Tromey wrote:
> The "object_files" macro is sometimes used when iterating over
> objfiles. This patch removes a few such uses in favor of the new
> range adapter.
>
> gdb/ChangeLog
> 2019-04-09 Tom Tromey <tom@tromey.com>
>
> * ia64-tdep.c (ia64_get_dyn_info_list): Use foreach.
> * minsyms.c (lookup_minimal_symbol): Use foreach.
> (lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
> (lookup_minimal_symbol_solib_trampoline): Likewise.
> * symfile.c (reread_symbols): Use foreach.
LGTM. I would even suggest replacing the remaining few instances of object_files
with current_program_space->objfiles_head and removing the macro completely.
Simon
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] Fix a couple of comments
2019-04-09 18:09 ` [PATCH 2/3] Fix a couple of comments Tom Tromey
@ 2019-04-10 1:51 ` Simon Marchi
2019-04-10 13:22 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Simon Marchi @ 2019-04-10 1:51 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2019-04-09 2:09 p.m., Tom Tromey wrote:
> While working on objfiles I noticed a typo in one comment, and another
> comment that, as far as I can tell, has been obsolete for a very long
> time.
I don't really understand the comment. Is it obsolete because what the
comment suggests has been implemented, or it's just not relevant anymore?
Simon
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-04-09 18:09 ` [PATCH 3/3] Introduce a separate debug objfile iterator Tom Tromey
@ 2019-04-10 2:01 ` Simon Marchi
2019-04-10 14:08 ` Tom Tromey
2019-04-30 15:44 ` Sandra Loosemore
1 sibling, 1 reply; 20+ messages in thread
From: Simon Marchi @ 2019-04-10 2:01 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2019-04-09 2:09 p.m., Tom Tromey wrote:
> This introduces a new iterator and range adapter for iteration over
> the separate debug files of a given objfile. As in the current
> approach, the requested objfile is returned first, followed by the
> separate debug objfiles.
>
> gdb/ChangeLog
> 2019-04-09 Tom Tromey <tom@tromey.com>
>
> * symtab.c (lookup_global_symbol_from_objfile)
> (lookup_symbol_in_objfile_from_linkage_name): Use the iterator.
> * objfiles.h (class separate_debug_iterator): New.
> (class separate_debug_range): New.
> (struct objfile) <separate_debug_objfiles>: New method.
> (objfile_separate_debug_iterate): Don't declare.
> * objfiles.c (separate_debug_iterator::operator++): Rename from
> objfile_separate_debug_iterate.
> (objfile_relocate, objfile_rebase, objfile_has_symbols): Use the
> iterator.
> * minsyms.c (lookup_minimal_symbol_by_pc_section): Use the
> iterator.
> ---
> gdb/ChangeLog | 15 +++++++++++
> gdb/minsyms.c | 5 +---
> gdb/objfiles.c | 67 ++++++++++++++++++++++++-------------------------
> gdb/objfiles.h | 68 +++++++++++++++++++++++++++++++++++++++++++++++---
> gdb/symtab.c | 12 +++------
> 5 files changed, 117 insertions(+), 50 deletions(-)
>
> diff --git a/gdb/minsyms.c b/gdb/minsyms.c
> index 34198d122dc..8037329a862 100644
> --- a/gdb/minsyms.c
> +++ b/gdb/minsyms.c
> @@ -696,7 +696,6 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
> int lo;
> int hi;
> int newobj;
> - struct objfile *objfile;
> struct minimal_symbol *msymbol;
> struct minimal_symbol *best_symbol = NULL;
> struct objfile *best_objfile = NULL;
> @@ -722,9 +721,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
>
> gdb_assert (section != NULL);
>
> - for (objfile = section->objfile;
> - objfile != NULL;
> - objfile = objfile_separate_debug_iterate (section->objfile, objfile))
> + for (struct objfile *objfile : section->objfile->separate_debug_objfiles ())
> {
> CORE_ADDR pc = pc_in;
>
> diff --git a/gdb/objfiles.c b/gdb/objfiles.c
> index ada5edc42fa..71518ea5b24 100644
> --- a/gdb/objfiles.c
> +++ b/gdb/objfiles.c
> @@ -446,44 +446,50 @@ entry_point_address (void)
> return retval;
> }
>
> -/* Iterator on PARENT and every separate debug objfile of PARENT.
> - The usage pattern is:
> - for (objfile = parent;
> - objfile;
> - objfile = objfile_separate_debug_iterate (parent, objfile))
> - ...
> -*/
> -
> -struct objfile *
> -objfile_separate_debug_iterate (const struct objfile *parent,
> - const struct objfile *objfile)
> +separate_debug_iterator &
> +separate_debug_iterator::operator++ ()
> {
> + gdb_assert (m_objfile != nullptr);
> +
> struct objfile *res;
>
> /* If any, return the first child. */
> - res = objfile->separate_debug_objfile;
> + res = m_objfile->separate_debug_objfile;
> if (res)
> - return res;
> + {
> + m_objfile = res;
> + return *this;
> + }
>
> /* Common case where there is no separate debug objfile. */
> - if (objfile == parent)
> - return NULL;
> + if (m_objfile == m_parent)
> + {
> + m_objfile = nullptr;
> + return *this;
> + }
>
> /* Return the brother if any. Note that we don't iterate on brothers of
> the parents. */
> - res = objfile->separate_debug_objfile_link;
> + res = m_objfile->separate_debug_objfile_link;
> if (res)
> - return res;
> + {
> + m_objfile = res;
> + return *this;
> + }
>
> - for (res = objfile->separate_debug_objfile_backlink;
> - res != parent;
> + for (res = m_objfile->separate_debug_objfile_backlink;
> + res != m_parent;
> res = res->separate_debug_objfile_backlink)
> {
> gdb_assert (res != NULL);
> if (res->separate_debug_objfile_link)
> - return res->separate_debug_objfile_link;
> + {
> + m_objfile = res->separate_debug_objfile_link;
> + return *this;
> + }
> }
> - return NULL;
> + m_objfile = nullptr;
> + return *this;
> }
>
> /* Put one object file before a specified on in the global list.
> @@ -860,15 +866,15 @@ void
> objfile_relocate (struct objfile *objfile,
> const struct section_offsets *new_offsets)
> {
> - struct objfile *debug_objfile;
> int changed = 0;
>
> changed |= objfile_relocate1 (objfile, new_offsets);
>
> - for (debug_objfile = objfile->separate_debug_objfile;
> - debug_objfile;
> - debug_objfile = objfile_separate_debug_iterate (objfile, debug_objfile))
> + for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
> {
> + if (debug_objfile == objfile)
> + continue;
> +
> section_addr_info objfile_addrs
> = build_section_addr_info_from_objfile (objfile);
>
> @@ -917,14 +923,9 @@ objfile_rebase1 (struct objfile *objfile, CORE_ADDR slide)
> void
> objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
> {
> - struct objfile *debug_objfile;
> int changed = 0;
>
> - changed |= objfile_rebase1 (objfile, slide);
> -
> - for (debug_objfile = objfile->separate_debug_objfile;
> - debug_objfile;
> - debug_objfile = objfile_separate_debug_iterate (objfile, debug_objfile))
> + for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
> changed |= objfile_rebase1 (debug_objfile, slide);
>
> /* Relocate breakpoints as necessary, after things are relocated. */
> @@ -965,9 +966,7 @@ objfile_has_full_symbols (struct objfile *objfile)
> int
> objfile_has_symbols (struct objfile *objfile)
> {
> - struct objfile *o;
> -
> - for (o = objfile; o; o = objfile_separate_debug_iterate (objfile, o))
> + for (struct objfile *o : objfile->separate_debug_objfiles ())
> if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
> return 1;
> return 0;
> diff --git a/gdb/objfiles.h b/gdb/objfiles.h
> index 368d9f3abe2..168f7fc275b 100644
> --- a/gdb/objfiles.h
> +++ b/gdb/objfiles.h
> @@ -318,6 +318,63 @@ struct objfile_per_bfd_storage
> std::bitset<nr_languages> demangled_hash_languages;
> };
>
> +/* An iterator that first returns a parent objfile, and then each
> + separate debug objfile. */
> +
> +class separate_debug_iterator
> +{
> +public:
> +
> + explicit separate_debug_iterator (struct objfile *objfile)
> + : m_objfile (objfile),
> + m_parent (objfile)
> + {
> + }
> +
> + bool operator!= (const separate_debug_iterator &other)
> + {
> + return m_objfile != other.m_objfile;
> + }
> +
> + separate_debug_iterator &operator++ ();
> +
> + struct objfile *operator* ()
> + {
> + return m_objfile;
> + }
> +
> +private:
> +
> + struct objfile *m_objfile;
> + struct objfile *m_parent;
> +};
> +
> +/* A range adapter wrapping separate_debug_iterator. */
> +
> +class separate_debug_range
> +{
> +public:
> +
> + explicit separate_debug_range (struct objfile *objfile)
> + : m_objfile (objfile)
> + {
> + }
> +
> + separate_debug_iterator begin ()
> + {
> + return separate_debug_iterator (m_objfile);
> + }
> +
> + separate_debug_iterator end ()
> + {
> + return separate_debug_iterator (nullptr);
> + }
> +
> +private:
> +
> + struct objfile *m_objfile;
> +};
> +
> /* Master structure for keeping track of each file from which
> gdb reads symbols. There are several ways these get allocated: 1.
> The main symbol file, symfile_objfile, set by the symbol-file command,
> @@ -396,6 +453,14 @@ struct objfile
> return msymbols_range (this);
> }
>
> + /* Return a range adapter for iterating over all the separate debug
> + objfiles of this objfile. */
> +
> + separate_debug_range separate_debug_objfiles ()
> + {
> + return separate_debug_range (this);
> + }
> +
>
> /* All struct objfile's are chained together by their next pointers.
> The program space field "objfiles" (frequently referenced via
> @@ -563,9 +628,6 @@ extern CORE_ADDR entry_point_address (void);
>
> extern void build_objfile_section_table (struct objfile *);
>
> -extern struct objfile *objfile_separate_debug_iterate (const struct objfile *,
> - const struct objfile *);
> -
> extern void put_objfile_before (struct objfile *, struct objfile *);
>
> extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index d25f560f084..16e641a830b 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -2246,11 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
> const char *name,
> const domain_enum domain)
> {
> - struct objfile *objfile;
> -
> - for (objfile = main_objfile;
> - objfile;
> - objfile = objfile_separate_debug_iterate (main_objfile, objfile))
> + for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
> {
> struct block_symbol result
> = lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
> @@ -2327,7 +2323,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
> domain_enum domain)
> {
> enum language lang = current_language->la_language;
> - struct objfile *main_objfile, *cur_objfile;
> + struct objfile *main_objfile;
>
> demangle_result_storage storage;
> const char *modified_name = demangle_for_lookup (linkage_name, lang, storage);
> @@ -2337,9 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
> else
> main_objfile = objfile;
>
> - for (cur_objfile = main_objfile;
> - cur_objfile;
> - cur_objfile = objfile_separate_debug_iterate (main_objfile, cur_objfile))
> + for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
> {
> struct block_symbol result;
>
>
Thanks, this LGTM.
While touching this code, could you fixup the various?
- if (res)
+ if (res != NULL)
Simon
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] Remove some uses of "object_files"
2019-04-10 1:49 ` Simon Marchi
@ 2019-04-10 2:26 ` Tom Tromey
2019-04-10 2:50 ` Simon Marchi
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-04-10 2:26 UTC (permalink / raw)
To: Simon Marchi; +Cc: Tom Tromey, gdb-patches
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> LGTM. I would even suggest replacing the remaining few instances
Simon> of object_files with current_program_space->objfiles_head and
Simon> removing the macro completely.
Yeah, I'll do it, though I think not as part of this patch. Some of the
remaining uses are in objfile destructor, and I was working toward
changing how objfiles are stored (using std::list rather than an
intrusive list) but I haven't finished those patches yet...
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] Remove some uses of "object_files"
2019-04-10 2:26 ` Tom Tromey
@ 2019-04-10 2:50 ` Simon Marchi
2019-04-10 14:08 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Simon Marchi @ 2019-04-10 2:50 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 2019-04-09 10:25 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
>
> Simon> LGTM. I would even suggest replacing the remaining few instances
> Simon> of object_files with current_program_space->objfiles_head and
> Simon> removing the macro completely.
>
> Yeah, I'll do it, though I think not as part of this patch. Some of the
> remaining uses are in objfile destructor, and I was working toward
> changing how objfiles are stored (using std::list rather than an
> intrusive list) but I haven't finished those patches yet...
Here is a patch that does it (goes on top of your patch), we can apply it if it
doesn't conflict too much with your other work.
From 5866bf2c26900ca78a06ec2bf3c758efc8cf4375 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Tue, 9 Apr 2019 21:45:49 -0400
Subject: [PATCH] Remove object_files macro
This macro was provided as a compat layer when introducing multiprocess
support in GDB, to avoid having to update all usages. There are very
few of them left, so I suggest getting rid of it, replacing them with
the definition of the macro (current_program_space->objfiles_head). It
becomes more apparent that the caller code depends on the
current_program_space, which I think is good.
At the same time, I changed MULTI_OBJFILE_P to become a function instead
of a macro.
I noticed that object_files was also referenced in the list-objfiles
function defined in gdb.gdb. The function also accesses fields in
the objfile structure that no longer exist. I took the opportunity to
update them at the same time, since it's a small obvious change.
gdb/ChangeLog:
* progspace.h (object_files): Remove.
* objfiles.h (MULTI_OBJFILE_P): Change this macro...
(multi_objfile_p): ... to become this function.
* objfiles.c (objfile::objfile): Remove MULTI_OBJFILE_P usages.
* maint.c (maintenance_translate_address): Use multi_objfile_p
instead of MULTI_OBJFILE_P.
* printcmd.c (info_symbol_command): Likewise.
* gdb.gdb (list-objfiles): Don't use object_files, fix access to
objfile fields.
---
gdb/gdb.gdb | 4 ++--
gdb/maint.c | 2 +-
gdb/objfiles.c | 12 +++++++-----
gdb/objfiles.h | 14 ++++++++++----
gdb/printcmd.c | 2 +-
gdb/progspace.h | 4 ----
6 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/gdb/gdb.gdb b/gdb/gdb.gdb
index 437784102c1f..f107178c6353 100644
--- a/gdb/gdb.gdb
+++ b/gdb/gdb.gdb
@@ -2,11 +2,11 @@
# structures.
define list-objfiles
- set $obj = object_files
+ set $obj = current_program_space->objfiles_head
printf "objfile bfd msyms name\n"
while $obj != 0
printf "0x%-8x 0x%-8x %6d %s\n", $obj, $obj->obfd, \
- $obj->minimal_symbol_count, $obj->name
+ $obj->per_bfd->minimal_symbol_count, $obj->original_name
set var $obj = $obj->next
end
end
diff --git a/gdb/maint.c b/gdb/maint.c
index 8fc660eb9394..c907dc806d45 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -483,7 +483,7 @@ maintenance_translate_address (const char *arg, int from_tty)
gdb_assert (sect->objfile && objfile_name (sect->objfile));
obj_name = objfile_name (sect->objfile);
- if (MULTI_OBJFILE_P ())
+ if (multi_objfile_p ())
printf_filtered (_("%s + %s in section %s of %s\n"),
symbol_name, symbol_offset,
section_name, obj_name);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1c95e068842a..d90164433a07 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -393,13 +393,13 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
/* Add this file onto the tail of the linked list of other such files. */
- if (object_files == NULL)
- object_files = this;
+ if (current_program_space->objfiles_head == NULL)
+ current_program_space->objfiles_head = this;
else
{
struct objfile *last_one;
- for (last_one = object_files;
+ for (last_one = current_program_space->objfiles_head;
last_one->next;
last_one = last_one->next);
last_one->next = this;
@@ -496,7 +496,8 @@ put_objfile_before (struct objfile *objfile, struct objfile *before_this)
unlink_objfile (objfile);
- for (objp = &object_files; *objp != NULL; objp = &((*objp)->next))
+ for (objp = ¤t_program_space->objfiles_head; *objp != NULL;
+ objp = &((*objp)->next))
{
if (*objp == before_this)
{
@@ -528,7 +529,8 @@ unlink_objfile (struct objfile *objfile)
{
struct objfile **objpp;
- for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp)->next))
+ for (objpp = ¤t_program_space->objfiles_head;
+ *objpp != NULL; objpp = &((*objpp)->next))
{
if (*objpp == objfile)
{
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 368d9f3abe25..8d26c039976b 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -398,8 +398,8 @@ struct objfile
/* All struct objfile's are chained together by their next pointers.
- The program space field "objfiles" (frequently referenced via
- the macro "object_files") points to the first link in this chain. */
+ The program space field "objfiles_head" points to the first link in this
+ chain. */
struct objfile *next = nullptr;
@@ -679,9 +679,15 @@ extern void default_iterate_over_objfiles_in_search_order
uninitialized section index. */
#define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss
-/* Answer whether there is more than one object file loaded. */
+/* Answer whether there is more than one object file loaded in the current
+ program space. */
-#define MULTI_OBJFILE_P() (object_files && object_files->next)
+static inline
+bool multi_objfile_p ()
+{
+ return (current_program_space->objfiles_head != NULL
+ && current_program_space->objfiles_head->next != NULL);
+}
/* Reset the per-BFD storage area on OBJ. */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 9e84594fe687..46f0c3400ef7 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1319,7 +1319,7 @@ info_symbol_command (const char *arg, int from_tty)
gdb_assert (osect->objfile && objfile_name (osect->objfile));
obj_name = objfile_name (osect->objfile);
- if (MULTI_OBJFILE_P ())
+ if (multi_objfile_p ())
if (pc_in_unmapped_range (addr, osect))
if (section_is_overlay (osect))
printf_filtered (_("%s in load address range of "
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 039f55517305..e77e21fdda65 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -259,10 +259,6 @@ struct address_space
#define symfile_objfile current_program_space->symfile_object_file
-/* All known objfiles are kept in a linked list. This points to the
- root of this list. */
-#define object_files current_program_space->objfiles_head
-
/* The set of target sections matching the sections mapped into the
current program space. */
#define current_target_sections (¤t_program_space->target_sections)
--
2.21.0
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/3] Fix a couple of comments
2019-04-10 1:51 ` Simon Marchi
@ 2019-04-10 13:22 ` Tom Tromey
0 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-04-10 13:22 UTC (permalink / raw)
To: Simon Marchi; +Cc: Tom Tromey, gdb-patches
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> On 2019-04-09 2:09 p.m., Tom Tromey wrote:
>> While working on objfiles I noticed a typo in one comment, and another
>> comment that, as far as I can tell, has been obsolete for a very long
>> time.
Simon> I don't really understand the comment. Is it obsolete because what the
Simon> comment suggests has been implemented, or it's just not relevant anymore?
The comment was this one in reread_symbols:
- /* With the addition of shared libraries, this should be modified,
- the load time should be saved in the partial symbol tables, since
- different tables may come from different source files. FIXME.
- This routine should then walk down each partial symbol table
- and see if the symbol table that it originates from has been changed. */
I am not totally sure how to interpret this either. On the one hand, it
sounds done (objfiles for shared libraries record the mtime, this
function examines those); on the other it sounds confused (partial
symbol tables aren't relevant here). Maybe there was some ancient time
when shared libraries didn't have separate objfiles? I do not know.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-04-10 2:01 ` Simon Marchi
@ 2019-04-10 14:08 ` Tom Tromey
0 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-04-10 14:08 UTC (permalink / raw)
To: Simon Marchi; +Cc: Tom Tromey, gdb-patches
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> While touching this code, could you fixup the various?
Simon> - if (res)
Simon> + if (res != NULL)
I did this.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/3] Remove some uses of "object_files"
2019-04-10 2:50 ` Simon Marchi
@ 2019-04-10 14:08 ` Tom Tromey
0 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2019-04-10 14:08 UTC (permalink / raw)
To: Simon Marchi; +Cc: Tom Tromey, gdb-patches
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> Here is a patch that does it (goes on top of your patch), we can apply it if it
Simon> doesn't conflict too much with your other work.
Thanks. This looks good to me.
Simon> At the same time, I changed MULTI_OBJFILE_P to become a function instead
Simon> of a macro.
FWIW in my patch to do this, I changed it into a method on the program
space.
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-04-09 18:09 ` [PATCH 3/3] Introduce a separate debug objfile iterator Tom Tromey
2019-04-10 2:01 ` Simon Marchi
@ 2019-04-30 15:44 ` Sandra Loosemore
2019-04-30 15:51 ` Tom Tromey
1 sibling, 1 reply; 20+ messages in thread
From: Sandra Loosemore @ 2019-04-30 15:44 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 4/9/19 12:09 PM, Tom Tromey wrote:
> This introduces a new iterator and range adapter for iteration over
> the separate debug files of a given objfile. As in the current
> approach, the requested objfile is returned first, followed by the
> separate debug objfiles.
>
> gdb/ChangeLog
> 2019-04-09 Tom Tromey <tom@tromey.com>
>
> * symtab.c (lookup_global_symbol_from_objfile)
> (lookup_symbol_in_objfile_from_linkage_name): Use the iterator.
> * objfiles.h (class separate_debug_iterator): New.
> (class separate_debug_range): New.
> (struct objfile) <separate_debug_objfiles>: New method.
> (objfile_separate_debug_iterate): Don't declare.
> * objfiles.c (separate_debug_iterator::operator++): Rename from
> objfile_separate_debug_iterate.
> (objfile_relocate, objfile_rebase, objfile_has_symbols): Use the
> iterator.
> * minsyms.c (lookup_minimal_symbol_by_pc_section): Use the
> iterator.
FYI, this series of patches has broken builds with older versions of GCC
(we've got 5.2.1 installed on our build system here). Multiple failures
like:
/path/to/gdb/minsyms.c: In function 'bound_minimal_symbol
lookup_minimal_symbol_by_pc_section(CORE_ADDR, obj_section*,
lookup_msym_prefer)':
/path/to/gdb/minsyms.c:724:8: error: types may not be defined in a
for-range-declaration [-Werror]
for (struct objfile *objfile :
section->objfile->separate_debug_objfiles ())
^~~~~~
-Sandra
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-04-30 15:44 ` Sandra Loosemore
@ 2019-04-30 15:51 ` Tom Tromey
2019-05-01 18:30 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-04-30 15:51 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: Tom Tromey, gdb-patches
>>>>> "Sandra" == Sandra Loosemore <sandra@codesourcery.com> writes:
Sandra> FYI, this series of patches has broken builds with older versions of
Sandra> GCC (we've got 5.2.1 installed on our build system here). Multiple
Sandra> failures like:
I think that's a bug in that version of gcc, but gdb has routinely
worked around it in the past.
Sandra> /path/to/gdb/minsyms.c: In function 'bound_minimal_symbol
Sandra> lookup_minimal_symbol_by_pc_section(CORE_ADDR, obj_section*,
Sandra> lookup_msym_prefer)':
Sandra> /path/to/gdb/minsyms.c:724:8: error: types may not be defined in a
Sandra> for-range-declaration [-Werror]
Sandra> for (struct objfile *objfile :
section-> objfile->separate_debug_objfiles ())
Sandra> ^~~~~~
If you can send me a full list, I can send you a patch to test.
thanks,
Tom
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-04-30 15:51 ` Tom Tromey
@ 2019-05-01 18:30 ` Tom Tromey
2019-05-03 18:23 ` Sandra Loosemore
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-05-01 18:30 UTC (permalink / raw)
To: Tom Tromey; +Cc: Sandra Loosemore, gdb-patches
Sandra> FYI, this series of patches has broken builds with older versions of
Sandra> GCC (we've got 5.2.1 installed on our build system here). Multiple
Sandra> failures like:
Tom> I think that's a bug in that version of gcc, but gdb has routinely
Tom> worked around it in the past.
[...]
Tom> If you can send me a full list, I can send you a patch to test.
I did a grep and came up with the appended.
If you try it, and it works, I will check it in.
thanks,
Tom
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1a566635b2d..2b4445ee185 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12483,7 +12483,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
because the expression may hold the addresses of multiple symbols
in some cases. */
std::multimap<program_space *, struct bp_location *> loc_map;
- for (struct bp_location *bl = c->loc; bl != NULL; bl = bl->next)
+ for (bp_location *bl = c->loc; bl != NULL; bl = bl->next)
loc_map.emplace (bl->pspace, bl);
scoped_restore_current_program_space save_pspace;
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 8282ef27e61..e3368ce6471 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1706,7 +1706,7 @@ darwin_attach_pid (struct inferior *inf)
static struct thread_info *
thread_info_from_private_thread_info (darwin_thread_info *pti)
{
- for (struct thread_info *it : all_threads ())
+ for (thread_info *it : all_threads ())
{
darwin_thread_info *iter_pti = get_darwin_thread_info (it);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b0bdecf96fc..b5ea9e3cc0a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15962,7 +15962,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
field for our sole member child. */
struct attribute *discr = dwarf2_attr (child_die, DW_AT_discr_value, cu);
- for (struct die_info *variant_child = child_die->child;
+ for (die_info *variant_child = child_die->child;
variant_child != NULL;
variant_child = sibling_die (variant_child))
{
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 8037329a862..9d29d880aab 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -721,7 +721,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
gdb_assert (section != NULL);
- for (struct objfile *objfile : section->objfile->separate_debug_objfiles ())
+ for (objfile *objfile : section->objfile->separate_debug_objfiles ())
{
CORE_ADDR pc = pc_in;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1b0ea29980d..30823c2d889 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -864,7 +864,7 @@ objfile_relocate (struct objfile *objfile,
changed |= objfile_relocate1 (objfile, new_offsets);
- for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+ for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
{
if (debug_objfile == objfile)
continue;
@@ -919,7 +919,7 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
{
int changed = 0;
- for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+ for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
changed |= objfile_rebase1 (debug_objfile, slide);
/* Relocate breakpoints as necessary, after things are relocated. */
@@ -960,7 +960,7 @@ objfile_has_full_symbols (struct objfile *objfile)
int
objfile_has_symbols (struct objfile *objfile)
{
- for (struct objfile *o : objfile->separate_debug_objfiles ())
+ for (::objfile *o : objfile->separate_debug_objfiles ())
if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
return 1;
return 0;
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 039b0432231..6ba95107918 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -323,7 +323,7 @@ net_open (struct serial *scb, const char *name)
{
got_connrefused = false;
- for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
+ for (addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
{
/* Iterate over the list of possible addresses to connect
to. For each, we'll try to connect and see if it
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 16e641a830b..0e1f7ead294 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2246,7 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
const char *name,
const domain_enum domain)
{
- for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
+ for (objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
@@ -2333,7 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
else
main_objfile = objfile;
- for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
+ for (::objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result;
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-05-01 18:30 ` Tom Tromey
@ 2019-05-03 18:23 ` Sandra Loosemore
2019-05-03 23:28 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: Sandra Loosemore @ 2019-05-03 18:23 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 683 bytes --]
On 5/1/19 12:10 PM, Tom Tromey wrote:
> Sandra> FYI, this series of patches has broken builds with older versions of
> Sandra> GCC (we've got 5.2.1 installed on our build system here). Multiple
> Sandra> failures like:
>
> Tom> I think that's a bug in that version of gcc, but gdb has routinely
> Tom> worked around it in the past.
>
> [...]
>
> Tom> If you can send me a full list, I can send you a patch to test.
>
> I did a grep and came up with the appended.
> If you try it, and it works, I will check it in.
I found one more use in ada-lang.c that you'd missed. Things build with
the attached version of the patch, but I haven't done any testing beyond
that.
-Sandra
[-- Attachment #2: objfile.patch --]
[-- Type: text/x-patch, Size: 4945 bytes --]
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1a56663..20fb349 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12483,7 +12483,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
because the expression may hold the addresses of multiple symbols
in some cases. */
std::multimap<program_space *, struct bp_location *> loc_map;
- for (struct bp_location *bl = c->loc; bl != NULL; bl = bl->next)
+ for (bp_location *bl = c->loc; bl != NULL; bl = bl->next)
loc_map.emplace (bl->pspace, bl);
scoped_restore_current_program_space save_pspace;
@@ -13231,7 +13231,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
excep_string = ada_encode (excep_string);
std::vector<struct bound_minimal_symbol> symbols
= ada_lookup_simple_minsyms (excep_string);
- for (const struct bound_minimal_symbol &msym : symbols)
+ for (const bound_minimal_symbol &msym : symbols)
{
if (!result.empty ())
result += " or ";
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 8282ef2..e3368ce 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1706,7 +1706,7 @@ darwin_attach_pid (struct inferior *inf)
static struct thread_info *
thread_info_from_private_thread_info (darwin_thread_info *pti)
{
- for (struct thread_info *it : all_threads ())
+ for (thread_info *it : all_threads ())
{
darwin_thread_info *iter_pti = get_darwin_thread_info (it);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b0bdecf..b5ea9e3 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15962,7 +15962,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
field for our sole member child. */
struct attribute *discr = dwarf2_attr (child_die, DW_AT_discr_value, cu);
- for (struct die_info *variant_child = child_die->child;
+ for (die_info *variant_child = child_die->child;
variant_child != NULL;
variant_child = sibling_die (variant_child))
{
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 8037329..9d29d88 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -721,7 +721,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
gdb_assert (section != NULL);
- for (struct objfile *objfile : section->objfile->separate_debug_objfiles ())
+ for (objfile *objfile : section->objfile->separate_debug_objfiles ())
{
CORE_ADDR pc = pc_in;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1b0ea29..30823c2 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -864,7 +864,7 @@ objfile_relocate (struct objfile *objfile,
changed |= objfile_relocate1 (objfile, new_offsets);
- for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+ for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
{
if (debug_objfile == objfile)
continue;
@@ -919,7 +919,7 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
{
int changed = 0;
- for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+ for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
changed |= objfile_rebase1 (debug_objfile, slide);
/* Relocate breakpoints as necessary, after things are relocated. */
@@ -960,7 +960,7 @@ objfile_has_full_symbols (struct objfile *objfile)
int
objfile_has_symbols (struct objfile *objfile)
{
- for (struct objfile *o : objfile->separate_debug_objfiles ())
+ for (::objfile *o : objfile->separate_debug_objfiles ())
if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
return 1;
return 0;
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 927a285..5aa7105 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -319,7 +319,7 @@ net_open (struct serial *scb, const char *name)
{
got_connrefused = false;
- for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
+ for (addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
{
/* Iterate over the list of possible addresses to connect
to. For each, we'll try to connect and see if it
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 16e641a..0e1f7ea 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2246,7 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
const char *name,
const domain_enum domain)
{
- for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
+ for (objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
@@ -2333,7 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
else
main_objfile = objfile;
- for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
+ for (::objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result;
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-05-03 18:23 ` Sandra Loosemore
@ 2019-05-03 23:28 ` Tom Tromey
2019-05-15 9:45 ` John Marshall
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-05-03 23:28 UTC (permalink / raw)
To: Sandra Loosemore; +Cc: Tom Tromey, gdb-patches
>> I did a grep and came up with the appended.
>> If you try it, and it works, I will check it in.
Sandra> I found one more use in ada-lang.c that you'd missed. Things build
Sandra> with the attached version of the patch, but I haven't done any testing
Sandra> beyond that.
Thanks for doing that. Somehow there seems to have been one more in
dictionary.c as well. I've appended the patch I am going to push.
Tom
commit bba6afebd7fde978acb6e06a48084a694aab3b7a
Author: Tom Tromey <tom@tromey.com>
Date: Fri May 3 17:21:36 2019 -0600
Remove "struct" from foreach statements
Some versions of gcc have a bug that causes
for (struct mumble : something)
... to give a compiler error. We routinely work around this bug in
gdb, but apparently had not done so in a while. This patch fixes the
remaining known cases of this problem.
gdb/ChangeLog
2019-05-03 Sandra Loosemore <sandra@codesourcery.com>
Tom Tromey <tom@tromey.com>
* dictionary.c (collate_pending_symbols_by_language): Remove
"struct" from foreach.
* symtab.c (lookup_global_symbol_from_objfile)
(lookup_symbol_in_objfile_from_linkage_name): Remove "struct" from
foreach.
* ser-tcp.c (net_open): Remove "struct" from foreach.
* objfiles.c (objfile_relocate, objfile_rebase)
(objfile_has_symbols): Remove "struct" from foreach.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Remove "struct"
from foreach.
* dwarf2read.c (handle_struct_member_die): Remove "struct" from
foreach.
* darwin-nat.c (thread_info_from_private_thread_info): Remove
"struct" from foreach.
* ada-lang.c (create_excep_cond_exprs)
(ada_exception_catchpoint_cond_string): Remove "struct" from
foreach.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eba0426463a..ed6d77a0bfb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,24 @@
+2019-05-03 Sandra Loosemore <sandra@codesourcery.com>
+ Tom Tromey <tom@tromey.com>
+
+ * dictionary.c (collate_pending_symbols_by_language): Remove
+ "struct" from foreach.
+ * symtab.c (lookup_global_symbol_from_objfile)
+ (lookup_symbol_in_objfile_from_linkage_name): Remove "struct" from
+ foreach.
+ * ser-tcp.c (net_open): Remove "struct" from foreach.
+ * objfiles.c (objfile_relocate, objfile_rebase)
+ (objfile_has_symbols): Remove "struct" from foreach.
+ * minsyms.c (lookup_minimal_symbol_by_pc_section): Remove "struct"
+ from foreach.
+ * dwarf2read.c (handle_struct_member_die): Remove "struct" from
+ foreach.
+ * darwin-nat.c (thread_info_from_private_thread_info): Remove
+ "struct" from foreach.
+ * ada-lang.c (create_excep_cond_exprs)
+ (ada_exception_catchpoint_cond_string): Remove "struct" from
+ foreach.
+
2019-05-01 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_value_primitive_field): Treat more fields as
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1a566635b2d..20fb3497c03 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12483,7 +12483,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
because the expression may hold the addresses of multiple symbols
in some cases. */
std::multimap<program_space *, struct bp_location *> loc_map;
- for (struct bp_location *bl = c->loc; bl != NULL; bl = bl->next)
+ for (bp_location *bl = c->loc; bl != NULL; bl = bl->next)
loc_map.emplace (bl->pspace, bl);
scoped_restore_current_program_space save_pspace;
@@ -13231,7 +13231,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
excep_string = ada_encode (excep_string);
std::vector<struct bound_minimal_symbol> symbols
= ada_lookup_simple_minsyms (excep_string);
- for (const struct bound_minimal_symbol &msym : symbols)
+ for (const bound_minimal_symbol &msym : symbols)
{
if (!result.empty ())
result += " or ";
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 8282ef27e61..e3368ce6471 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1706,7 +1706,7 @@ darwin_attach_pid (struct inferior *inf)
static struct thread_info *
thread_info_from_private_thread_info (darwin_thread_info *pti)
{
- for (struct thread_info *it : all_threads ())
+ for (thread_info *it : all_threads ())
{
darwin_thread_info *iter_pti = get_darwin_thread_info (it);
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 88eff2fa439..4e38b2e2340 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -932,7 +932,7 @@ collate_pending_symbols_by_language (const struct pending *symbol_list)
{
std::unordered_map<enum language, std::vector<symbol *>> nsyms;
- for (const struct pending *list_counter = symbol_list;
+ for (const pending *list_counter = symbol_list;
list_counter != nullptr; list_counter = list_counter->next)
{
for (int i = list_counter->nsyms - 1; i >= 0; --i)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b0bdecf96fc..b5ea9e3cc0a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -15962,7 +15962,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
field for our sole member child. */
struct attribute *discr = dwarf2_attr (child_die, DW_AT_discr_value, cu);
- for (struct die_info *variant_child = child_die->child;
+ for (die_info *variant_child = child_die->child;
variant_child != NULL;
variant_child = sibling_die (variant_child))
{
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 8037329a862..9d29d880aab 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -721,7 +721,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
gdb_assert (section != NULL);
- for (struct objfile *objfile : section->objfile->separate_debug_objfiles ())
+ for (objfile *objfile : section->objfile->separate_debug_objfiles ())
{
CORE_ADDR pc = pc_in;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 1b0ea29980d..30823c2d889 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -864,7 +864,7 @@ objfile_relocate (struct objfile *objfile,
changed |= objfile_relocate1 (objfile, new_offsets);
- for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+ for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
{
if (debug_objfile == objfile)
continue;
@@ -919,7 +919,7 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
{
int changed = 0;
- for (struct objfile *debug_objfile : objfile->separate_debug_objfiles ())
+ for (::objfile *debug_objfile : objfile->separate_debug_objfiles ())
changed |= objfile_rebase1 (debug_objfile, slide);
/* Relocate breakpoints as necessary, after things are relocated. */
@@ -960,7 +960,7 @@ objfile_has_full_symbols (struct objfile *objfile)
int
objfile_has_symbols (struct objfile *objfile)
{
- for (struct objfile *o : objfile->separate_debug_objfiles ())
+ for (::objfile *o : objfile->separate_debug_objfiles ())
if (objfile_has_partial_symbols (o) || objfile_has_full_symbols (o))
return 1;
return 0;
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 039b0432231..6ba95107918 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -323,7 +323,7 @@ net_open (struct serial *scb, const char *name)
{
got_connrefused = false;
- for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
+ for (addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next)
{
/* Iterate over the list of possible addresses to connect
to. For each, we'll try to connect and see if it
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 16e641a830b..0e1f7ead294 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2246,7 +2246,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
const char *name,
const domain_enum domain)
{
- for (struct objfile *objfile : main_objfile->separate_debug_objfiles ())
+ for (objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
@@ -2333,7 +2333,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
else
main_objfile = objfile;
- for (struct objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
+ for (::objfile *cur_objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result;
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-05-03 23:28 ` Tom Tromey
@ 2019-05-15 9:45 ` John Marshall
2019-05-15 15:45 ` Tom Tromey
0 siblings, 1 reply; 20+ messages in thread
From: John Marshall @ 2019-05-15 9:45 UTC (permalink / raw)
To: Tom Tromey; +Cc: Sandra Loosemore, gdb-patches
On 3 May 2019, Tom Tromey <tom@tromey.com> wrote:
> commit bba6afebd7fde978acb6e06a48084a694aab3b7a
> Author: Tom Tromey <tom@tromey.com>
> Date: Fri May 3 17:21:36 2019 -0600
>
> Remove "struct" from foreach statements
> [snip]
> * darwin-nat.c (thread_info_from_private_thread_info): Remove
> "struct" from foreach.
This broke compilation on macOS (tested on Mojave) with both Clang and GCC (9.1.0):
CXX darwin-nat.o
../../../binutils-gdb/gdb/darwin-nat.c:1709:8: error: must use 'class' tag to refer to type 'thread_info' in this scope
for (thread_info *it : all_threads ())
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/mach/thread_act.h:240:15: note:
class 'thread_info' is hidden by a non-type declaration of 'thread_info' here
kern_return_t thread_info
Mach has a thread_info() function declared in that header, which darwin-nat.c #includes.
Cheers,
John
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-05-15 9:45 ` John Marshall
@ 2019-05-15 15:45 ` Tom Tromey
2019-05-15 20:00 ` John Marshall
0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2019-05-15 15:45 UTC (permalink / raw)
To: John Marshall; +Cc: Tom Tromey, Sandra Loosemore, gdb-patches
>>>>> "John" == John Marshall <John.W.Marshall@glasgow.ac.uk> writes:
John> On 3 May 2019, Tom Tromey <tom@tromey.com> wrote:
>> commit bba6afebd7fde978acb6e06a48084a694aab3b7a
>> Author: Tom Tromey <tom@tromey.com>
>> Date: Fri May 3 17:21:36 2019 -0600
>>
>> Remove "struct" from foreach statements
>> [snip]
>> * darwin-nat.c (thread_info_from_private_thread_info): Remove
>> "struct" from foreach.
John> This broke compilation on macOS (tested on Mojave) with both Clang and GCC (9.1.0):
Can you try the appended? I no longer have a macOS machine to test on.
If this works for you, I will check it in.
This clashes with the normal gcc bug workaround that we do here; but I
think on macOS that probably isn't worth worrying about.
Tom
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index e3368ce6471..8282ef27e61 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1706,7 +1706,7 @@ darwin_attach_pid (struct inferior *inf)
static struct thread_info *
thread_info_from_private_thread_info (darwin_thread_info *pti)
{
- for (thread_info *it : all_threads ())
+ for (struct thread_info *it : all_threads ())
{
darwin_thread_info *iter_pti = get_darwin_thread_info (it);
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/3] Introduce a separate debug objfile iterator
2019-05-15 15:45 ` Tom Tromey
@ 2019-05-15 20:00 ` John Marshall
0 siblings, 0 replies; 20+ messages in thread
From: John Marshall @ 2019-05-15 20:00 UTC (permalink / raw)
To: Tom Tromey; +Cc: Sandra Loosemore, gdb-patches
On 15 May 2019, at 16:45, Tom Tromey <tom@tromey.com> wrote:
> John> This broke compilation on macOS (tested on Mojave) with both Clang and GCC (9.1.0):
>
> Can you try the appended? I no longer have a macOS machine to test on.
Yes, that does the trick.
> This clashes with the normal gcc bug workaround that we do here; but I
> think on macOS that probably isn't worth worrying about.
Possibly a C-style for loop with explicit begin()/end() would work with both, but I'd agree that it's not worth worrying about for this Darwin-only file.
Thanks,
John
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2019-05-15 20:00 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 18:11 [PATCH 0/3] some minor objfile iteration improvements Tom Tromey
2019-04-09 18:09 ` [PATCH 2/3] Fix a couple of comments Tom Tromey
2019-04-10 1:51 ` Simon Marchi
2019-04-10 13:22 ` Tom Tromey
2019-04-09 18:09 ` [PATCH 3/3] Introduce a separate debug objfile iterator Tom Tromey
2019-04-10 2:01 ` Simon Marchi
2019-04-10 14:08 ` Tom Tromey
2019-04-30 15:44 ` Sandra Loosemore
2019-04-30 15:51 ` Tom Tromey
2019-05-01 18:30 ` Tom Tromey
2019-05-03 18:23 ` Sandra Loosemore
2019-05-03 23:28 ` Tom Tromey
2019-05-15 9:45 ` John Marshall
2019-05-15 15:45 ` Tom Tromey
2019-05-15 20:00 ` John Marshall
2019-04-09 18:09 ` [PATCH 1/3] Remove some uses of "object_files" Tom Tromey
2019-04-10 1:49 ` Simon Marchi
2019-04-10 2:26 ` Tom Tromey
2019-04-10 2:50 ` Simon Marchi
2019-04-10 14:08 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).