/* *INDENT-OFF* */ /* ATTRIBUTE_PRINTF confuses indent, avoid running it
for now. */
/* Basic, host-specific, and target-specific definitions for GDB.
- Copyright (C) 1986-2021 Free Software Foundation, Inc.
+ Copyright (C) 1986-2022 Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbsupport/host-defs.h"
#include "gdbsupport/enum-flags.h"
+#include "gdbsupport/array-view.h"
/* Scope types enumerator. List the types of scopes the compiler will
accept. */
/* In findvar.c. */
template<typename T, typename = RequireLongest<T>>
-T extract_integer (const gdb_byte *addr, int len, enum bfd_endian byte_order);
+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_integer<LONGEST> (addr, len, 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_integer<ULONGEST> (addr, len, byte_order);
+ return extract_unsigned_integer (gdb::array_view<const gdb_byte> (addr, len),
+ byte_order);
}
extern int extract_long_unsigned_integer (const gdb_byte *, int,