gdb: LoongArch: Remove nonportable #include
[binutils-gdb.git] / gdb / gdb_bfd.h
index 123309708736cda6c140ffb1f50882e00775fa58..6845d6ccef561c95cdec8137ab86170cfae45e0f 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for BFD wrappers used by GDB.
 
-   Copyright (C) 2011-2020 Free Software Foundation, Inc.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,6 +23,7 @@
 #include "registry.h"
 #include "gdbsupport/byte-vector.h"
 #include "gdbsupport/gdb_ref_ptr.h"
+#include "gdbsupport/iterator-range.h"
 #include "gdbsupport/next-iterator.h"
 
 DECLARE_REGISTRY (bfd);
@@ -194,6 +195,12 @@ int gdb_bfd_requires_relocations (bfd *abfd);
 bool gdb_bfd_get_full_section_contents (bfd *abfd, asection *section,
                                        gdb::byte_vector *contents);
 
+/* Create and initialize a BFD handle from a target in-memory range.  */
+
+gdb_bfd_ref_ptr gdb_bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size,
+                                                const char *target,
+                                                const char *filename = nullptr);
+
 /* Range adapter for a BFD's sections.
 
    To be used as:
@@ -202,8 +209,7 @@ bool gdb_bfd_get_full_section_contents (bfd *abfd, asection *section,
        ... use SECT ...
  */
 
-using gdb_bfd_section_iterator = next_iterator<asection>;
-using gdb_bfd_section_range = next_adapter<asection, gdb_bfd_section_iterator>;
+using gdb_bfd_section_range = next_range<asection>;
 
 static inline gdb_bfd_section_range
 gdb_bfd_sections (bfd *abfd)
@@ -217,4 +223,11 @@ gdb_bfd_sections (const gdb_bfd_ref_ptr &abfd)
   return gdb_bfd_section_range (abfd->sections);
 };
 
+/* A wrapper for bfd_errmsg to produce a more helpful error message
+   in the case of bfd_error_file_ambiguously recognized.
+   MATCHING, if non-NULL, is the corresponding argument to
+   bfd_check_format_matches, and will be freed.  */
+
+extern std::string gdb_bfd_errmsg (bfd_error_type error_tag, char **matching);
+
 #endif /* GDB_BFD_H */