aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
AgeCommit message (Collapse)AuthorFilesLines
2021-10-18CTF: incorrect underlying type setting for enumeration typesWeimin Pan1-0/+26
A bug was filed against the incorrect underlying type setting for an enumeration type, which was caused by a copy and paste error. This patch fixes the problem by setting it by calling objfile_int_type, which was originally dwarf2_per_objfile::int_type, with ctf_type_size bits. Also add error checking on ctf_func_type_info call.
2021-06-28gdb: convert obj_section macros to methodsSimon Marchi1-14/+13
Convert these three macros to methods of obj_section. The problem fixed by the following patch is caused by an out of bound access of the objfile::section_offsets vector. Since this is deep in macros, we don't get a clear backtrace and it's difficult to debug. Changing that to methods means we can step in them and break on them. Because their implementation requires knowing about struct objfile, move struct obj_section below struct objfile in objfiles.h. The obj_section_offset was used in one place as an lvalue to set offsets, in machoread.c. Replace that with a set_offset method. Add the objfile::section_offset and objfile::set_section_offset methods to improve encapsulation (reduce other objects poking into struct objfile's internals). gdb/ChangeLog: * objfiles.h (struct obj_section): Move down. <offset, set_offset, addr, endaddr>: New. (obj_section_offset, obj_section_addr, obj_section_endaddr), replace all users to use obj_section methods. (struct objfile) <section_offset, set_section_offset>: New. Change-Id: I97e8fcae93ab2353fbdadcb4a5ec10d7949a7334
2021-04-02gdb: remove objfile parameter from get_objfile_bfd_dataSimon Marchi1-6/+4
I noticed it was unused. I think that makes sense, as it shows that objfile_per_bfd_storage is not specific to one objfile (it can be shared by multiple objfiles that have the same bfd). There is one thing I wonder though, maybe I'm missing something. If the BFD doesn't require relocation, get_objfile_bfd_data stores the newly allocated object in objfiles_bfd_data, so we can assume that objfiles_bfd_data is the owner of the object. When the bfd's refcount drops to 0, the corresponding objfile_per_bfd_storage object in objfiles_bfd_data is deleted. But if the BFD requires relocation, get_objfile_bfd_data returns a newly allocated object that isn't kept anywhere else (and isn't shared). So the objfile becomes the owner of the objfile_per_bfd_storage object. In objfile::~objfile, we have this: if (obfd) gdb_bfd_unref (obfd); else delete per_bfd; I'm thinking that obfd could be non-nullptr, and it could require relocation. In that case, it would never be freed. Anyway, that's not really connected to this patch. gdb/ChangeLog: * objfiles.c (get_objfile_bfd_data): Remove objfile parameter, adjust callers. Change-Id: Ifa3158074ea6b42686780ba09d0c964b0cf14cf1
2021-04-02gdb: pass objfile_per_bfd_storage instead of objfile to partial_symtabSimon Marchi1-1/+1
Since partial_symtab is supposed to be objfile-independent (since series [1]), I think it would make sense for partial_symtab to not take an objfile as a parameter in its constructor. This patch replaces that parameter with an objfile_per_bfd_storage parameter. The objfile is used for two things: - to get the objfile_name, for debug messages. We can get that name from the bfd instead. - to intern the partial symtab filename. Even though it goes through an objfile method, the request is actually forwarded to the underlying objfile_per_bfd_storage. So we can ask the new objfile_per_bfd_storage instead. In order to get a reference to the BFD from the objfile_per_bfd_storage, the BFD is saved in the objfile_per_bfd_storage object. [1] https://sourceware.org/pipermail/gdb-patches/2021-February/176625.html gdb/ChangeLog: * psympriv.h (struct partial_symtab) <partial_symtab>: Change objfile parameter for objfile_per_bfd_storage, adjust callers. (struct standard_psymtab) <standard_psymtab>: Likewise. (struct legacy_psymtab) <legacy_psymtab>: Likewise. * psymtab.c (partial_symtab::partial_symtab): Likewise. * ctfread.c (struct ctf_psymtab): Likewise. * dwarf2/read.h (struct dwarf2_psymtab): Likewise. * dwarf2/read.c (struct dwarf2_include_psymtab): Likewise. (dwarf2_create_include_psymtab): Likewise. * objfiles.h (struct objfile_per_bfd_storage) <objfile_per_bfd_storage>: Add bfd parameter, adjust callers. <get_bfd>: New method. <m_bfd>: New field. * objfiles.c (get_objfile_bfd_data): Adjust. Change-Id: I2ed3ab5d2e6f27d034bd4dc26ae2fae7b0b8a2b9
2021-03-20Switch objfile to hold a list of psymbol readersTom Tromey1-2/+2
This changes objfile::qf to be a forward_list, and then updates all the uses to iterate over the list. Note that there is still only ever a single element in the list; this is handled by clearing the list whenever an object is added. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * dwarf2/read.c (dwarf2_build_psymtabs): Update. * symfile.c (syms_from_objfile_1, reread_symbols): Update. * symfile-debug.c (objfile::has_partial_symbols) (objfile::find_last_source_symtab) (objfile::forget_cached_source_info) (objfile::map_symtabs_matching_filename, objfile::lookup_symbol) (objfile::print_stats, objfile::dump) (objfile::expand_symtabs_for_function) (objfile::expand_all_symtabs) (objfile::expand_symtabs_with_fullname) (objfile::map_matching_symbols) (objfile::expand_symtabs_matching) (objfile::find_pc_sect_compunit_symtab) (objfile::map_symbol_filenames) (objfile::find_compunit_symtab_by_address) (objfile::lookup_global_symbol_language) (objfile::require_partial_symbols): Update. * psymtab.c (maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * objfiles.h (struct objfile) <qf>: Now a forward_list. * objfiles.c (objfile_relocate1): Update. * elfread.c (elf_symfile_read): Update.
2021-03-20Rearrange psymtab_storage constructionTom Tromey1-1/+0
This changes objfile so that it doesn't construct a psymtab_storage object until the psymtab functions are installed. It also applies a similar treatment to reread_symbols. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * symfile.c (syms_from_objfile_1): Call reset_psymtabs. (reread_symbols): Move reset_psymtabs call later. * objfiles.c (objfile::objfile): Don't initialize partial_symtabs.
2021-03-20Move psymbol_map out of objfileTom Tromey1-3/+3
objfile::psymbol_map is used to implement a Rust feature. It is currently specific to partial symbols -- it isn't used by the DWARF indices. This patch moves it out of objfile and into psymbol_functions, adding a new method to quick_symbol_functions to handle the clearing case. This is needed because the map holds unrelocated addresses. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * quick-symbol.h (struct quick_symbol_functions) <relocated>: New method. * psymtab.h (struct psymbol_functions) <relocated>: New method. <fill_psymbol_map>: Declare method. <m_psymbol_map>: New member. * psymtab.c (psymbol_functions::fill_psymbol_map): Rename. (psymbol_functions::find_compunit_symtab_by_address): Update. * objfiles.h (reset_psymtabs): Don't clear psymbol_map. (struct objfile) <psymbol_map>: Remove. * objfiles.c (objfile_relocate1): Update.
2021-03-20Introduce method wrappers for quick_symbol_functionsTom Tromey1-19/+0
This introduces wrappers for each function in quick_symbol_functions. The wrappers are methods on objfile, and are defined in symfile-debug.c, so that they can use the symfile_debug variable. Places that call the quick functions are all updated to call these new wrapper methods. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * symtab.c (iterate_over_symtabs, expand_symtab_containing_pc) (lookup_symbol_via_quick_fns, find_quick_global_symbol_language) (basic_lookup_transparent_type_quick) (find_pc_sect_compunit_symtab, find_symbol_at_address) (find_line_symtab, global_symbol_searcher::expand_symtabs): Update. * symmisc.c (print_objfile_statistics, dump_objfile) (maintenance_expand_symtabs): Update. * symfile.c (symbol_file_add_with_addrs) (expand_symtabs_matching, map_symbol_filenames): Update. * symfile-debug.c (objfile::has_partial_symbols) (objfile::find_last_source_symtab) (objfile::forget_cached_source_info) (objfile::map_symtabs_matching_filename, objfile::lookup_symbol) (objfile::print_stats, objfile::dump) (objfile::expand_symtabs_for_function) (objfile::expand_all_symtabs) (objfile::expand_symtabs_with_fullname) (objfile::map_matching_symbols) (objfile::expand_symtabs_matching) (objfile::find_pc_sect_compunit_symtab) (objfile::map_symbol_filenames) (objfile::find_compunit_symtab_by_address) (objfile::lookup_global_symbol_language): New methods. (debug_sym_quick_functions): Remove. (debug_sym_fns, install_symfile_debug_logging): Update. * source.c (forget_cached_source_info_for_objfile) (select_source_symtab): Update. * objfiles.h (struct objfile): Add methods corresponding to quick_symbol_functions. * objfiles.c (objfile::has_partial_symbols): Move to symfile-debug.c. * linespec.c (iterate_over_all_matching_symtabs): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * ada-lang.c (add_nonlocal_symbols): Update.
2021-03-20Change objfile::has_partial_symbols to return boolTom Tromey1-3/+3
This changes objfile::has_partial_symbols and quick_symbol_functions::has_symbols to return bool. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * objfiles.h (struct objfile) <has_partial_symbols>: Return bool. * symfile.h (struct quick_symbol_functions) <has_symbols>: Return bool. * symfile-debug.c (debug_qf_has_symbols): Return bool. * psymtab.c (psym_has_symbols): Return bool. * objfiles.c (objfile::has_partial_symbols): Return bool. * dwarf2/read.c (dw2_has_symbols): Return bool.
2021-03-20Change objfile_has_partial_symbols to a methodTom Tromey1-8/+8
This changes objfile_has_partial_symbols to be a method on objfile. There are some other functions that could benefit from this sort of change, but this was the only one that was relevant to this series. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * symfile.c (read_symbols): Update. * objfiles.h (struct objfile) <has_partial_symbols>: New method. (objfile_has_partial_symbols): Don't declare. * objfiles.c (objfile::has_partial_symbols): Rename from objfile_has_partial_symbols. (objfile_has_symbols, have_partial_symbols): Update. * elfread.c (elf_symfile_read): Update. * dwarf2/read.c (dwarf2_has_info): Update. * coffread.c (coff_symfile_read): Update.
2021-02-10gdb: delete SYMBOL_SECTION and MSYMBOL_SECTION macrosAndrew Burgess1-2/+2
Delete two more symbol/section related macros. This time it's SYMBOL_SECTION and MSYMBOL_SECTION. As with general_symbol_info::m_name it is not currently possible to make general_symbol_info::m_section private as general_symbol_info must remain a POD type. But other than failing to make the new m_section private, this change does what you'd expect, adds a get and set member function and updates all users to use the new functions instead of the previous wrapper macros. There should be no user visible change after this commit. gdb/ChangeLog: * coff-pe-read.c (add_pe_forwarded_sym): Make use of section_index and set_section_index member functions where appropriate. * coffread.c (coff_symtab_read): Likewise. (process_coff_symbol): Likewise. * ctfread.c (set_symbol_address): Likewise. * dwarf2/read.c (add_partial_symbol): Likewise. (var_decode_location): Likewise. * language.c: Likewise. * minsyms.c (minimal_symbol_reader::record_full): Likewise. (compact_minimal_symbols): Likewise. (minimal_symbol_upper_bound): Likewise. * objfiles.c (relocate_one_symbol): Likewise. * psympriv.h (partial_symbol::obj_section): Likewise. (partial_symbol::address): Likewise. * psymtab.c (partial_symtab::add_psymbol): Likewise. * stabsread.c (scan_file_globals): Likewise. * symmisc.c (dump_msymbols): Likewise. * symtab.c (general_symbol_info::obj_section): Likewise. (fixup_section): Likewise. (get_msymbol_address): Likewise. * symtab.h (general_symbol_info::section): Rename to... (general_symbol_info::m_section): ...this. (general_symbol_info::set_section_index): New member function. (general_symbol_info::section_index): Likewise. (SYMBOL_SECTION): Delete. (MSYMBOL_VALUE_ADDRESS): Make use of section_index and set_section_index member functions where appropriate. (MSYMBOL_SECTION): Delete. (symbol::symbol): Update to initialize 'm_section'. * xcoffread.c (read_xcoff_symtab): Make use of set_section_index. (process_xcoff_symbol): Likewise.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-11-02gdb, gdbserver, gdbsupport: fix leading space vs tabs issuesSimon Marchi1-20/+20
Many spots incorrectly use only spaces for indentation (for example, there are a lot of spots in ada-lang.c). I've always found it awkward when I needed to edit one of these spots: do I keep the original wrong indentation, or do I fix it? What if the lines around it are also wrong, do I fix them too? I probably don't want to fix them in the same patch, to avoid adding noise to my patch. So I propose to fix as much as possible once and for all (hopefully). One typical counter argument for this is that it makes code archeology more difficult, because git-blame will show this commit as the last change for these lines. My counter counter argument is: when git-blaming, you often need to do "blame the file at the parent commit" anyway, to go past some other refactor that touched the line you are interested in, but is not the change you are looking for. So you already need a somewhat efficient way to do this. Using some interactive tool, rather than plain git-blame, makes this trivial. For example, I use "tig blame <file>", where going back past the commit that changed the currently selected line is one keystroke. It looks like Magit in Emacs does it too (though I've never used it). Web viewers of Github and Gitlab do it too. My point is that it won't really make archeology more difficult. The other typical counter argument is that it will cause conflicts with existing patches. That's true... but it's a one time cost, and those are not conflicts that are difficult to resolve. I have also tried "git rebase --ignore-whitespace", it seems to work well. Although that will re-introduce the faulty indentation, so one needs to take care of fixing the indentation in the patch after that (which is easy). gdb/ChangeLog: * aarch64-linux-tdep.c: Fix indentation. * aarch64-ravenscar-thread.c: Fix indentation. * aarch64-tdep.c: Fix indentation. * aarch64-tdep.h: Fix indentation. * ada-lang.c: Fix indentation. * ada-lang.h: Fix indentation. * ada-tasks.c: Fix indentation. * ada-typeprint.c: Fix indentation. * ada-valprint.c: Fix indentation. * ada-varobj.c: Fix indentation. * addrmap.c: Fix indentation. * addrmap.h: Fix indentation. * agent.c: Fix indentation. * aix-thread.c: Fix indentation. * alpha-bsd-nat.c: Fix indentation. * alpha-linux-tdep.c: Fix indentation. * alpha-mdebug-tdep.c: Fix indentation. * alpha-nbsd-tdep.c: Fix indentation. * alpha-obsd-tdep.c: Fix indentation. * alpha-tdep.c: Fix indentation. * amd64-bsd-nat.c: Fix indentation. * amd64-darwin-tdep.c: Fix indentation. * amd64-linux-nat.c: Fix indentation. * amd64-linux-tdep.c: Fix indentation. * amd64-nat.c: Fix indentation. * amd64-obsd-tdep.c: Fix indentation. * amd64-tdep.c: Fix indentation. * amd64-windows-tdep.c: Fix indentation. * annotate.c: Fix indentation. * arc-tdep.c: Fix indentation. * arch-utils.c: Fix indentation. * arch/arm-get-next-pcs.c: Fix indentation. * arch/arm.c: Fix indentation. * arm-linux-nat.c: Fix indentation. * arm-linux-tdep.c: Fix indentation. * arm-nbsd-tdep.c: Fix indentation. * arm-pikeos-tdep.c: Fix indentation. * arm-tdep.c: Fix indentation. * arm-tdep.h: Fix indentation. * arm-wince-tdep.c: Fix indentation. * auto-load.c: Fix indentation. * auxv.c: Fix indentation. * avr-tdep.c: Fix indentation. * ax-gdb.c: Fix indentation. * ax-general.c: Fix indentation. * bfin-linux-tdep.c: Fix indentation. * block.c: Fix indentation. * block.h: Fix indentation. * blockframe.c: Fix indentation. * bpf-tdep.c: Fix indentation. * break-catch-sig.c: Fix indentation. * break-catch-syscall.c: Fix indentation. * break-catch-throw.c: Fix indentation. * breakpoint.c: Fix indentation. * breakpoint.h: Fix indentation. * bsd-uthread.c: Fix indentation. * btrace.c: Fix indentation. * build-id.c: Fix indentation. * buildsym-legacy.h: Fix indentation. * buildsym.c: Fix indentation. * c-typeprint.c: Fix indentation. * c-valprint.c: Fix indentation. * c-varobj.c: Fix indentation. * charset.c: Fix indentation. * cli/cli-cmds.c: Fix indentation. * cli/cli-decode.c: Fix indentation. * cli/cli-decode.h: Fix indentation. * cli/cli-script.c: Fix indentation. * cli/cli-setshow.c: Fix indentation. * coff-pe-read.c: Fix indentation. * coffread.c: Fix indentation. * compile/compile-cplus-types.c: Fix indentation. * compile/compile-object-load.c: Fix indentation. * compile/compile-object-run.c: Fix indentation. * completer.c: Fix indentation. * corefile.c: Fix indentation. * corelow.c: Fix indentation. * cp-abi.h: Fix indentation. * cp-namespace.c: Fix indentation. * cp-support.c: Fix indentation. * cp-valprint.c: Fix indentation. * cris-linux-tdep.c: Fix indentation. * cris-tdep.c: Fix indentation. * darwin-nat-info.c: Fix indentation. * darwin-nat.c: Fix indentation. * darwin-nat.h: Fix indentation. * dbxread.c: Fix indentation. * dcache.c: Fix indentation. * disasm.c: Fix indentation. * dtrace-probe.c: Fix indentation. * dwarf2/abbrev.c: Fix indentation. * dwarf2/attribute.c: Fix indentation. * dwarf2/expr.c: Fix indentation. * dwarf2/frame.c: Fix indentation. * dwarf2/index-cache.c: Fix indentation. * dwarf2/index-write.c: Fix indentation. * dwarf2/line-header.c: Fix indentation. * dwarf2/loc.c: Fix indentation. * dwarf2/macro.c: Fix indentation. * dwarf2/read.c: Fix indentation. * dwarf2/read.h: Fix indentation. * elfread.c: Fix indentation. * eval.c: Fix indentation. * event-top.c: Fix indentation. * exec.c: Fix indentation. * exec.h: Fix indentation. * expprint.c: Fix indentation. * f-lang.c: Fix indentation. * f-typeprint.c: Fix indentation. * f-valprint.c: Fix indentation. * fbsd-nat.c: Fix indentation. * fbsd-tdep.c: Fix indentation. * findvar.c: Fix indentation. * fork-child.c: Fix indentation. * frame-unwind.c: Fix indentation. * frame-unwind.h: Fix indentation. * frame.c: Fix indentation. * frv-linux-tdep.c: Fix indentation. * frv-tdep.c: Fix indentation. * frv-tdep.h: Fix indentation. * ft32-tdep.c: Fix indentation. * gcore.c: Fix indentation. * gdb_bfd.c: Fix indentation. * gdbarch.sh: Fix indentation. * gdbarch.c: Re-generate * gdbarch.h: Re-generate. * gdbcore.h: Fix indentation. * gdbthread.h: Fix indentation. * gdbtypes.c: Fix indentation. * gdbtypes.h: Fix indentation. * glibc-tdep.c: Fix indentation. * gnu-nat.c: Fix indentation. * gnu-nat.h: Fix indentation. * gnu-v2-abi.c: Fix indentation. * gnu-v3-abi.c: Fix indentation. * go32-nat.c: Fix indentation. * guile/guile-internal.h: Fix indentation. * guile/scm-cmd.c: Fix indentation. * guile/scm-frame.c: Fix indentation. * guile/scm-iterator.c: Fix indentation. * guile/scm-math.c: Fix indentation. * guile/scm-ports.c: Fix indentation. * guile/scm-pretty-print.c: Fix indentation. * guile/scm-value.c: Fix indentation. * h8300-tdep.c: Fix indentation. * hppa-linux-nat.c: Fix indentation. * hppa-linux-tdep.c: Fix indentation. * hppa-nbsd-nat.c: Fix indentation. * hppa-nbsd-tdep.c: Fix indentation. * hppa-obsd-nat.c: Fix indentation. * hppa-tdep.c: Fix indentation. * hppa-tdep.h: Fix indentation. * i386-bsd-nat.c: Fix indentation. * i386-darwin-nat.c: Fix indentation. * i386-darwin-tdep.c: Fix indentation. * i386-dicos-tdep.c: Fix indentation. * i386-gnu-nat.c: Fix indentation. * i386-linux-nat.c: Fix indentation. * i386-linux-tdep.c: Fix indentation. * i386-nto-tdep.c: Fix indentation. * i386-obsd-tdep.c: Fix indentation. * i386-sol2-nat.c: Fix indentation. * i386-tdep.c: Fix indentation. * i386-tdep.h: Fix indentation. * i386-windows-tdep.c: Fix indentation. * i387-tdep.c: Fix indentation. * i387-tdep.h: Fix indentation. * ia64-libunwind-tdep.c: Fix indentation. * ia64-libunwind-tdep.h: Fix indentation. * ia64-linux-nat.c: Fix indentation. * ia64-linux-tdep.c: Fix indentation. * ia64-tdep.c: Fix indentation. * ia64-tdep.h: Fix indentation. * ia64-vms-tdep.c: Fix indentation. * infcall.c: Fix indentation. * infcmd.c: Fix indentation. * inferior.c: Fix indentation. * infrun.c: Fix indentation. * iq2000-tdep.c: Fix indentation. * language.c: Fix indentation. * linespec.c: Fix indentation. * linux-fork.c: Fix indentation. * linux-nat.c: Fix indentation. * linux-tdep.c: Fix indentation. * linux-thread-db.c: Fix indentation. * lm32-tdep.c: Fix indentation. * m2-lang.c: Fix indentation. * m2-typeprint.c: Fix indentation. * m2-valprint.c: Fix indentation. * m32c-tdep.c: Fix indentation. * m32r-linux-tdep.c: Fix indentation. * m32r-tdep.c: Fix indentation. * m68hc11-tdep.c: Fix indentation. * m68k-bsd-nat.c: Fix indentation. * m68k-linux-nat.c: Fix indentation. * m68k-linux-tdep.c: Fix indentation. * m68k-tdep.c: Fix indentation. * machoread.c: Fix indentation. * macrocmd.c: Fix indentation. * macroexp.c: Fix indentation. * macroscope.c: Fix indentation. * macrotab.c: Fix indentation. * macrotab.h: Fix indentation. * main.c: Fix indentation. * mdebugread.c: Fix indentation. * mep-tdep.c: Fix indentation. * mi/mi-cmd-catch.c: Fix indentation. * mi/mi-cmd-disas.c: Fix indentation. * mi/mi-cmd-env.c: Fix indentation. * mi/mi-cmd-stack.c: Fix indentation. * mi/mi-cmd-var.c: Fix indentation. * mi/mi-cmds.c: Fix indentation. * mi/mi-main.c: Fix indentation. * mi/mi-parse.c: Fix indentation. * microblaze-tdep.c: Fix indentation. * minidebug.c: Fix indentation. * minsyms.c: Fix indentation. * mips-linux-nat.c: Fix indentation. * mips-linux-tdep.c: Fix indentation. * mips-nbsd-tdep.c: Fix indentation. * mips-tdep.c: Fix indentation. * mn10300-linux-tdep.c: Fix indentation. * mn10300-tdep.c: Fix indentation. * moxie-tdep.c: Fix indentation. * msp430-tdep.c: Fix indentation. * namespace.h: Fix indentation. * nat/fork-inferior.c: Fix indentation. * nat/gdb_ptrace.h: Fix indentation. * nat/linux-namespaces.c: Fix indentation. * nat/linux-osdata.c: Fix indentation. * nat/netbsd-nat.c: Fix indentation. * nat/x86-dregs.c: Fix indentation. * nbsd-nat.c: Fix indentation. * nbsd-tdep.c: Fix indentation. * nios2-linux-tdep.c: Fix indentation. * nios2-tdep.c: Fix indentation. * nto-procfs.c: Fix indentation. * nto-tdep.c: Fix indentation. * objfiles.c: Fix indentation. * objfiles.h: Fix indentation. * opencl-lang.c: Fix indentation. * or1k-tdep.c: Fix indentation. * osabi.c: Fix indentation. * osabi.h: Fix indentation. * osdata.c: Fix indentation. * p-lang.c: Fix indentation. * p-typeprint.c: Fix indentation. * p-valprint.c: Fix indentation. * parse.c: Fix indentation. * ppc-linux-nat.c: Fix indentation. * ppc-linux-tdep.c: Fix indentation. * ppc-nbsd-nat.c: Fix indentation. * ppc-nbsd-tdep.c: Fix indentation. * ppc-obsd-nat.c: Fix indentation. * ppc-ravenscar-thread.c: Fix indentation. * ppc-sysv-tdep.c: Fix indentation. * ppc64-tdep.c: Fix indentation. * printcmd.c: Fix indentation. * proc-api.c: Fix indentation. * producer.c: Fix indentation. * producer.h: Fix indentation. * prologue-value.c: Fix indentation. * prologue-value.h: Fix indentation. * psymtab.c: Fix indentation. * python/py-arch.c: Fix indentation. * python/py-bpevent.c: Fix indentation. * python/py-event.c: Fix indentation. * python/py-event.h: Fix indentation. * python/py-finishbreakpoint.c: Fix indentation. * python/py-frame.c: Fix indentation. * python/py-framefilter.c: Fix indentation. * python/py-inferior.c: Fix indentation. * python/py-infthread.c: Fix indentation. * python/py-objfile.c: Fix indentation. * python/py-prettyprint.c: Fix indentation. * python/py-registers.c: Fix indentation. * python/py-signalevent.c: Fix indentation. * python/py-stopevent.c: Fix indentation. * python/py-stopevent.h: Fix indentation. * python/py-threadevent.c: Fix indentation. * python/py-tui.c: Fix indentation. * python/py-unwind.c: Fix indentation. * python/py-value.c: Fix indentation. * python/py-xmethods.c: Fix indentation. * python/python-internal.h: Fix indentation. * python/python.c: Fix indentation. * ravenscar-thread.c: Fix indentation. * record-btrace.c: Fix indentation. * record-full.c: Fix indentation. * record.c: Fix indentation. * reggroups.c: Fix indentation. * regset.h: Fix indentation. * remote-fileio.c: Fix indentation. * remote.c: Fix indentation. * reverse.c: Fix indentation. * riscv-linux-tdep.c: Fix indentation. * riscv-ravenscar-thread.c: Fix indentation. * riscv-tdep.c: Fix indentation. * rl78-tdep.c: Fix indentation. * rs6000-aix-tdep.c: Fix indentation. * rs6000-lynx178-tdep.c: Fix indentation. * rs6000-nat.c: Fix indentation. * rs6000-tdep.c: Fix indentation. * rust-lang.c: Fix indentation. * rx-tdep.c: Fix indentation. * s12z-tdep.c: Fix indentation. * s390-linux-tdep.c: Fix indentation. * score-tdep.c: Fix indentation. * ser-base.c: Fix indentation. * ser-mingw.c: Fix indentation. * ser-uds.c: Fix indentation. * ser-unix.c: Fix indentation. * serial.c: Fix indentation. * sh-linux-tdep.c: Fix indentation. * sh-nbsd-tdep.c: Fix indentation. * sh-tdep.c: Fix indentation. * skip.c: Fix indentation. * sol-thread.c: Fix indentation. * solib-aix.c: Fix indentation. * solib-darwin.c: Fix indentation. * solib-frv.c: Fix indentation. * solib-svr4.c: Fix indentation. * solib.c: Fix indentation. * source.c: Fix indentation. * sparc-linux-tdep.c: Fix indentation. * sparc-nbsd-tdep.c: Fix indentation. * sparc-obsd-tdep.c: Fix indentation. * sparc-ravenscar-thread.c: Fix indentation. * sparc-tdep.c: Fix indentation. * sparc64-linux-tdep.c: Fix indentation. * sparc64-nbsd-tdep.c: Fix indentation. * sparc64-obsd-tdep.c: Fix indentation. * sparc64-tdep.c: Fix indentation. * stabsread.c: Fix indentation. * stack.c: Fix indentation. * stap-probe.c: Fix indentation. * stubs/ia64vms-stub.c: Fix indentation. * stubs/m32r-stub.c: Fix indentation. * stubs/m68k-stub.c: Fix indentation. * stubs/sh-stub.c: Fix indentation. * stubs/sparc-stub.c: Fix indentation. * symfile-mem.c: Fix indentation. * symfile.c: Fix indentation. * symfile.h: Fix indentation. * symmisc.c: Fix indentation. * symtab.c: Fix indentation. * symtab.h: Fix indentation. * target-float.c: Fix indentation. * target.c: Fix indentation. * target.h: Fix indentation. * tic6x-tdep.c: Fix indentation. * tilegx-linux-tdep.c: Fix indentation. * tilegx-tdep.c: Fix indentation. * top.c: Fix indentation. * tracefile-tfile.c: Fix indentation. * tracepoint.c: Fix indentation. * tui/tui-disasm.c: Fix indentation. * tui/tui-io.c: Fix indentation. * tui/tui-regs.c: Fix indentation. * tui/tui-stack.c: Fix indentation. * tui/tui-win.c: Fix indentation. * tui/tui-winsource.c: Fix indentation. * tui/tui.c: Fix indentation. * typeprint.c: Fix indentation. * ui-out.h: Fix indentation. * unittests/copy_bitwise-selftests.c: Fix indentation. * unittests/memory-map-selftests.c: Fix indentation. * utils.c: Fix indentation. * v850-tdep.c: Fix indentation. * valarith.c: Fix indentation. * valops.c: Fix indentation. * valprint.c: Fix indentation. * valprint.h: Fix indentation. * value.c: Fix indentation. * value.h: Fix indentation. * varobj.c: Fix indentation. * vax-tdep.c: Fix indentation. * windows-nat.c: Fix indentation. * windows-tdep.c: Fix indentation. * xcoffread.c: Fix indentation. * xml-syscall.c: Fix indentation. * xml-tdesc.c: Fix indentation. * xstormy16-tdep.c: Fix indentation. * xtensa-config.c: Fix indentation. * xtensa-linux-nat.c: Fix indentation. * xtensa-linux-tdep.c: Fix indentation. * xtensa-tdep.c: Fix indentation. gdbserver/ChangeLog: * ax.cc: Fix indentation. * dll.cc: Fix indentation. * inferiors.h: Fix indentation. * linux-low.cc: Fix indentation. * linux-nios2-low.cc: Fix indentation. * linux-ppc-ipa.cc: Fix indentation. * linux-ppc-low.cc: Fix indentation. * linux-x86-low.cc: Fix indentation. * linux-xtensa-low.cc: Fix indentation. * regcache.cc: Fix indentation. * server.cc: Fix indentation. * tracepoint.cc: Fix indentation. gdbsupport/ChangeLog: * common-exceptions.h: Fix indentation. * event-loop.cc: Fix indentation. * fileio.cc: Fix indentation. * filestuff.cc: Fix indentation. * gdb-dlfcn.cc: Fix indentation. * gdb_string_view.h: Fix indentation. * job-control.cc: Fix indentation. * signals.cc: Fix indentation. Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-10-29Remove symfile_objfile macroTom Tromey1-4/+4
This removes the symfile_objfile macro, in favor of just spelling out the member access. gdb/ChangeLog 2020-10-29 Tom Tromey <tom@tromey.com> * windows-tdep.c (windows_solib_create_inferior_hook): Update. * target.c (info_target_command): Update. * symfile.c (syms_from_objfile_1, finish_new_objfile) (symbol_file_clear, reread_symbols): Update. * symfile-mem.c (add_symbol_file_from_memory_command): Update. * stabsread.c (scan_file_globals): Update. * solib.c (update_solib_list): Update. * solib-svr4.c (elf_locate_base, open_symbol_file_object) (svr4_fetch_objfile_link_map, enable_break) (svr4_relocate_main_executable) (svr4_iterate_over_objfiles_in_search_order): Update. * solib-frv.c (lm_base, enable_break) (frv_relocate_main_executable): Update. (main_got, frv_fdpic_find_canonical_descriptor): Update. (frv_fetch_objfile_link_map): Update. * solib-dsbt.c (lm_base, dsbt_relocate_main_executable): Update. * solib-darwin.c (darwin_solib_create_inferior_hook): Update. * solib-aix.c (solib_aix_solib_create_inferior_hook): Update. * remote.c (remote_target::get_offsets): Update. (remote_target::start_remote) (extended_remote_target::post_attach): Update. * objfiles.c (entry_point_address_query): Update. * nto-procfs.c (nto_procfs_target::create_inferior): Update. * minsyms.c (get_symbol_leading_char): Update. * frame.c (inside_main_func): Update. * progspace.h (symfile_objfile): Remove macro.
2020-09-19Use gdb_bfd_sections in build_objfile_section_tableTom Tromey1-18/+11
This changes build_objfile_section_table to avoid bfd_map_over_sections, in favor of iteration. gdb/ChangeLog 2020-09-19 Tom Tromey <tom@tromey.com> * objfiles.c (add_to_objfile_sections): Rename from add_to_objfile_sections_full. (add_to_objfile_sections): Remove. (build_objfile_section_table): Use foreach.
2020-05-12gdb: make two objfile functions return boolSimon Marchi1-9/+10
gdb/ChangeLog: * objfiles.h (is_addr_in_objfile, shared_objfile_contains_address_p): Return bool. * objfile.c (is_addr_in_objfile, shared_objfile_contains_address_p): Return bool.
2020-04-18Change get_objfile_arch to a method on objfileTom Tromey1-9/+1
This changes get_objfile_arch to be a new inline method, objfile::arch. To my surprise, this function came up while profiling DWARF psymbol reading. Making this change improved performance from 1.986 seconds to 1.869 seconds. Both measurements were done by taking the mean of 10 runs on a fixed copy of the gdb executable. gdb/ChangeLog 2020-04-18 Tom Tromey <tom@tromey.com> * xcoffread.c (enter_line_range, scan_xcoff_symtab): Update. * value.c (value_fn_field): Update. * valops.c (find_function_in_inferior) (value_allocate_space_in_inferior): Update. * tui/tui-winsource.c (tui_update_source_windows_with_line): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * symtab.c (lookup_global_or_static_symbol) (find_function_start_sal_1, skip_prologue_sal) (print_msymbol_info, find_gnu_ifunc, symbol_arch): Update. * symmisc.c (dump_msymbols, dump_symtab_1) (maintenance_print_one_line_table): Update. * symfile.c (init_entry_point_info, section_is_mapped) (list_overlays_command, simple_read_overlay_table) (simple_overlay_update_1): Update. * stap-probe.c (handle_stap_probe): Update. * stabsread.c (dbx_init_float_type, define_symbol) (read_one_struct_field, read_enum_type, read_range_type): Update. * source.c (info_line_command): Update. * python/python.c (gdbpy_source_objfile_script) (gdbpy_execute_objfile_script): Update. * python/py-type.c (save_objfile_types): Update. * python/py-objfile.c (py_free_objfile): Update. * python/py-inferior.c (python_new_objfile): Update. * psymtab.c (psym_find_pc_sect_compunit_symtab, dump_psymtab) (dump_psymtab_addrmap_1, maintenance_info_psymtabs) (maintenance_check_psymtabs): Update. * printcmd.c (info_address_command): Update. * objfiles.h (struct objfile) <arch>: New method, from get_objfile_arch. (get_objfile_arch): Don't declare. * objfiles.c (get_objfile_arch): Remove. (filter_overlapping_sections): Update. * minsyms.c (msymbol_is_function): Update. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines) (output_nondebug_symbol): Update. * mdebugread.c (parse_symbol, basic_type, parse_partial_symbols) (mdebug_expand_psymtab): Update. * machoread.c (macho_add_oso_symfile): Update. * linux-tdep.c (linux_infcall_mmap, linux_infcall_munmap): Update. * linux-fork.c (checkpoint_command): Update. * linespec.c (convert_linespec_to_sals): Update. * jit.c (finalize_symtab): Update. * infrun.c (insert_exception_resume_from_probe): Update. * ia64-tdep.c (ia64_find_unwind_table): Update. * hppa-tdep.c (internalize_unwinds): Update. * gdbtypes.c (get_type_arch, init_float_type, objfile_type): Update. * gcore.c (call_target_sbrk): Update. * elfread.c (record_minimal_symbol, elf_symtab_read) (elf_rel_plt_read, elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2/read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab) (read_debug_names_from_section) (process_psymtab_comp_unit_reader, add_partial_symbol) (add_partial_subprogram, process_full_comp_unit) (read_file_scope, read_func_scope, read_lexical_block_scope) (read_call_site_scope, dwarf2_ranges_read) (dwarf2_record_block_ranges, dwarf2_add_field) (mark_common_block_symbol_computed, read_tag_pointer_type) (read_tag_string_type, dwarf2_init_float_type) (dwarf2_init_complex_target_type, read_base_type) (partial_die_info::read, partial_die_info::read) (read_attribute_value, dwarf_decode_lines_1, new_symbol) (dwarf2_fetch_die_loc_sect_off): Update. * dwarf2/loc.c (dwarf2_find_location_expression) (class dwarf_evaluate_loc_desc, rw_pieced_value) (dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval) (dwarf2_loc_desc_get_symbol_read_needs) (locexpr_describe_location_piece, locexpr_describe_location_1) (loclist_describe_location): Update. * dwarf2/index-write.c (write_debug_names): Update. * dwarf2/frame.c (dwarf2_build_frame_info): Update. * dtrace-probe.c (dtrace_process_dof): Update. * dbxread.c (read_dbx_symtab, dbx_end_psymtab) (process_one_symbol): Update. * ctfread.c (ctf_init_float_type, read_base_type): Update. * coffread.c (coff_symtab_read, enter_linenos, decode_base_type) (coff_read_enum_type): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * buildsym.c (buildsym_compunit::finish_block_internal): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, get_sal_arch): Update. * block.c (block_gdbarch): Update. * annotate.c (annotate_source_line): Update.
2020-01-08Change section_offsets to a std::vectorTom Tromey1-41/+24
This changes section_offsets to be specialization of a std::vector and updates all the users. It also removes the ANOFFSET and SIZEOF_N_SECTION_OFFSETS macros. Most of this is just a generic sort of cleanup, that reduces the number of lines of code. However, a couple spots were doing weird things. objfile_relocate did: - std::vector<struct section_offsets> - new_debug_offsets (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections)); ... which seems to greatly over-estimate the number of elements needed. This appeared in set_objfile_default_section_offset: - std::vector<struct section_offsets> offsets (objf->num_sections, - { { offset } }); ... which makes sense due to type safety, but is also actively confusing given that section_offsets was previously also a kind of vector type. Tested on x86-64 Fedora 30. gdb/ChangeLog 2020-01-08 Tom Tromey <tromey@adacore.com> * xcoffread.c (enter_line_range, read_xcoff_symtab) (process_xcoff_symbol, xcoff_symfile_offsets): Update. * symtab.h (MSYMBOL_VALUE_ADDRESS): Update. (struct section_offsets, ANOFFSET, SIZEOF_N_SECTION_OFFSETS): Remove. (section_offsets): New typedef. * symtab.c (fixup_section, get_msymbol_address): Update. * symmisc.c (dump_msymbols): Update. * symfile.h (relative_addr_info_to_section_offsets) (symfile_map_offsets_to_segments): Update. * symfile.c (build_section_addr_info_from_objfile) (init_objfile_sect_indices): Update. (struct place_section_arg): Change type of "offsets". (place_section): Update. (relative_addr_info_to_section_offsets): Change type of "section_offsets". Remove "num_sections" parameter. (default_symfile_offsets, syms_from_objfile_1) (set_objfile_default_section_offset): Update. (reread_symbols): No need to preserve section offsets by hand. (symfile_map_offsets_to_segments): Change type of "offsets". * stap-probe.c (relocate_address): Update. * stabsread.h (process_one_symbol): Update. * solib-target.c (struct lm_info_target) <offsets>: Change type. (solib_target_relocate_section_addresses): Update. * solib-svr4.c (enable_break, svr4_relocate_main_executable): Update. * solib-frv.c (frv_relocate_main_executable): Update. * solib-dsbt.c (dsbt_relocate_main_executable): Update. * solib-aix.c (solib_aix_get_section_offsets): Change return type. (solib_aix_solib_create_inferior_hook): Update. * remote.c (remote_target::get_offsets): Update. * psymtab.c (find_pc_sect_psymtab): Update. * psympriv.h (struct partial_symbol) <address, text_low, text_high>: Update. * objfiles.h (obj_section_offset): Update. (struct objfile) <section_offsets>: Change type. <num_sections>: Remove. (objfile_relocate): Update. * objfiles.c (entry_point_address_query): Update (relocate_one_symbol): Change type of "section_offsets". (objfile_relocate1, objfile_relocate1): Change type of "new_offsets". (objfile_rebase1): Update. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Remove "section_offsets" parameter. * mdebugread.c (parse_symbol): Change type of "section_offsets". (parse_external, psymtab_to_symtab_1): Update. * machoread.c (macho_symfile_offsets): Update. * ia64-tdep.c (ia64_find_unwind_table): Update. * hppa-tdep.c (read_unwind_info): Update. * hppa-bsd-tdep.c (hppabsd_find_global_pointer): Update. * dwarf2read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab) (process_psymtab_comp_unit_reader, add_partial_symbol) (add_partial_subprogram, process_full_comp_unit) (read_file_scope, read_func_scope, read_lexical_block_scope) (read_call_site_scope, dwarf2_rnglists_process) (dwarf2_ranges_process, dwarf2_ranges_read) (dwarf_decode_lines_1, var_decode_location, new_symbol) (dwarf2_fetch_die_loc_sect_off, dwarf2_per_cu_text_offset): Update. * dwarf2-frame.c (execute_cfa_program, dwarf2_frame_find_fde): Update. * dtrace-probe.c (dtrace_probe::get_relocated_address): Update. * dbxread.c (read_dbx_symtab, read_ofile_symtab): Update. (process_one_symbol): Change type of "section_offsets". * ctfread.c (get_objfile_text_range): Update. * coffread.c (coff_symtab_read, enter_linenos) (process_coff_symbol): Update. * coff-pe-read.c (add_pe_forwarded_sym): Update. * amd64-windows-tdep.c (amd64_windows_find_unwind_info): Update. Change-Id: I147eb967e9b44d82f4048039de7bb44b80cd72fb
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-12-12Manage objfiles with shared_ptrTom Tromey1-2/+4
This changes objfiles to be managed using a shared_ptr. shared_ptr is chosen because it enables the use of objfiles in background threads. The simplest way to do this was to introduce a new iterator that will return the underlying objfile, rather than a shared_ptr. (I also tried changing the rest of gdb to use shared_ptr, but this was quite large; and to using intrusive reference counting, but this also was tricky.) gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * progspace.h (objfile_list): New typedef. (class unwrapping_objfile_iterator) (struct unwrapping_objfile_range): Newl (struct program_space) <objfiles_range>: Change type. <objfiles>: Change return type. <add_objfile>: Change type of "objfile" parameter. <objfiles_list>: Now a list of shared_ptr. * progspace.c (program_space::add_objfile): Change type of "objfile". Update. (program_space::remove_objfile): Update. * objfiles.h (struct objfile) <~objfile>: Make public. * objfiles.c (objfile::make): Update. (objfile::unlink): Don't call delete. Change-Id: I6fb7fbf06efb7cb7474c525908365863eae27eb3
2019-12-12Move free_all_objfiles to program_spaceTom Tromey1-15/+0
This changes free_all_objfiles to be a method on program_space, in line with the other changes to treat program_space as a container for objfiles. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * symfile.c (symbol_file_clear): Update. * progspace.h (struct program_space) <free_all_objfiles>: Declare method. * progspace.c (program_space::free_all_objfiles): New method. * objfiles.h (free_all_objfiles): Don't declare. * objfiles.c (free_all_objfiles): Move to program_space. Change-Id: I908b549d2981b6005f7ca181fc0e6d24fc8b7b6f
2019-12-12Store objfiles on a std::listTom Tromey1-0/+1
This removes objfile::next and changes objfiles to be stored in a std::list. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * progspace.c (program_space::add_objfile) (program_space::remove_objfile): Update. (program_space::multi_objfile_p): Remove. * objfiles.h (struct objfile) <next>: Remove. * objfiles.c (objfile::objfile): Update. (put_objfile_before): Update. (unlink_objfile): Update. * progspace.h (object_files): Remove. (struct program_space) <objfiles_head>: Remove. <objfiles_list>: New member. <objfiles_range, objfiles_safe_range>: Change type. (objfiles): Change return type. (objfiles_safe): Update. (multi_objfile_p): Rewrite and inline. (object_files): Remove macro. Change-Id: Ib4430e3db6f9a390399924379a5c10426c514853
2019-12-12Introduce program_space::remove_objfileTom Tromey1-28/+1
This introduces a new method, program_space::remove_objfile, and changes the objfile destructor not to unlink an objfile from the program space's list. This is cleaner because, like the previous patch, it treats the program space more like a container for objfiles. Also, this makes it possible to keep an objfile alive even though it has been unlinked from the program space's list, which is important for processing in a worker thread. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * progspace.h (struct program_space) <remove_objfile>: Declare. * progspace.c (program_space::remove_objfile): New method. * objfiles.c (unlink_objfile): Remove. (objfile::unlink): Call remove_objfile. (objfile): Don't call unlink_objfile. Change-Id: I22f768827723dce21886fae9b3664532c8349e68
2019-12-12Introduce program_space::add_objfileTom Tromey1-45/+6
This introduces a new method, program_space::add_objfile, that adds an objfile to the program space's list of objfiles. It also changes the obfile's constructor so that linking an objfile into this list is not done here. The former is an improvement because it makes more sense to treat the program space as a container holding objfiles -- so manipulation of the list belongs there. The latter is not strictly needed, but seemed better both because it is removing a global side effect from a constructor, and for symmetry reasons, as a subsequent patch will remove unlinking from the destructor. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * progspace.h (struct program_space) <add_objfile>: Declare method. * progspace.c (program_space::add_objfile): New method. * objfiles.c (~objfile): Don't unlink objfile. (put_objfile_before): Remove. (add_separate_debug_objfile): Don't call put_objfile_before. (objfile::make): Call add_objfile. Set new_objfiles_available on the per-program-space data. Change-Id: I93e8525dda631cb89dcc2046a5c51c7c9f34ccfd
2019-12-12Make the objfile destructor privateTom Tromey1-3/+11
The idea behind this is that, in the long run, some code will need to be able to hold onto an objfile after it is unlinked from the program space. In particular, this is needed for some functionality to be moved to worker threads -- otherwise the objfile can be deleted while still in use. So, this makes ~objfile private, replacing it with an "unlink" method, making it more obvious which operation is intended at the calling points. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * symfile.c (syms_from_objfile_1): Use objfile_up. (syms_from_objfile_1, remove_symbol_file_command): Call unlink method. (reread_symbols): Use objfile_up. * solib.c (update_solib_list, reload_shared_libraries_1): Call unlink method. * objfiles.h (struct objfile) <~objfile>: Now private. <unlink>: New method. (struct objfile_deleter): New. (objfile_up): New typedef. * objfiles.c (objfile::unlink): New method. (free_objfile_separate_debug, free_all_objfiles) (objfile_purge_solibs): Use it. * jit.c (jit_unregister_code): Remove. (jit_inferior_exit_hook, jit_event_handler): Call unlink on objfile. * compile/compile-object-run.c (do_module_cleanup): Call unlink on objfile. * compile/compile-object-load.c (compile_object_load): Use objfile_up. Change-Id: I934bee70b26b8b24e1735828fb1e60fe8a05714f
2019-12-12Make add_separate_debug_objfile staticTom Tromey1-1/+13
This changes objfile::make to take a "parent" parameter, and makes add_separate_debug_objfile static. gdb/ChangeLog 2019-12-12 Tom Tromey <tom@tromey.com> * symfile.c (symbol_file_add_with_addrs): Pass "parent" to objfile::make. * objfiles.h (struct objjfile) <make>: No longer inline. (add_separate_debug_objfile): Don't declare. * objfiles.c (add_separate_debug_objfile): Now static. (objfile::make): Move from objfiles.h. Call add_separate_debug_objfile. Add "parent" parameter. Change-Id: I631f43bb71738dea6ae0697317bf8ef4a0db4617
2019-10-21gdb: Ensure that !(a < a) is true in sort_cmp on obj_section objectsAndrew Burgess1-6/+10
After the switch to use std::sort, if GDB is compiled with the -D_GLIBCXX_DEBUG=1 flag then we see an error when using sort_cmp (in objfiles.c) to sort obj_section objects. The problem is that std::sort checks that the condition !(a < a) holds, and currently this is not true. GDB's sort_cmp is really designed to sort lists in which no obj_section repeats, however, there is some code in place to try and ensure we get a stable sort order if there is a bug in GDB, unfortunately this code fails the above check. By reordering some of the checks inside sort_cmp, it is pretty easy to ensure that the !(a < a) condition holds. I've not bothered to make this condition check optimal, like I said this code is only in place to ensure that we get stable results if GDB goes wrong, so I've made the smallest change needed to get the correct behaviour. After this commit I see no regressions when running GDB compiled with -D_GLIBCXX_DEBUG=1. gdb/ChangeLog: * objfiles.c (sort_cmp): Ensure that !(a < a) holds true. Change-Id: I4b1e3e1640865104c0896cbb6c3fdbbc04d9645b
2019-10-20Make unlink_objfile and put_objfile_before staticTom Tromey1-33/+22
I noticed an obsolete comment just before unlink_objfile, and then I noticed that both unlink_objfile and put_objfile_before could be static. This patch makes these changes, and also moves unlink_objfile earlier, so that a forward declaration is not needed. Tested by rebuilding. gdb/ChangeLog 2019-10-20 Tom Tromey <tom@tromey.com> * objfiles.h (unlink_objfile, put_objfile_before): Don't declare. * objfiles.c (unlink_objfile): Move earlier. Now static. Remove obsolete comment. (put_objfile_before): Now static. Change-Id: I1b5927a60fd1cc59bfc9c6761f61652a01ef13e0
2019-10-19Replace some more qsort calls with std::sortChristian Biesinger1-14/+12
This has better typesafety, avoids a function pointer indirection, and can benefit from inlining. gdb/ChangeLog: 2019-10-19 Christian Biesinger <cbiesinger@google.com> * bcache.c (bcache::print_statistics): Use std::sort instead of qsort. * breakpoint.c (bp_locations_compare): Rename to... (bp_location_is_less_than): ...this, and change to std::sort semantics. (update_global_location_list): Use std::sort instead of qsort. * buildsym.c (compare_line_numbers): Rename to... (lte_is_less_than): ...this, and change to std::sort semantics. (buildsym_compunit::end_symtab_with_blockvector): Use std::sort instead of qsort. * disasm.c (compare_lines): Rename to... (line_is_less_than): ...this, and change to std::sort semantics. (do_mixed_source_and_assembly_deprecated): Call std::sort instead of qsort. * dwarf2-frame.c (qsort_fde_cmp): Rename to... (fde_is_less_than): ...this, and change to std::sort semantics. (dwarf2_build_frame_info): Call std::sort instead of qsort. * mdebugread.c (compare_blocks): (block_is_less_than): ...this, and change to std::sort semantics. (sort_blocks): Call std::sort instead of qsort. * objfiles.c (qsort_cmp): Rename to... (sort_cmp): ...this, and change to std::sort semantics. (update_section_map): Call std::sort instead of qsort. * remote.c (compare_pnums): Remove. (map_regcache_remote_table): Call std::sort instead of qsort. * utils.c (compare_positive_ints): Remove. * utils.h (compare_positive_ints): Remove. * xcoffread.c (compare_lte): Remove. (arrange_linetable): Call std::sort instead of qsort. Change-Id: Ibcddce12a3d07448701e731b7150fa23611d86de
2019-10-18[gdb] Fix more typos in commentsTom de Vries1-1/+1
Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-02Change SYMBOL_VALUE_ADDRESS to be an rvalueTom Tromey1-1/+3
This changes SYMBOL_VALUE_ADDRESS to be an rvalue. The symbol readers generally assign using this, so this also introduces SET_SYMBOL_VALUE_ADDRESS and updates the readers. Making this change is useful in a subsequent patch, which redefined SYMBOL_VALUE_ADDRESS. gdb/ChangeLog 2019-10-02 Tom Tromey <tromey@adacore.com> * coffread.c (process_coff_symbol): Update. * dwarf2read.c (var_decode_location, new_symbol): Update. * mdebugread.c (parse_symbol): Update. * objfiles.c (relocate_one_symbol): Update. * stabsread.c (define_symbol, fix_common_block) (scan_file_globals): Update. * symtab.h (SYMBOL_VALUE_ADDRESS): Expand to an rvalue. (SET_SYMBOL_VALUE_ADDRESS): New macro. * xcoffread.c (process_xcoff_symbol): Update.
2019-09-19bfd_section_* macrosAlan Modra1-6/+6
This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-08-06Use obstack_strdup moreTom Tromey1-6/+2
This changes gdb to use obstack_strdup when appropriate, rather than the wordier obstack_copy0. gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * xcoffread.c (SYMNAME_ALLOC, process_xcoff_symbol): Use obstack_strdup. * typeprint.c (typedef_hash_table::find_global_typedef): Use obstack_strdup. * symfile.c (allocate_compunit_symtab): Use obstack_strdup. * stabsread.c (common_block_start): Use obstack_strdup. * objfiles.c (set_objfile_main_name, objfile): Use obstack_strdup. * namespace.c (add_using_directive): Use obstack_strdup. * mdebugread.c (parse_symbol, parse_type): Use obstack_strdup. * jit.c (finalize_symtab): Use obstack_strdup. * dwarf2read.c (fixup_go_packaging, dwarf2_physname) (guess_partial_die_structure_name, partial_die_info::fixup) (dwarf2_name): Use obstack_strdup. * coffread.c (coff_read_struct_type, coff_read_enum_type): Use obstack_strdup. * c-exp.y (scan_macro_expansion): Use obstack_strdup. * buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use obstack_strdup. * ada-lang.c (ada_decode_symbol): Use obstack_strdup.
2019-07-09Rename common to gdbsupportTom Tromey1-1/+1
This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-05-08Convert objfiles.c to type-safe registry APITom Tromey1-42/+17
This changes objfiles.c to use the type-safe registry API. gdb/ChangeLog 2019-05-08 Tom Tromey <tom@tromey.com> * objfiles.c (objfile_pspace_info): Add destructor and initializers. (objfiles_pspace_data): Change type. (~objfile_pspace_info): Rename from objfiles_pspace_data_cleanup. (get_objfile_pspace_data): Update. (objfiles_bfd_data): Change type. (get_objfile_bfd_data): Update. (objfile_bfd_data_free, _initialize_objfiles): Remove.
2019-05-03Remove "struct" from foreach statementsTom Tromey1-3/+3
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.
2019-04-19Make objfile::static_links an htab_upTom Tromey1-11/+5
This changes objfile::static_links to be an htab_up, so that ~objfile no longer has to explicitly destroy it. Tested by the buildbot. gdb/ChangeLog 2019-04-19 Tom Tromey <tom@tromey.com> * symfile.c (reread_symbols): Update. * objfiles.c (objfile_register_static_link) (objfile_lookup_static_link): Update (~objfile) Don't delete static_links. * objfiles.h (struct objfile) <static_links>: Now an htab_up.
2019-04-10Introduce a separate debug objfile iteratorTom Tromey1-38/+37
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-10 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.
2019-04-10Fix a couple of commentsTom Tromey1-1/+1
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-10 Tom Tromey <tom@tromey.com> * symfile.c (reread_symbols): Remove old comment. * objfiles.c (free_all_objfiles): Fix a typo.
2019-03-23Have parser reset the innermost block trackerTom Tromey1-6/+0
I ran across a comment in symfile.c today: /* Clear globals which might have pointed into a removed objfile. FIXME: It's not clear which of these are supposed to persist between expressions and which ought to be reset each time. */ It seems to me that this can be clarified: the parser entry points ought to reset the innermost block tracker (and the expression context block), and these should not be considered valid for code to use at arbitrary times -- only immediately after an expression has been parsed. This patch implements this idea. This could be further improved by removing the parser globals and changing the parser functions to return this information, but I have not done this. Tested by the buildbot. gdb/ChangeLog 2019-03-23 Tom Tromey <tom@tromey.com> * varobj.c (varobj_create): Update. * symfile.c (clear_symtab_users): Don't reset innermost_block. * printcmd.c (display_command, do_one_display): Don't reset innermost_block. * parser-defs.h (enum innermost_block_tracker_type): Move to expression.h. (innermost_block): Update comment. * parse.c (parse_exp_1): Add tracker_types parameter. (parse_exp_in_context): Rename from parse_exp_in_context_1. Add tracker_types parameter. Reset innermost_block. (parse_exp_in_context): Remove. (parse_expression_for_completion): Update. * objfiles.c (~objfile): Don't reset expression_context_block or innermost_block. * expression.h (enum innermost_block_tracker_type): Move from parser-defs.h. (parse_exp_1): Add tracker_types parameter. * breakpoint.c (set_breakpoint_condition, watch_command_1): Don't reset innermost_block.
2019-03-15Use htab_up for demangled hashTom Tromey1-2/+0
This changes objfile_per_bfd_storage::demangled_names_hash to be an htab_up. This lets us remove some manual management code from the objfile_per_bfd_storage destructor. gdb/ChangeLog 2019-03-15 Tom Tromey <tom@tromey.com> * symtab.c (create_demangled_names_hash): Update. (symbol_set_names): Update. * objfiles.h (struct objfile_per_bfd_storage) <demangled_names_hash>: Now an htab_up. * objfiles.c (objfile_per_bfd_storage): Simplify.
2019-03-15Simplify per-BFD storage managementTom Tromey1-32/+14
There's no reason that the objfile_per_bfd_storage must be allocated via bfd_alloc. This patch changes objfile_per_bfd_storage to be managed more simply, via ordinary new and delete; and moves some code into its (new) destructor. While doing this I also noticed an extra initialization of language_of_main, and removed it. gdb/ChangeLog 2019-03-15 Tom Tromey <tom@tromey.com> * objfiles.h (struct objfile_per_bfd_storage): Declare destructor. * objfiles.c (objfile_per_bfd_storage::~objfile_per_bfd_storage): New. (get_objfile_bfd_data): Use new. Don't initialize language_of_main. (free_objfile_per_bfd_storage): Remove. (objfile_bfd_data_free, objfile::~objfile): Use delete.
2019-03-15Remove minsym terminationTom Tromey1-2/+0
I was curious what used the terminating "null" minimal symbol; and after looking I could not find anything. This patch removes terminate_minimal_symbol_table and the extra minimal symbol that is allocated for it. gdb/ChangeLog 2019-03-15 Tom Tromey <tom@tromey.com> * symfile.c (reread_symbols): Update. * objfiles.c (objfile::objfile): Update. * minsyms.h (terminate_minimal_symbol_table): Don't declare. * minsyms.c (lookup_minimal_symbol_by_pc_section): Update comment. (minimal_symbol_reader::install): Update. (terminate_minimal_symbol_table): Remove. * jit.c (jit_object_close_impl): Update.
2019-03-07C++-ify bcacheTom Tromey1-4/+0
This somewhat C++-ifies bcache. It replaces bcache_xmalloc and bcache_xfree with constructors; changes some functions into methods; and changes various structures to include a bcache directly (as opposed to a pointer to a bcache). Tested by the buildbot. gdb/ChangeLog 2019-03-07 Tom Tromey <tom@tromey.com> * symmisc.c (print_symbol_bcache_statistics): Update. (print_objfile_statistics): Update. * symfile.c (allocate_symtab): Update. * stabsread.c: Don't include bcache.h. * psymtab.h (struct psymbol_bcache): Don't declare. (class psymtab_storage) <psymbol_cache>: Now a bcache. (psymbol_bcache_init, psymbol_bcache_free) (psymbol_bcache_get_bcache): Don't declare. * psymtab.c (struct psymbol_bcache): Remove. (psymtab_storage::psymtab_storage): Update. (psymtab_storage::~psymtab_storage): Update. (psymbol_bcache_init, psymbol_bcache_free) (psymbol_bcache_get_bcache, psymbol_bcache_full): Remove. (add_psymbol_to_bcache): Update. (allocate_psymtab): Update. * objfiles.h (struct objfile_per_bfd_storage) <filename_cache, macro_cache>: No longer pointers. * objfiles.c (get_objfile_bfd_data): Don't call bcache_xmalloc. (free_objfile_per_bfd_storage): Don't call bcache_xfree. * macrotab.c (macro_bcache): Update. * macroexp.c: Don't include bcache.h. * gdbtypes.c (check_types_worklist): Update. (types_deeply_equal): Remove TRY/CATCH. Update. * elfread.c (elf_symtab_read): Update. * dwarf2read.c: Don't include bcache.h. * buildsym.c (buildsym_compunit::get_macro_table): Update. * bcache.h (bcache, bcache_full, bcache_xffree, bcache_xmalloc) (print_bcache_statistics, bcache_memory_used): Don't declare. (struct bcache): Move from bcache.c. Add constructor, destructor, methods. Rename all data members. * bcache.c (struct bcache): Move to bcache.h. (bcache::expand_hash_table): Rename from expand_hash_table. (bcache): Remove. (bcache::insert): Rename from bcache_full. (bcache::compare): Rename from bcache_compare. (bcache_xmalloc): Remove. (bcache::~bcache): Rename from bcache_xfree. (bcache::print_statistics): Rename from print_bcache_statistics. (bcache::memory_used): Rename from bcache_memory_used.
2019-01-17Add compunits range adapter to objfileTom Tromey1-2/+2
This removes the objfile_compunits range adapter in favor of using a method on objfile. 2019-01-15 Tom Tromey <tom@tromey.com> * symtab.c (lookup_objfile_from_block) (lookup_symbol_in_objfile_symtabs) (basic_lookup_transparent_type_1, find_pc_sect_compunit_symtab) (find_line_symtab, info_sources_command) (default_collect_symbol_completion_matches_break_on) (make_source_files_completion_list): Update. * symmisc.c (print_objfile_statistics, dump_objfile) (maintenance_print_symbols, maintenance_info_symtabs) (maintenance_check_symtabs, maintenance_info_line_tables): Update. * source.c (select_source_symtab) (forget_cached_source_info_for_objfile): Update. * objfiles.h (class objfile_compunits): Remove. (struct objfile) <compunits_range>: New typedef. (compunits): New method. * objfiles.c (objfile_relocate1): Update. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. * maint.c (count_symtabs_and_blocks): Update. * linespec.c (iterate_over_all_matching_symtabs): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * coffread.c (coff_symtab_read): Update. * ada-lang.c (add_nonlocal_symbols) (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Update.
2019-01-17Change all_objfiles_safe adapter to be a method on program_spaceTom Tromey1-4/+4
This changes the all_objfiles_safe range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-15 Tom Tromey <tom@tromey.com> * progspace.h (program_space) <objfiles_safe_range>: New typedef. <objfiles_safe>: New method. * objfiles.h (class all_objfiles_safe): Remove. * objfiles.c (free_all_objfiles, objfile_purge_solibs): Update. * jit.c (jit_inferior_exit_hook): Update.
2019-01-17Change all_objfiles adapter to be a method on program_spaceTom Tromey1-9/+9
This changes the all_objfiles range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-17 Tom Tromey <tom@tromey.com> * progspace.h (program_space) <objfiles_range>: New typedef. <objfiles>: New method. <objfiles_head>: Rename from objfiles. (object_files): Update. * guile/scm-progspace.c (gdbscm_progspace_objfiles): Update. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Update. * guile/scm-objfile.c (gdbscm_objfiles): Update. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Update. * python/py-progspace.c (pspy_get_objfiles): Update. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Update. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Update. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Update. * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_objfile_from_block) (lookup_static_symbol, basic_lookup_transparent_type) (find_pc_sect_compunit_symtab, find_symbol_at_address) (find_line_symtab, info_sources_command) (default_collect_symbol_completion_matches_break_on) (make_source_files_completion_list, find_main_name): Update. * symmisc.c (print_symbol_bcache_statistics) (print_objfile_statistics, maintenance_print_symbols) (maintenance_print_msymbols, maintenance_print_objfiles) (maintenance_info_symtabs, maintenance_check_symtabs) (maintenance_expand_symtabs, maintenance_info_line_tables): Update. * symfile.c (remove_symbol_file_command, overlay_invalidate_all) (find_pc_overlay, find_pc_mapped_section, list_overlays_command) (map_overlay_command, unmap_overlay_command) (simple_overlay_update, expand_symtabs_matching) (map_symbol_filenames): Update. * symfile-debug.c (set_debug_symfile): Update. * spu-tdep.c (spu_overlay_update, spu_objfile_from_frame): Update. * source.c (select_source_symtab, forget_cached_source_info): Update. * solib.c (solib_read_symbols): Update. * solib-spu.c (append_ocl_sos): Update. * psymtab.c (maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * probe.c (parse_probes_in_pspace, find_probe_by_pc): Update. * printcmd.c (info_symbol_command): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Update. * objfiles.h (class all_objfiles): Remove. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp, update_section_map) (shared_objfile_contains_address_p) (default_iterate_over_objfiles_in_search_order): Update. * objc-lang.c (info_selectors_command, info_classes_command) (find_methods): Update. * minsyms.c (find_solib_trampoline_target): Update. * maint.c (maintenance_info_sections) (maintenance_translate_address, count_symtabs_and_blocks): Update. * main.c (captured_main_1): Update. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Update. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Update. * jit.c (jit_find_objf_with_entry_addr): Update. * hppa-tdep.c (find_unwind_entry) (hppa_lookup_stub_minimal_symbol): Update. * gcore.c (gcore_create_callback, objfile_find_memory_regions): Update. * elfread.c (elf_gnu_ifunc_resolve_by_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2-frame.c (dwarf2_frame_find_fde): Update. * dwarf-index-write.c (save_gdb_index_command): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * blockframe.c (find_pc_partial_function): Update. * ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols) (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Update.
2019-01-10gdb/23712: Use new multidictionary APIKeith Seitz1-2/+2
This patch builds on the previous by enabling the `new' multidictionary API. A lot of the hunks are simply textual replacements of "dict_" with "mdict_" and similar transformations. A word of warning, even with the use of multidictionaries, the code still does not satisfactorily fix the reported problems with gdb/23712 (or gdb/23010). We still have additional changes to make before that happens. gdb/ChangeLog: PR gdb/23712 PR symtab/23010 * dictionary.h (struct dictionary): Replace declaration with multidictionary. (dict_create_hashed, dict_create_hashed_expandable) (dict_create_linear, dict_create_linear_expandable) (dict_free, dict_add_symbol, dict_add_pending, dict_empty) (dict_iterator_first, dict_iterator_next, dict_iter_match_first) (dict_iter_match_next, dict_size): Rename to "mdict_" versions taking multidictionary argument. [ALL_DICT_SYMBOLS]: Update for multidictionary. * block.h (struct block) <dict>: Change to multidictionary and rename `multidict'. * block.c, buildsym.c, jit.c, mdebugread.c, objfiles.c, symmisc.c: Update all dictionary references to multidictionary.
2019-01-10Move psymtabs to their own obstackTom Tromey1-1/+1
Previously, the psymtab obstack was just a pointer to the objfile obstack. This patch changes psymtabs to use their own obstack, instead. A gdb::optional is used to avoid unnecessary allocation when the obstack is not needed. After this patch, the psymtab code lifetime model is that, in the core psymtab code, objects allocated on the psymtab obstack may point to other such objects, or to objects on the per-BFD obstack -- but never to the objfile obstack. Note however that this invariant is only obeyed the core psymtab code, and even there not quite fully: there is still a link from the psymtab to the full symtab. Symbol readers are free to work however they like; and in particular, even after this patch, in practice all symbol readers violate this invariant via the read_symtab_private field. gdb/ChangeLog 2019-01-10 Tom Tromey <tom@tromey.com> * objfiles.h (objfile::reset_psymtabs): Update. * objfiles.c (objfile::objfile): Update. * psymtab.h (psymtab_storage::obstack): Update. (psymtab_storage::m_obstack): Use gdb::optional. (class psymtab_storage): Update comment. Remove objfile parameter. * psymtab.c (psymtab_storage::psymtab_storage): Update.
2019-01-10Introduce class psymtab_storageTom Tromey1-3/+2
This introduces a new psymtab_storage class, which holds all psymbol-related objects that are independent of the objfile. (This latter contraint explains why psymbol_map was not moved; though this could still be done with some work.) This patch does not yet change where psymtab allocation is done -- that comes later. This just wraps everything in a single object to make further transformations simpler. Note that a shared_ptr is used to link from the objfile to the psymtab_storage object. The end goal here is to allow a given symbol reader to simply attach to the psymtab_storage object to the BFD, then reuse it in later invocations; shared_ptr makes this simple to reason about. gdb/ChangeLog 2019-01-10 Tom Tromey <tom@tromey.com> * symmisc.c (print_symbol_bcache_statistics): Update. (print_objfile_statistics): Update. * symfile.c (reread_symbols): Update. * psymtab.h (class psymtab_storage): New. * psymtab.c (psymtab_storage): New constructor. (~psymtab_storage): New destructor. (require_partial_symbols): Update. (ALL_OBJFILE_PSYMTABS_REQUIRED): Rewrite. (find_pc_sect_psymtab, find_pc_sect_psymbol) (match_partial_symbol, lookup_partial_symbol, dump_psymtab) (psym_dump, recursively_search_psymtabs, psym_has_symbols) (psym_find_compunit_symtab_by_address, sort_pst_symbols) (start_psymtab_common, end_psymtab_common) (add_psymbol_to_bcache, add_psymbol_to_list, init_psymbol_list) (allocate_psymtab): Update. (psymtab_storage::discard_psymtab): Rename from discard_psymtab. Update. (dump_psymtab_addrmap, maintenance_print_psymbols) (maintenance_check_psymtabs): Update. (class objfile_psymtabs): Move to objfiles.h. * psympriv.h (discard_psymtab): Now inline. (psymtab_discarder::psymtab_discarder): Update. (psymtab_discarder::~psymtab_discarder): Update. (ALL_OBJFILE_PSYMTABS): Rewrite. * objfiles.h (struct objfile) <psymtabs, psymtabs_addrmap, free_psymtabs, psymbol_cache, global_psymbols, static_psymbols>: Remove fields. <partial_symtabs>: New field. (class objfile_psymtabs): Move from psymtab.h. Update. * objfiles.c (objfile::objfile): Initialize partial_symtabs, not psymbol_cache. (objfile::~objfile): Don't destroy psymbol_cache. * mdebugread.c (parse_partial_symbols): Update. * dwarf2read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab) (process_psymtab_comp_unit_reader, dwarf2_build_psymtabs_hard) (add_partial_subprogram, dwarf2_ranges_read): Update. * dwarf-index-write.c (write_address_map) (write_one_signatured_type, recursively_write_psymbols) (class debug_names, class debug_names, write_psymtabs_to_index): Update.