diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 23894ea4a4d..618c5bbb339 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1109,6 +1109,7 @@ COMMON_SFILES = \
dwarf2/read-gdb-index.c \
dwarf2/section.c \
dwarf2/stringify.c \
+ extract-store-integer.c \
eval.c \
event-top.c \
exceptions.c \
@@ -1362,6 +1363,7 @@ HFILES_NO_SRCDIR = \
expression.h \
extension.h \
extension-priv.h \
+ extract-store-integer.h \
f-array-walker.h \
f-lang.h \
fbsd-nat.h \
diff --git a/gdb/aarch64-fbsd-tdep.c b/gdb/aarch64-fbsd-tdep.c
index e2ff57e8390..844023c2e7b 100644
--- a/gdb/aarch64-fbsd-tdep.c
+++ b/gdb/aarch64-fbsd-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbarch.h"
#include "fbsd-tdep.h"
#include "aarch64-tdep.h"
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 35979875907..ad55cf2caa3 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -19,6 +19,7 @@
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbarch.h"
#include "glibc-tdep.h"
#include "linux-tdep.h"
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 06eda102468..a01ae39d25c 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -19,6 +19,7 @@
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "language.h"
#include "gdbcmd.h"
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a3870020e8d..5ab6e8b14b7 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -19,6 +19,7 @@
#include
+#include "extract-store-integer.h"
#include "gdbsupport/gdb_regex.h"
#include "frame.h"
#include "symtab.h"
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 864c5cfdf1c..547395d36d6 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "observable.h"
#include "gdbcmd.h"
#include "target.h"
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 6acfb9a48b6..6d3fca9bdeb 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include
+#include "extract-store-integer.h"
#include "gdbtypes.h"
#include "expression.h"
#include "value.h"
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index c93bd69657f..ada8afd3725 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/amd64-darwin-tdep.c b/gdb/amd64-darwin-tdep.c
index b0bead084fe..f2741e2cff8 100644
--- a/gdb/amd64-darwin-tdep.c
+++ b/gdb/amd64-darwin-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "gdbcore.h"
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 9d560ac4fbf..c52b0436872 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -19,6 +19,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "gdbcore.h"
#include "regcache.h"
diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c
index f6f63bbf8ed..5b1e77b3e86 100644
--- a/gdb/amd64-obsd-tdep.c
+++ b/gdb/amd64-obsd-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbcore.h"
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 0bb7a24cbd0..053067e2cf2 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "language.h"
#include "opcode/i386.h"
#include "dis-asm.h"
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index a559d967b3c..3dfc8000533 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "osabi.h"
#include "amd64-tdep.h"
#include "gdbsupport/x86-xstate.h"
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 5684f324233..f35f4c4be74 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -23,6 +23,7 @@
#include "elf-bfd.h"
#include "disasm.h"
#include "dwarf2/frame.h"
+#include "extract-store-integer.h"
#include "frame-base.h"
#include "frame-unwind.h"
#include "gdbcore.h"
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index cb149c36bc9..b8a18a58af2 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -19,6 +19,7 @@
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "gdbcmd.h"
#include "inferior.h"
#include "infrun.h"
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 8511abcd11d..43869e4fcfe 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "target.h"
#include "value.h"
#include "gdbtypes.h"
diff --git a/gdb/arm-none-tdep.c b/gdb/arm-none-tdep.c
index 453e75234d4..4212af3c6f1 100644
--- a/gdb/arm-none-tdep.c
+++ b/gdb/arm-none-tdep.c
@@ -19,6 +19,7 @@
#include "arm-tdep.h"
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "regcache.h"
#include "elf-bfd.h"
#include "regset.h"
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index b4062a8f922..97728d9100c 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -20,6 +20,7 @@
#include
+#include "extract-store-integer.h"
#include "frame.h"
#include "language.h"
#include "inferior.h"
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 1dc0587c007..616564c43a3 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "target.h"
#include "gdbtypes.h"
#include "command.h"
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index be95034abd5..68b2646d202 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -22,6 +22,7 @@
/* Portions of this file were taken from the original gdb-4.18 patch developed
by Denis Chertykov, denisc@overta.ru */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/bfin-linux-tdep.c b/gdb/bfin-linux-tdep.c
index f67e06478eb..0b1b018e736 100644
--- a/gdb/bfin-linux-tdep.c
+++ b/gdb/bfin-linux-tdep.c
@@ -20,6 +20,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "regcache.h"
#include "tramp-frame.h"
#include "trad-frame.h"
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index dbc339d9336..b89b7dfa6d8 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "inferior.h"
#include "gdbcore.h"
#include "arch-utils.h"
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 576a9ec1cfb..a686f173fbf 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "gdbthread.h"
#include "inferior.h"
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 922bf8c0de3..2b6cf087f54 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 28a6a6afea2..ca24b1536bc 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 16cd60f7106..984c7bef880 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -19,6 +19,7 @@
#include
#include
+#include "extract-store-integer.h"
#include "inferior.h"
#include "symtab.h"
#include "command.h"
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index f2a2ca5288d..2e776f40a63 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbsupport/gdb_obstack.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index dd013d531ab..8ca9fbc5251 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -20,6 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 5f0fd3d7170..49aa1f68012 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbsupport/gdb_assert.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 0c5b54b40a3..33896a88d2b 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "top.h"
#include "inferior.h"
#include "target.h"
diff --git a/gdb/defs.h b/gdb/defs.h
index be5c9b7261b..5da8ce72815 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -422,95 +422,6 @@ enum symbol_needs_kind
SYMBOL_NEEDS_FRAME
};
-/* In findvar.c. */
-
-template>
-T extract_integer (gdb::array_view, enum bfd_endian byte_order);
-
-static inline LONGEST
-extract_signed_integer (gdb::array_view buf,
- enum bfd_endian byte_order)
-{
- return extract_integer (buf, byte_order);
-}
-
-static inline LONGEST
-extract_signed_integer (const gdb_byte *addr, int len,
- enum bfd_endian byte_order)
-{
- return extract_signed_integer (gdb::array_view (addr, len),
- byte_order);
-}
-
-static inline ULONGEST
-extract_unsigned_integer (gdb::array_view buf,
- enum bfd_endian byte_order)
-{
- return extract_integer (buf, byte_order);
-}
-
-static inline ULONGEST
-extract_unsigned_integer (const gdb_byte *addr, int len,
- enum bfd_endian byte_order)
-{
- return extract_unsigned_integer (gdb::array_view (addr, len),
- byte_order);
-}
-
-extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
- struct type *type);
-
-/* All 'store' functions accept a host-format integer and store a
- target-format integer at ADDR which is LEN bytes long. */
-
-template>
-extern void store_integer (gdb::array_view dst,
- bfd_endian byte_order, T val);
-
-template
-static inline void
-store_integer (gdb_byte *addr, int len, bfd_endian byte_order, T val)
-{
- return store_integer (gdb::make_array_view (addr, len), byte_order, val);
-}
-
-static inline void
-store_signed_integer (gdb::array_view dst, bfd_endian byte_order,
- LONGEST val)
-{
- return store_integer (dst, byte_order, val);
-}
-
-static inline void
-store_signed_integer (gdb_byte *addr, int len, bfd_endian byte_order,
- LONGEST val)
-{
- return store_signed_integer (gdb::make_array_view (addr, len), byte_order,
- val);
-}
-
-static inline void
-store_unsigned_integer (gdb::array_view dst, bfd_endian byte_order,
- ULONGEST val)
-{
- return store_integer (dst, byte_order, val);
-}
-
-static inline void
-store_unsigned_integer (gdb_byte *addr, int len, bfd_endian byte_order,
- ULONGEST val)
-{
- return store_unsigned_integer (gdb::make_array_view (addr, len), byte_order,
- val);
-}
-
-extern void store_typed_address (gdb_byte *buf, struct type *type,
- CORE_ADDR addr);
-
-extern void copy_integer_to_size (gdb_byte *dest, int dest_size,
- const gdb_byte *source, int source_size,
- bool is_signed, enum bfd_endian byte_order);
-
/* Hooks for alternate command interfaces. */
struct target_waitstatus;
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index ad1a3f870b6..0f4e1643483 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "probe.h"
#include "elf-bfd.h"
#include "gdbtypes.h"
diff --git a/gdb/dwarf2/index-common.h b/gdb/dwarf2/index-common.h
index dca41517b3d..0a871a7e364 100644
--- a/gdb/dwarf2/index-common.h
+++ b/gdb/dwarf2/index-common.h
@@ -20,6 +20,8 @@
#ifndef DWARF_INDEX_COMMON_H
#define DWARF_INDEX_COMMON_H
+#include "extract-store-integer.h"
+
/* The suffix for an index file. */
#define INDEX4_SUFFIX ".gdb-index"
#define INDEX5_SUFFIX ".debug_names"
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 9bfe12712db..7a6a8cadced 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -24,6 +24,7 @@
#include "elf/common.h"
#include "elf/internal.h"
#include "elf/mips.h"
+#include "extract-store-integer.h"
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
diff --git a/gdb/extract-store-integer.c b/gdb/extract-store-integer.c
new file mode 100644
index 00000000000..a3b7e40d642
--- /dev/null
+++ b/gdb/extract-store-integer.c
@@ -0,0 +1,308 @@
+/* Copyright (C) 2024 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see . */
+
+#include "extract-store-integer.h"
+#include "gdbtypes.h"
+#include "gdbarch.h"
+#include "gdbsupport/selftest.h"
+
+template
+T
+extract_integer (gdb::array_view buf, enum bfd_endian byte_order)
+{
+ typename std::make_unsigned::type retval = 0;
+
+ if (buf.size () > (int) sizeof (T))
+ error (_("\
+That operation is not available on integers of more than %d bytes."),
+ (int) sizeof (T));
+
+ /* Start at the most significant end of the integer, and work towards
+ the least significant. */
+ if (byte_order == BFD_ENDIAN_BIG)
+ {
+ size_t i = 0;
+
+ if (std::is_signed::value)
+ {
+ /* Do the sign extension once at the start. */
+ retval = ((LONGEST) buf[i] ^ 0x80) - 0x80;
+ ++i;
+ }
+ for (; i < buf.size (); ++i)
+ retval = (retval << 8) | buf[i];
+ }
+ else
+ {
+ ssize_t i = buf.size () - 1;
+
+ if (std::is_signed::value)
+ {
+ /* Do the sign extension once at the start. */
+ retval = ((LONGEST) buf[i] ^ 0x80) - 0x80;
+ --i;
+ }
+ for (; i >= 0; --i)
+ retval = (retval << 8) | buf[i];
+ }
+ return retval;
+}
+
+/* Explicit instantiations. */
+template LONGEST extract_integer (gdb::array_view buf,
+ enum bfd_endian byte_order);
+template ULONGEST extract_integer
+ (gdb::array_view buf, enum bfd_endian byte_order);
+
+/* Sometimes a long long unsigned integer can be extracted as a
+ LONGEST value. This is done so that we can print these values
+ better. If this integer can be converted to a LONGEST, this
+ function returns 1 and sets *PVAL. Otherwise it returns 0. */
+
+int
+extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
+ enum bfd_endian byte_order, LONGEST *pval)
+{
+ const gdb_byte *p;
+ const gdb_byte *first_addr;
+ int len;
+
+ len = orig_len;
+ if (byte_order == BFD_ENDIAN_BIG)
+ {
+ for (p = addr;
+ len > (int) sizeof (LONGEST) && p < addr + orig_len;
+ p++)
+ {
+ if (*p == 0)
+ len--;
+ else
+ break;
+ }
+ first_addr = p;
+ }
+ else
+ {
+ first_addr = addr;
+ for (p = addr + orig_len - 1;
+ len > (int) sizeof (LONGEST) && p >= addr;
+ p--)
+ {
+ if (*p == 0)
+ len--;
+ else
+ break;
+ }
+ }
+
+ if (len <= (int) sizeof (LONGEST))
+ {
+ *pval = (LONGEST) extract_unsigned_integer (first_addr,
+ sizeof (LONGEST),
+ byte_order);
+ return 1;
+ }
+
+ return 0;
+}
+
+
+/* Treat the bytes at BUF as a pointer of type TYPE, and return the
+ address it represents. */
+CORE_ADDR
+extract_typed_address (const gdb_byte *buf, struct type *type)
+{
+ gdb_assert (type->is_pointer_or_reference ());
+ return gdbarch_pointer_to_address (type->arch (), type, buf);
+}
+
+/* All 'store' functions accept a host-format integer and store a
+ target-format integer at ADDR which is LEN bytes long. */
+template
+void
+store_integer (gdb::array_view dst, enum bfd_endian byte_order,
+ T val)
+{
+ gdb_byte *p;
+ gdb_byte *startaddr = dst.data ();
+ gdb_byte *endaddr = startaddr + dst.size ();
+
+ /* Start at the least significant end of the integer, and work towards
+ the most significant. */
+ if (byte_order == BFD_ENDIAN_BIG)
+ {
+ for (p = endaddr - 1; p >= startaddr; --p)
+ {
+ *p = val & 0xff;
+ val >>= 8;
+ }
+ }
+ else
+ {
+ for (p = startaddr; p < endaddr; ++p)
+ {
+ *p = val & 0xff;
+ val >>= 8;
+ }
+ }
+}
+
+/* Explicit instantiations. */
+template void store_integer (gdb::array_view dst,
+ bfd_endian byte_order, LONGEST val);
+
+template void store_integer (gdb::array_view dst,
+ bfd_endian byte_order, ULONGEST val);
+
+/* Store the address ADDR as a pointer of type TYPE at BUF, in target
+ form. */
+void
+store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
+{
+ gdb_assert (type->is_pointer_or_reference ());
+ gdbarch_address_to_pointer (type->arch (), type, buf, addr);
+}
+
+/* Copy a value from SOURCE of size SOURCE_SIZE bytes to DEST of size DEST_SIZE
+ bytes. If SOURCE_SIZE is greater than DEST_SIZE, then truncate the most
+ significant bytes. If SOURCE_SIZE is less than DEST_SIZE then either sign
+ or zero extended according to IS_SIGNED. Values are stored in memory with
+ endianness BYTE_ORDER. */
+
+void
+copy_integer_to_size (gdb_byte *dest, int dest_size, const gdb_byte *source,
+ int source_size, bool is_signed,
+ enum bfd_endian byte_order)
+{
+ signed int size_diff = dest_size - source_size;
+
+ /* Copy across everything from SOURCE that can fit into DEST. */
+
+ if (byte_order == BFD_ENDIAN_BIG && size_diff > 0)
+ memcpy (dest + size_diff, source, source_size);
+ else if (byte_order == BFD_ENDIAN_BIG && size_diff < 0)
+ memcpy (dest, source - size_diff, dest_size);
+ else
+ memcpy (dest, source, std::min (source_size, dest_size));
+
+ /* Fill the remaining space in DEST by either zero extending or sign
+ extending. */
+
+ if (size_diff > 0)
+ {
+ gdb_byte extension = 0;
+ if (is_signed
+ && ((byte_order != BFD_ENDIAN_BIG && source[source_size - 1] & 0x80)
+ || (byte_order == BFD_ENDIAN_BIG && source[0] & 0x80)))
+ extension = 0xff;
+
+ /* Extend into MSBs of SOURCE. */
+ if (byte_order == BFD_ENDIAN_BIG)
+ memset (dest, extension, size_diff);
+ else
+ memset (dest + source_size, extension, size_diff);
+ }
+}
+
+#if GDB_SELF_TEST
+namespace selftests {
+
+/* Function to test copy_integer_to_size. Store SOURCE_VAL with size
+ SOURCE_SIZE to a buffer, making sure no sign extending happens at this
+ stage. Copy buffer to a new buffer using copy_integer_to_size. Extract
+ copied value and compare to DEST_VALU. Copy again with a signed
+ copy_integer_to_size and compare to DEST_VALS. Do everything for both
+ LITTLE and BIG target endians. Use unsigned values throughout to make
+ sure there are no implicit sign extensions. */
+
+static void
+do_cint_test (ULONGEST dest_valu, ULONGEST dest_vals, int dest_size,
+ ULONGEST src_val, int src_size)
+{
+ for (int i = 0; i < 2 ; i++)
+ {
+ gdb_byte srcbuf[sizeof (ULONGEST)] = {};
+ gdb_byte destbuf[sizeof (ULONGEST)] = {};
+ enum bfd_endian byte_order = i ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
+
+ /* Fill the src buffer (and later the dest buffer) with non-zero junk,
+ to ensure zero extensions aren't hidden. */
+ memset (srcbuf, 0xaa, sizeof (srcbuf));
+
+ /* Store (and later extract) using unsigned to ensure there are no sign
+ extensions. */
+ store_unsigned_integer (srcbuf, src_size, byte_order, src_val);
+
+ /* Test unsigned. */
+ memset (destbuf, 0xaa, sizeof (destbuf));
+ copy_integer_to_size (destbuf, dest_size, srcbuf, src_size, false,
+ byte_order);
+ SELF_CHECK (dest_valu == extract_unsigned_integer (destbuf, dest_size,
+ byte_order));
+
+ /* Test signed. */
+ memset (destbuf, 0xaa, sizeof (destbuf));
+ copy_integer_to_size (destbuf, dest_size, srcbuf, src_size, true,
+ byte_order);
+ SELF_CHECK (dest_vals == extract_unsigned_integer (destbuf, dest_size,
+ byte_order));
+ }
+}
+
+static void
+copy_integer_to_size_test ()
+{
+ /* Destination is bigger than the source, which has the signed bit unset. */
+ do_cint_test (0x12345678, 0x12345678, 8, 0x12345678, 4);
+ do_cint_test (0x345678, 0x345678, 8, 0x12345678, 3);
+
+ /* Destination is bigger than the source, which has the signed bit set. */
+ do_cint_test (0xdeadbeef, 0xffffffffdeadbeef, 8, 0xdeadbeef, 4);
+ do_cint_test (0xadbeef, 0xffffffffffadbeef, 8, 0xdeadbeef, 3);
+
+ /* Destination is smaller than the source. */
+ do_cint_test (0x5678, 0x5678, 2, 0x12345678, 3);
+ do_cint_test (0xbeef, 0xbeef, 2, 0xdeadbeef, 3);
+
+ /* Destination and source are the same size. */
+ do_cint_test (0x8765432112345678, 0x8765432112345678, 8, 0x8765432112345678,
+ 8);
+ do_cint_test (0x432112345678, 0x432112345678, 6, 0x8765432112345678, 6);
+ do_cint_test (0xfeedbeaddeadbeef, 0xfeedbeaddeadbeef, 8, 0xfeedbeaddeadbeef,
+ 8);
+ do_cint_test (0xbeaddeadbeef, 0xbeaddeadbeef, 6, 0xfeedbeaddeadbeef, 6);
+
+ /* Destination is bigger than the source. Source is bigger than 32bits. */
+ do_cint_test (0x3412345678, 0x3412345678, 8, 0x3412345678, 6);
+ do_cint_test (0xff12345678, 0xff12345678, 8, 0xff12345678, 6);
+ do_cint_test (0x432112345678, 0x432112345678, 8, 0x8765432112345678, 6);
+ do_cint_test (0xff2112345678, 0xffffff2112345678, 8, 0xffffff2112345678, 6);
+}
+
+} // namespace selftests
+
+#endif
+
+void _initialize_extract_store_integer ();
+void
+_initialize_extract_store_integer ()
+{
+#if GDB_SELF_TEST
+ selftests::register_test ("copy_integer_to_size",
+ selftests::copy_integer_to_size_test);
+#endif
+}
diff --git a/gdb/extract-store-integer.h b/gdb/extract-store-integer.h
new file mode 100644
index 00000000000..1ba5f82da9a
--- /dev/null
+++ b/gdb/extract-store-integer.h
@@ -0,0 +1,111 @@
+/* Copyright (C) 2024 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see . */
+
+#ifndef GDB_EXTRACT_STORE_INTEGER_H
+#define GDB_EXTRACT_STORE_INTEGER_H
+
+template>
+T extract_integer (gdb::array_view, enum bfd_endian byte_order);
+
+static inline LONGEST
+extract_signed_integer (gdb::array_view buf,
+ enum bfd_endian byte_order)
+{
+ return extract_integer (buf, byte_order);
+}
+
+static inline LONGEST
+extract_signed_integer (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order)
+{
+ return extract_signed_integer (gdb::array_view (addr, len),
+ byte_order);
+}
+
+static inline ULONGEST
+extract_unsigned_integer (gdb::array_view buf,
+ enum bfd_endian byte_order)
+{
+ return extract_integer (buf, byte_order);
+}
+
+static inline ULONGEST
+extract_unsigned_integer (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order)
+{
+ return extract_unsigned_integer (gdb::array_view (addr, len),
+ byte_order);
+}
+
+extern int extract_long_unsigned_integer (const gdb_byte *, int,
+ enum bfd_endian, LONGEST *);
+
+extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
+ struct type *type);
+
+/* All 'store' functions accept a host-format integer and store a
+ target-format integer at ADDR which is LEN bytes long. */
+
+template>
+extern void store_integer (gdb::array_view dst,
+ bfd_endian byte_order, T val);
+
+template
+static inline void
+store_integer (gdb_byte *addr, int len, bfd_endian byte_order, T val)
+{
+ return store_integer (gdb::make_array_view (addr, len), byte_order, val);
+}
+
+static inline void
+store_signed_integer (gdb::array_view dst, bfd_endian byte_order,
+ LONGEST val)
+{
+ return store_integer (dst, byte_order, val);
+}
+
+static inline void
+store_signed_integer (gdb_byte *addr, int len, bfd_endian byte_order,
+ LONGEST val)
+{
+ return store_signed_integer (gdb::make_array_view (addr, len), byte_order,
+ val);
+}
+
+static inline void
+store_unsigned_integer (gdb::array_view dst, bfd_endian byte_order,
+ ULONGEST val)
+{
+ return store_integer (dst, byte_order, val);
+}
+
+static inline void
+store_unsigned_integer (gdb_byte *addr, int len, bfd_endian byte_order,
+ ULONGEST val)
+{
+ return store_unsigned_integer (gdb::make_array_view (addr, len), byte_order,
+ val);
+}
+
+extern void store_typed_address (gdb_byte *buf, struct type *type,
+ CORE_ADDR addr);
+
+extern void copy_integer_to_size (gdb_byte *dest, int dest_size,
+ const gdb_byte *source, int source_size,
+ bool is_signed, enum bfd_endian byte_order);
+
+#endif /* GDB_EXTRACT_STORE_INTEGER_H */
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 593f5b4fd4a..a80f604fa78 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "auxv.h"
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "inferior.h"
#include "objfiles.h"
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 73449496169..660eb11c8b8 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "frame.h"
@@ -30,7 +31,6 @@
#include "block.h"
#include "objfiles.h"
#include "language.h"
-#include "gdbsupport/selftest.h"
/* Basic byte-swapping routines. All 'extract' functions return a
host-format integer from a target-format integer at ADDR which is
@@ -44,151 +44,6 @@
you lose
#endif
-template
-T
-extract_integer (gdb::array_view buf, enum bfd_endian byte_order)
-{
- typename std::make_unsigned::type retval = 0;
-
- if (buf.size () > (int) sizeof (T))
- error (_("\
-That operation is not available on integers of more than %d bytes."),
- (int) sizeof (T));
-
- /* Start at the most significant end of the integer, and work towards
- the least significant. */
- if (byte_order == BFD_ENDIAN_BIG)
- {
- size_t i = 0;
-
- if (std::is_signed::value)
- {
- /* Do the sign extension once at the start. */
- retval = ((LONGEST) buf[i] ^ 0x80) - 0x80;
- ++i;
- }
- for (; i < buf.size (); ++i)
- retval = (retval << 8) | buf[i];
- }
- else
- {
- ssize_t i = buf.size () - 1;
-
- if (std::is_signed::value)
- {
- /* Do the sign extension once at the start. */
- retval = ((LONGEST) buf[i] ^ 0x80) - 0x80;
- --i;
- }
- for (; i >= 0; --i)
- retval = (retval << 8) | buf[i];
- }
- return retval;
-}
-
-/* Explicit instantiations. */
-template LONGEST extract_integer (gdb::array_view buf,
- enum bfd_endian byte_order);
-template ULONGEST extract_integer
- (gdb::array_view buf, enum bfd_endian byte_order);
-
-/* Treat the bytes at BUF as a pointer of type TYPE, and return the
- address it represents. */
-CORE_ADDR
-extract_typed_address (const gdb_byte *buf, struct type *type)
-{
- gdb_assert (type->is_pointer_or_reference ());
- return gdbarch_pointer_to_address (type->arch (), type, buf);
-}
-
-/* All 'store' functions accept a host-format integer and store a
- target-format integer at ADDR which is LEN bytes long. */
-template
-void
-store_integer (gdb::array_view dst, enum bfd_endian byte_order,
- T val)
-{
- gdb_byte *p;
- gdb_byte *startaddr = dst.data ();
- gdb_byte *endaddr = startaddr + dst.size ();
-
- /* Start at the least significant end of the integer, and work towards
- the most significant. */
- if (byte_order == BFD_ENDIAN_BIG)
- {
- for (p = endaddr - 1; p >= startaddr; --p)
- {
- *p = val & 0xff;
- val >>= 8;
- }
- }
- else
- {
- for (p = startaddr; p < endaddr; ++p)
- {
- *p = val & 0xff;
- val >>= 8;
- }
- }
-}
-
-/* Explicit instantiations. */
-template void store_integer (gdb::array_view dst,
- bfd_endian byte_order, LONGEST val);
-
-template void store_integer (gdb::array_view dst,
- bfd_endian byte_order, ULONGEST val);
-
-/* Store the address ADDR as a pointer of type TYPE at BUF, in target
- form. */
-void
-store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
-{
- gdb_assert (type->is_pointer_or_reference ());
- gdbarch_address_to_pointer (type->arch (), type, buf, addr);
-}
-
-/* Copy a value from SOURCE of size SOURCE_SIZE bytes to DEST of size DEST_SIZE
- bytes. If SOURCE_SIZE is greater than DEST_SIZE, then truncate the most
- significant bytes. If SOURCE_SIZE is less than DEST_SIZE then either sign
- or zero extended according to IS_SIGNED. Values are stored in memory with
- endianness BYTE_ORDER. */
-
-void
-copy_integer_to_size (gdb_byte *dest, int dest_size, const gdb_byte *source,
- int source_size, bool is_signed,
- enum bfd_endian byte_order)
-{
- signed int size_diff = dest_size - source_size;
-
- /* Copy across everything from SOURCE that can fit into DEST. */
-
- if (byte_order == BFD_ENDIAN_BIG && size_diff > 0)
- memcpy (dest + size_diff, source, source_size);
- else if (byte_order == BFD_ENDIAN_BIG && size_diff < 0)
- memcpy (dest, source - size_diff, dest_size);
- else
- memcpy (dest, source, std::min (source_size, dest_size));
-
- /* Fill the remaining space in DEST by either zero extending or sign
- extending. */
-
- if (size_diff > 0)
- {
- gdb_byte extension = 0;
- if (is_signed
- && ((byte_order != BFD_ENDIAN_BIG && source[source_size - 1] & 0x80)
- || (byte_order == BFD_ENDIAN_BIG && source[0] & 0x80)))
- extension = 0xff;
-
- /* Extend into MSBs of SOURCE. */
- if (byte_order == BFD_ENDIAN_BIG)
- memset (dest, extension, size_diff);
- else
- memset (dest + source_size, extension, size_diff);
- }
-}
-
/* See value.h. */
value *
@@ -800,95 +655,3 @@ address_from_register (int regnum, const frame_info_ptr &frame)
return value_as_address (v.get ());
}
-
-#if GDB_SELF_TEST
-namespace selftests {
-namespace findvar_tests {
-
-/* Function to test copy_integer_to_size. Store SOURCE_VAL with size
- SOURCE_SIZE to a buffer, making sure no sign extending happens at this
- stage. Copy buffer to a new buffer using copy_integer_to_size. Extract
- copied value and compare to DEST_VALU. Copy again with a signed
- copy_integer_to_size and compare to DEST_VALS. Do everything for both
- LITTLE and BIG target endians. Use unsigned values throughout to make
- sure there are no implicit sign extensions. */
-
-static void
-do_cint_test (ULONGEST dest_valu, ULONGEST dest_vals, int dest_size,
- ULONGEST src_val, int src_size)
-{
- for (int i = 0; i < 2 ; i++)
- {
- gdb_byte srcbuf[sizeof (ULONGEST)] = {};
- gdb_byte destbuf[sizeof (ULONGEST)] = {};
- enum bfd_endian byte_order = i ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
-
- /* Fill the src buffer (and later the dest buffer) with non-zero junk,
- to ensure zero extensions aren't hidden. */
- memset (srcbuf, 0xaa, sizeof (srcbuf));
-
- /* Store (and later extract) using unsigned to ensure there are no sign
- extensions. */
- store_unsigned_integer (srcbuf, src_size, byte_order, src_val);
-
- /* Test unsigned. */
- memset (destbuf, 0xaa, sizeof (destbuf));
- copy_integer_to_size (destbuf, dest_size, srcbuf, src_size, false,
- byte_order);
- SELF_CHECK (dest_valu == extract_unsigned_integer (destbuf, dest_size,
- byte_order));
-
- /* Test signed. */
- memset (destbuf, 0xaa, sizeof (destbuf));
- copy_integer_to_size (destbuf, dest_size, srcbuf, src_size, true,
- byte_order);
- SELF_CHECK (dest_vals == extract_unsigned_integer (destbuf, dest_size,
- byte_order));
- }
-}
-
-static void
-copy_integer_to_size_test ()
-{
- /* Destination is bigger than the source, which has the signed bit unset. */
- do_cint_test (0x12345678, 0x12345678, 8, 0x12345678, 4);
- do_cint_test (0x345678, 0x345678, 8, 0x12345678, 3);
-
- /* Destination is bigger than the source, which has the signed bit set. */
- do_cint_test (0xdeadbeef, 0xffffffffdeadbeef, 8, 0xdeadbeef, 4);
- do_cint_test (0xadbeef, 0xffffffffffadbeef, 8, 0xdeadbeef, 3);
-
- /* Destination is smaller than the source. */
- do_cint_test (0x5678, 0x5678, 2, 0x12345678, 3);
- do_cint_test (0xbeef, 0xbeef, 2, 0xdeadbeef, 3);
-
- /* Destination and source are the same size. */
- do_cint_test (0x8765432112345678, 0x8765432112345678, 8, 0x8765432112345678,
- 8);
- do_cint_test (0x432112345678, 0x432112345678, 6, 0x8765432112345678, 6);
- do_cint_test (0xfeedbeaddeadbeef, 0xfeedbeaddeadbeef, 8, 0xfeedbeaddeadbeef,
- 8);
- do_cint_test (0xbeaddeadbeef, 0xbeaddeadbeef, 6, 0xfeedbeaddeadbeef, 6);
-
- /* Destination is bigger than the source. Source is bigger than 32bits. */
- do_cint_test (0x3412345678, 0x3412345678, 8, 0x3412345678, 6);
- do_cint_test (0xff12345678, 0xff12345678, 8, 0xff12345678, 6);
- do_cint_test (0x432112345678, 0x432112345678, 8, 0x8765432112345678, 6);
- do_cint_test (0xff2112345678, 0xffffff2112345678, 8, 0xffffff2112345678, 6);
-}
-
-} // namespace findvar_test
-} // namespace selftests
-
-#endif
-
-void _initialize_findvar ();
-void
-_initialize_findvar ()
-{
-#if GDB_SELF_TEST
- selftests::register_test
- ("copy_integer_to_size",
- selftests::findvar_tests::copy_integer_to_size_test);
-#endif
-}
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index a80421a9c5a..e5f108d3257 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "dummy-frame.h"
diff --git a/gdb/frame.c b/gdb/frame.c
index f042bbb2ec2..719fa051afc 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "frame.h"
+#include "extract-store-integer.h"
#include "target.h"
#include "value.h"
#include "inferior.h"
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 0b13a81c064..46424453ef0 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "target.h"
#include "frame.h"
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 5c026ebd53a..1b5e15f831b 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "inferior.h"
#include "gdbcore.h"
#include "arch-utils.h"
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index c5a48bebe5f..8f7aa51b58a 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 90f5b29dd8e..1311a99ad8c 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "language.h"
#include "value.h"
#include "cp-abi.h"
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 32907e29abf..e91d664ffa3 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -22,6 +22,7 @@
sac@cygnus.com
*/
+#include "extract-store-integer.h"
#include "value.h"
#include "arch-utils.h"
#include "regcache.h"
diff --git a/gdb/hppa-bsd-tdep.c b/gdb/hppa-bsd-tdep.c
index dacda88c586..67fee6bb1c8 100644
--- a/gdb/hppa-bsd-tdep.c
+++ b/gdb/hppa-bsd-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "objfiles.h"
#include "target.h"
#include "value.h"
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 659c265bfb8..8f73f8d2374 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "osabi.h"
#include "target.h"
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 8becfd5f9f9..be8ea579893 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -21,6 +21,7 @@
along with this program. If not, see . */
#include "bfd.h"
+#include "extract-store-integer.h"
#include "inferior.h"
#include "regcache.h"
#include "completer.h"
diff --git a/gdb/i386-bsd-tdep.c b/gdb/i386-bsd-tdep.c
index db00e18bccf..ba7817a39b9 100644
--- a/gdb/i386-bsd-tdep.c
+++ b/gdb/i386-bsd-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "gdbcore.h"
#include "regcache.h"
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
index 5a5c8bffc21..0481296a46b 100644
--- a/gdb/i386-darwin-tdep.c
+++ b/gdb/i386-darwin-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "gdbcore.h"
diff --git a/gdb/i386-gnu-tdep.c b/gdb/i386-gnu-tdep.c
index fb308215a7a..98e11518a91 100644
--- a/gdb/i386-gnu-tdep.c
+++ b/gdb/i386-gnu-tdep.c
@@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "osabi.h"
#include "solib-svr4.h"
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 44730f204db..a78f03fac8d 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "frame.h"
#include "value.h"
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 674d45feba9..6f3441597a2 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "osabi.h"
#include "regcache.h"
diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c
index 6e31567328e..3539c6599a0 100644
--- a/gdb/i386-obsd-tdep.c
+++ b/gdb/i386-obsd-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbcore.h"
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 1b1efad6fa3..4b1c60ee924 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "opcode/i386.h"
#include "arch-utils.h"
#include "command.h"
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 00c9523ff25..45bd43a50a9 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "gdbcore.h"
#include "inferior.h"
diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
index 676fdb8edac..12083e94ca3 100644
--- a/gdb/ia64-linux-tdep.c
+++ b/gdb/ia64-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "ia64-tdep.h"
#include "arch-utils.h"
#include "gdbcore.h"
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index f49a8d6b558..6376cf8d069 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "inferior.h"
#include "gdbcore.h"
#include "arch-utils.h"
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index b9d95bbc267..5776c66f78a 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -20,6 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/jit.c b/gdb/jit.c
index 3843b84b0e6..92cac0d342a 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -19,6 +19,7 @@
#include "jit.h"
+#include "extract-store-integer.h"
#include "jit-reader.h"
#include "block.h"
#include "breakpoint.h"
diff --git a/gdb/linux-nat-trad.c b/gdb/linux-nat-trad.c
index d90d76fd9a0..b2c982d997e 100644
--- a/gdb/linux-nat-trad.c
+++ b/gdb/linux-nat-trad.c
@@ -19,6 +19,7 @@
#include "linux-nat-trad.h"
+#include "extract-store-integer.h"
#include "nat/gdb_ptrace.h"
#include "inf-ptrace.h"
#include "gdbarch.h"
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 6430c0e0088..549ea1bd713 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "target.h"
#include "gdbtypes.h"
#include "regcache.h"
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 478f1edf3e6..98a07281051 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index a57dc31cde8..71578060303 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "glibc-tdep.h"
#include "inferior.h"
#include "linux-tdep.h"
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index 149fbd55db9..af0d6896143 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -20,6 +20,7 @@
#include "arch-utils.h"
#include "dwarf2/frame.h"
#include "elf-bfd.h"
+#include "extract-store-integer.h"
#include "frame-unwind.h"
#include "gdbcore.h"
#include "loongarch-tdep.h"
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 33ec44349d7..d9890d0e464 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "sim/sim-m32c.h"
#include "gdbtypes.h"
#include "regcache.h"
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index a28e1135840..8eea6620df9 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "frame.h"
#include "value.h"
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 215df88b21c..e2129409c19 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 70b3f129d5a..e117d8e2919 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -20,6 +20,7 @@
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c
index 4874db720db..7250ce09826 100644
--- a/gdb/m68k-linux-tdep.c
+++ b/gdb/m68k-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "frame.h"
#include "target.h"
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index f73f58de90a..1b8cc927e0c 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "dwarf2/frame.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index fdb589134da..7d87d641008 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index ab788a20231..7f8a34ba18f 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -20,6 +20,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "target.h"
#include "inferior.h"
#include "infrun.h"
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 1886c973bdc..8d045c69c10 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -19,6 +19,7 @@
#include "arch-utils.h"
#include "dis-asm.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "trad-frame.h"
#include "symtab.h"
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index 188ef4099da..7452057e74b 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "osabi.h"
#include "regset.h"
#include "trad-frame.h"
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 79508f0fce7..7bd96a8e200 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "target.h"
#include "solib-svr4.h"
diff --git a/gdb/mips-netbsd-tdep.c b/gdb/mips-netbsd-tdep.c
index 63068a18fe8..b8134a671bf 100644
--- a/gdb/mips-netbsd-tdep.c
+++ b/gdb/mips-netbsd-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "regcache.h"
#include "regset.h"
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c34971c60c1..0abac41e3f9 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -20,6 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index cd70f8adb68..d44eebfcb17 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -19,6 +19,7 @@
#include "arch-utils.h"
#include "dis-asm.h"
+#include "extract-store-integer.h"
#include "gdbtypes.h"
#include "regcache.h"
#include "gdbcore.h"
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index a6b783e5c84..3bfde1be665 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 9d90a6e2784..017ebb432d4 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -21,6 +21,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "prologue-value.h"
#include "target.h"
#include "regcache.h"
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index bbbc80b37cd..8ad51d0798b 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index da2616b436e..956eb023eb9 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 937902b4f0a..eeef52db4a1 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -21,6 +21,7 @@
#include
#include "nto-tdep.h"
+#include "extract-store-integer.h"
#include "top.h"
#include "inferior.h"
#include "infrun.h"
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index d4ac0ac1b9d..db74b590f18 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index adc6402084d..ddacccce1b2 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -19,6 +19,7 @@
/* This file is derived from c-lang.c */
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 7f6d7dc6e6b..87c0c35cb99 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -19,6 +19,7 @@
/* This file is derived from c-valprint.c */
+#include "extract-store-integer.h"
#include "gdbsupport/gdb_obstack.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/ppc-fbsd-tdep.c b/gdb/ppc-fbsd-tdep.c
index 8f86607d5d1..3f0f93f1ac0 100644
--- a/gdb/ppc-fbsd-tdep.c
+++ b/gdb/ppc-fbsd-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "gdbcore.h"
#include "frame-unwind.h"
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 2ed6e6e5068..c73c7c90b4c 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "gdbthread.h"
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 2da2d32eb26..e70eb2e8b66 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
diff --git a/gdb/ppc-obsd-tdep.c b/gdb/ppc-obsd-tdep.c
index b50a24c6af7..1bd79b3b3e1 100644
--- a/gdb/ppc-obsd-tdep.c
+++ b/gdb/ppc-obsd-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbtypes.h"
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 9d0e8a95a77..47e6292992e 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "language.h"
#include "gdbcore.h"
#include "inferior.h"
diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c
index 8f91d06a085..79bc4da71e2 100644
--- a/gdb/ppc64-tdep.c
+++ b/gdb/ppc64-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "gdbcore.h"
#include "infrun.h"
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index ae56b9d2fa9..79da7ea4e22 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 77fdacfd61e..d61340420e7 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -20,6 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "inferior.h"
#include "infrun.h"
#include "target.h"
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index ecc9235c917..55d54f4bdf1 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "gdbthread.h"
#include "ada-lang.h"
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 2e67cf5b428..9d8c4ee438f 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcmd.h"
#include "regcache.h"
#include "gdbthread.h"
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c35a8138a39..0e754ec5437 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "inferior.h"
#include "gdbthread.h"
#include "target.h"
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index eaa0d8f619a..9615dedaebd 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -19,6 +19,7 @@
/* See the GDB User Guide for details of the GDB remote protocol. */
+#include "extract-store-integer.h"
#include "gdbcmd.h"
#include "remote.h"
#include "gdbsupport/gdb_wait.h"
diff --git a/gdb/riscv-fbsd-tdep.c b/gdb/riscv-fbsd-tdep.c
index 68f726743d9..4761edc6667 100644
--- a/gdb/riscv-fbsd-tdep.c
+++ b/gdb/riscv-fbsd-tdep.c
@@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "fbsd-tdep.h"
#include "osabi.h"
#include "riscv-tdep.h"
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index fe4da1a1f9d..89091689f6e 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index acd0731dd9f..46a7ee9c3d4 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -20,6 +20,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "prologue-value.h"
#include "target.h"
#include "regcache.h"
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 5111f4f55c0..3faefe58ceb 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "osabi.h"
#include "regcache.h"
#include "regset.h"
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index 550e0688203..17244b3c45a 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -15,6 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "osabi.h"
#include "regcache.h"
#include "gdbcore.h"
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index b7ba0042bb7..e0698928dc8 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "inferior.h"
#include "infrun.h"
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 844e36023e0..6b12fe0a314 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -20,6 +20,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "prologue-value.h"
#include "target.h"
#include "regcache.h"
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index fa4aaf9aa9a..6bb84b2ff69 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "regcache.h"
#include "inferior.h"
#include "target.h"
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 519e3eb0a42..6687127d0aa 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -23,6 +23,7 @@
#include "dwarf2/frame.h"
#include "elf/s390.h"
#include "elf-bfd.h"
+#include "extract-store-integer.h"
#include "frame-base.h"
#include "frame-unwind.h"
#include "gdbarch.h"
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 1c67ea42b04..efbe1564767 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -20,6 +20,7 @@
/* Contributed by Steve Chamberlain
sac@cygnus.com. */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 6943b2df586..f0828fdf102 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -19,6 +19,7 @@
#include "bfd.h"
+#include "extract-store-integer.h"
#include "objfiles.h"
#include "gdbcore.h"
#include "target.h"
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 0208ed13eff..11225f72ed0 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -17,6 +17,7 @@
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "inferior.h"
#include "gdbcore.h"
#include "solib.h"
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index aef609378a4..39508fab4c8 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -17,6 +17,7 @@
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "gdbcore.h"
#include "solib.h"
#include "solist.h"
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 49dd1e9aa33..1dd04c29c98 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -22,6 +22,7 @@
#include "elf/common.h"
#include "elf/mips.h"
+#include "extract-store-integer.h"
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"
diff --git a/gdb/solib.c b/gdb/solib.c
index 2f69c3372b0..a656b623458 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -19,6 +19,7 @@
#include
+#include "extract-store-integer.h"
#include "symtab.h"
#include "bfd.h"
#include "build-id.h"
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index fac4c7d773d..2cf83ebd906 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "dwarf2/frame.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbtypes.h"
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index d6166710709..3182a7778d3 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbcore.h"
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index fbc27ffcb5e..edbc03878dc 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -21,6 +21,7 @@
#include "dis-asm.h"
#include "dwarf2.h"
#include "dwarf2/frame.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index e91bba3aadb..de444659d9f 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "dwarf2/frame.h"
diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c
index 6caeb107b9f..cef6efd3379 100644
--- a/gdb/sparc64-obsd-tdep.c
+++ b/gdb/sparc64-obsd-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbcore.h"
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index a55107fa32d..9c8deaac021 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -19,6 +19,7 @@
#include "arch-utils.h"
#include "dwarf2/frame.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/stack.c b/gdb/stack.c
index 9c679222708..2922265515d 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "value.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 0b66554efae..8646f874dcc 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "stap-probe.h"
+#include "extract-store-integer.h"
#include "probe.h"
#include "ui-out.h"
#include "objfiles.h"
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 2a7d41dc974..b7570a32dc0 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -21,6 +21,7 @@
#include "arch-utils.h"
#include "bfdlink.h"
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "gdbcore.h"
diff --git a/gdb/target.c b/gdb/target.c
index d9ff7d64825..091dc4cc8ac 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -20,6 +20,7 @@
along with this program. If not, see . */
#include "target.h"
+#include "extract-store-integer.h"
#include "target-dcache.h"
#include "gdbcmd.h"
#include "symtab.h"
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 3a63b0cc25d..ac6e291bacc 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index d5ea93cf503..70a956139a3 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 79af963b049..eb879c17970 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "tracefile.h"
#include "readline/tilde.h"
#include "gdbsupport/filestuff.h"
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index 9db68bbac51..2d89ab739ff 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "tracefile.h"
+#include "extract-store-integer.h"
#include "tracectf.h"
#include "exec.h"
#include "regcache.h"
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index fc926131478..e64374a67af 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "trad-frame.h"
#include "regcache.h"
diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c
index 4b397cbf046..4f7c62d11fa 100644
--- a/gdb/tramp-frame.c
+++ b/gdb/tramp-frame.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "tramp-frame.h"
+#include "extract-store-integer.h"
#include "frame-unwind.h"
#include "gdbcore.h"
#include "symtab.h"
diff --git a/gdb/unittests/gmp-utils-selftests.c b/gdb/unittests/gmp-utils-selftests.c
index 3c6b71062a7..f8f978179ea 100644
--- a/gdb/unittests/gmp-utils-selftests.c
+++ b/gdb/unittests/gmp-utils-selftests.c
@@ -19,6 +19,7 @@
#include "gmp-utils.h"
#include "gdbsupport/selftest.h"
+#include "extract-store-integer.h"
#include
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 6bda14f0fa1..531fdb48ab0 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "trad-frame.h"
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 6b152cadcac..7034fa6096b 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "value.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/valops.c b/gdb/valops.c
index a17b937a963..f9b54a5d9a9 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 40ffdbe6146..13e80c06c9f 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
diff --git a/gdb/value.c b/gdb/value.c
index 1bd180a62cc..4df19fde304 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -18,6 +18,7 @@
along with this program. If not, see . */
#include "arch-utils.h"
+#include "extract-store-integer.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index dd00898c298..a42c872feff 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -19,6 +19,7 @@
#include "arch-utils.h"
#include "dis-asm.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index f9585adf8fa..af5ccd1a629 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -16,6 +16,7 @@
along with this program. If not, see . */
#include "windows-tdep.h"
+#include "extract-store-integer.h"
#include "gdbsupport/gdb_obstack.h"
#include "xml-support.h"
#include "gdbarch.h"
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 166e6af8527..a0f6c319b12 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 2c3d468d8be..9dcd3ef06fa 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#include "extract-store-integer.h"
#include "frame.h"
#include "solib-svr4.h"
#include "symtab.h"
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index ee8e36b1867..530139dbb61 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -19,6 +19,7 @@
#include "arch-utils.h"
#include "dis-asm.h"
+#include "extract-store-integer.h"
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"