diff options
author | Tom Tromey <tom@tromey.com> | 2018-11-24 09:58:20 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-01-09 18:28:15 -0700 |
commit | 8b31193aa9752ba60d63cedaba943370d76ce543 (patch) | |
tree | 3e6787e80428ab357880409a63be7a620b769ffd /gdb/source.c | |
parent | d5da8b3c0d99e71c27832a4e9b60c61eebf9767c (diff) | |
download | binutils-8b31193aa9752ba60d63cedaba943370d76ce543.zip binutils-8b31193aa9752ba60d63cedaba943370d76ce543.tar.gz binutils-8b31193aa9752ba60d63cedaba943370d76ce543.tar.bz2 |
Remove ALL_OBJFILES and ALL_FILETABS
This removes the ALL_OBJFILES and ALL_FILETABS macros, replacing them
with ranged for loops.
gdb/ChangeLog
2019-01-09 Tom Tromey <tom@tromey.com>
* symtab.c (find_line_symtab, info_sources_command)
(make_source_files_completion_list): Use objfile_compunits.
* source.c (select_source_symtab): Use objfile_compunits.
* objfiles.h (struct objfile): Update comment.
(ALL_OBJFILES): Remove.
(ALL_FILETABS): Remove.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Use
objfile_compunits.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/gdb/source.c b/gdb/source.c index 14dda01..abe4c6c 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -238,8 +238,6 @@ clear_current_source_symtab_and_line (void) void select_source_symtab (struct symtab *s) { - struct objfile *ofp; - if (s) { current_source_symtab = s; @@ -271,16 +269,22 @@ select_source_symtab (struct symtab *s) current_source_line = 1; - ALL_FILETABS (ofp, cu, symtab) + for (objfile *ofp : all_objfiles (current_program_space)) { - const char *name = symtab->filename; - int len = strlen (name); - - if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 - || strcmp (name, "<<C++-namespaces>>") == 0))) + for (compunit_symtab *cu : objfile_compunits (ofp)) { - current_source_pspace = current_program_space; - current_source_symtab = symtab; + for (symtab *symtab : compunit_filetabs (cu)) + { + const char *name = symtab->filename; + int len = strlen (name); + + if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 + || strcmp (name, "<<C++-namespaces>>") == 0))) + { + current_source_pspace = current_program_space; + current_source_symtab = symtab; + } + } } } |