diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2024-04-22 16:10:14 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-04-22 21:34:19 -0400 |
commit | ec4525259262492b61fb9bd2f9acdf156ab037fc (patch) | |
tree | 73e3cf9b3f4049db32037f6ede09abd6dd08ec71 /gdb/defs.h | |
parent | 15afb100ea6bc04d8944a919bf58c5c3fb8c20ec (diff) | |
download | binutils-ec4525259262492b61fb9bd2f9acdf156ab037fc.zip binutils-ec4525259262492b61fb9bd2f9acdf156ab037fc.tar.gz binutils-ec4525259262492b61fb9bd2f9acdf156ab037fc.tar.bz2 |
gdb: move store/extract integer functions to extract-store-integer.{c,h}
Move the declarations out of defs.h, and the implementations out of
findvar.c.
I opted for a new file, because this functionality of converting
integers to bytes and vice-versa seems a bit to generic to live in
findvar.c.
Change-Id: I524858fca33901ee2150c582bac16042148d2251
Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/defs.h')
-rw-r--r-- | gdb/defs.h | 89 |
1 files changed, 0 insertions, 89 deletions
@@ -422,95 +422,6 @@ enum symbol_needs_kind SYMBOL_NEEDS_FRAME }; -/* In findvar.c. */ - -template<typename T, typename = RequireLongest<T>> -T extract_integer (gdb::array_view<const gdb_byte>, enum bfd_endian byte_order); - -static inline LONGEST -extract_signed_integer (gdb::array_view<const gdb_byte> buf, - enum bfd_endian byte_order) -{ - return extract_integer<LONGEST> (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<const gdb_byte> (addr, len), - byte_order); -} - -static inline ULONGEST -extract_unsigned_integer (gdb::array_view<const gdb_byte> buf, - enum bfd_endian byte_order) -{ - return extract_integer<ULONGEST> (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<const gdb_byte> (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<typename T, typename = RequireLongest<T>> -extern void store_integer (gdb::array_view<gdb_byte> dst, - bfd_endian byte_order, T val); - -template<typename T> -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<gdb_byte> 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<gdb_byte> 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; |