gdb/tui: fairer distribution of excess space during apply
[binutils-gdb.git] / gdb / objfiles.h
index 55be1bfdda4b9d5916f7cac98eec49d6252866dd..8bd76705688a20ff98a2c5309509a8f3ffd7f9e6 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for symbol file management in GDB.
 
-   Copyright (C) 1992-2021 Free Software Foundation, Inc.
+   Copyright (C) 1992-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,7 +21,7 @@
 #define OBJFILES_H
 
 #include "hashtab.h"
-#include "gdb_obstack.h"       /* For obstack internals.  */
+#include "gdbsupport/gdb_obstack.h"    /* For obstack internals.  */
 #include "objfile-flags.h"
 #include "symfile.h"
 #include "progspace.h"
@@ -380,29 +380,7 @@ private:
 
 /* A range adapter wrapping separate_debug_iterator.  */
 
-class separate_debug_range
-{
-public:
-
-  explicit separate_debug_range (struct objfile *objfile)
-    : m_objfile (objfile)
-  {
-  }
-
-  separate_debug_iterator begin ()
-  {
-    return separate_debug_iterator (m_objfile);
-  }
-
-  separate_debug_iterator end ()
-  {
-    return separate_debug_iterator (nullptr);
-  }
-
-private:
-
-  struct objfile *m_objfile;
-};
+typedef iterator_range<separate_debug_iterator> separate_debug_range;
 
 /* Master structure for keeping track of each file from which
    gdb reads symbols.  There are several ways these get allocated: 1.
@@ -456,38 +434,17 @@ public:
   /* A range adapter that makes it possible to iterate over all
      minimal symbols of an objfile.  */
 
-  class msymbols_range
-  {
-  public:
-
-    explicit msymbols_range (struct objfile *objfile)
-      : m_objfile (objfile)
-    {
-    }
-
-    minimal_symbol_iterator begin () const
-    {
-      return minimal_symbol_iterator (m_objfile->per_bfd->msymbols.get ());
-    }
-
-    minimal_symbol_iterator end () const
-    {
-      return minimal_symbol_iterator
-       (m_objfile->per_bfd->msymbols.get ()
-        + m_objfile->per_bfd->minimal_symbol_count);
-    }
-
-  private:
-
-    struct objfile *m_objfile;
-  };
+  typedef iterator_range<minimal_symbol_iterator> msymbols_range;
 
   /* Return a range adapter for iterating over all minimal
      symbols.  */
 
   msymbols_range msymbols ()
   {
-    return msymbols_range (this);
+    auto start = minimal_symbol_iterator (per_bfd->msymbols.get ());
+    auto end = minimal_symbol_iterator (per_bfd->msymbols.get ()
+                                       + per_bfd->minimal_symbol_count);
+    return msymbols_range (start, end);
   }
 
   /* Return a range adapter for iterating over all the separate debug
@@ -495,7 +452,9 @@ public:
 
   separate_debug_range separate_debug_objfiles ()
   {
-    return separate_debug_range (this);
+    auto start = separate_debug_iterator (this);
+    auto end = separate_debug_iterator (nullptr);
+    return separate_debug_range (start, end);
   }
 
   CORE_ADDR text_section_offset () const
@@ -977,6 +936,11 @@ const char *objfile_flavour_name (struct objfile *objfile);
 extern void set_objfile_main_name (struct objfile *objfile,
                                   const char *name, enum language lang);
 
+/* Find an integer type SIZE_IN_BYTES bytes in size from OF and return it.
+   UNSIGNED_P controls if the integer is unsigned or not.  */
+extern struct type *objfile_int_type (struct objfile *of, int size_in_bytes,
+                                     bool unsigned_p);
+
 extern void objfile_register_static_link
   (struct objfile *objfile,
    const struct block *block,