diff options
Diffstat (limited to 'gdb/gdb_bfd.h')
| -rw-r--r-- | gdb/gdb_bfd.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h index d35f2d6..eb4428e 100644 --- a/gdb/gdb_bfd.h +++ b/gdb/gdb_bfd.h @@ -1,6 +1,6 @@ /* Definitions for BFD wrappers used by GDB. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -24,7 +24,6 @@ #include "gdbsupport/byte-vector.h" #include "gdbsupport/function-view.h" #include "gdbsupport/gdb_ref_ptr.h" -#include "gdbsupport/iterator-range.h" #include "gdbsupport/next-iterator.h" /* A registry adaptor for BFD. This arranges to store the registry in @@ -242,13 +241,17 @@ using gdb_bfd_section_range = next_range<asection>; static inline gdb_bfd_section_range gdb_bfd_sections (bfd *abfd) { - return gdb_bfd_section_range (abfd->sections); + next_iterator<asection> begin (abfd->sections); + + return gdb_bfd_section_range (std::move (begin)); } static inline gdb_bfd_section_range gdb_bfd_sections (const gdb_bfd_ref_ptr &abfd) { - return gdb_bfd_section_range (abfd->sections); + next_iterator<asection> begin (abfd->sections); + + return gdb_bfd_section_range (std::move (begin)); }; /* A wrapper for bfd_stat that acquires the per-BFD lock on ABFD. */ @@ -274,4 +277,16 @@ extern std::string gdb_bfd_errmsg (bfd_error_type error_tag, char **matching); extern void gdb_bfd_init (); +/* A wrapper for bfd_canonicalize_symtab that caches the result. This + is important to avoid excess memory use on repeated calls. See + PR gdb/32758. bfd_canonicalize_symtab should not be called directly + by other code in gdb. + + When SHOULD_THROW is true (the default), this will throw an + exception if symbols could not be read. When SHOULD_THROW is + false, an empty view is returned instead. */ + +extern gdb::array_view<asymbol *> gdb_bfd_canonicalize_symtab + (bfd *abfd, bool should_throw = true); + #endif /* GDB_GDB_BFD_H */ |
