21#include "gdbsupport/selftest.h"
26#include "gdbsupport/def-vector.h"
40 struct type *types[] =
74 scoped_mock_context<test_target_ops> mockctx (
gdbarch);
81 for (
const auto &
type : types)
87 std::vector<gdb_byte> expected (
type->
length (), 0);
96 for (
auto j = 0; j < expected.size (); j++)
97 expected[j] = (
regnum + j) % 16;
104 std::vector<gdb_byte> buf (
type->
length () + 2, 0);
105 int optim, unavail, ok;
111 buf.data (), &optim, &unavail);
115 SELF_CHECK (!unavail);
121 SELF_CHECK (buf[k] == expected[k]);
132 scoped_mock_context<test_target_ops> mockctx (
gdbarch);
135 std::map<const std::string, int> name_counts;
145 if (run_verbose() &&
name ==
nullptr)
146 debug_printf (
"arch: %s, register: %d returned nullptr\n",
149 SELF_CHECK (
name !=
nullptr);
157 std::string s (
name);
159 if (run_verbose() && name_counts[s] > 1)
160 debug_printf (
"arch: %s, register: %d (%s) is a duplicate\n",
163 SELF_CHECK (name_counts[s] == 1);
frame_info_ptr get_current_frame(void)
void gdbarch_value_to_register(struct gdbarch *gdbarch, frame_info_ptr frame, int regnum, struct type *type, const gdb_byte *buf)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
int gdbarch_register_to_value(struct gdbarch *gdbarch, frame_info_ptr frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep)
int gdbarch_convert_register_p(struct gdbarch *gdbarch, int regnum, struct type *type)
const struct bfd_arch_info * gdbarch_bfd_arch_info(struct gdbarch *gdbarch)
void _initialize_gdbarch_selftests()
static int gdbarch_num_cooked_regs(gdbarch *arch)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
static void register_name_test(struct gdbarch *gdbarch)
static void register_to_value_test(struct gdbarch *gdbarch)
void register_test_foreach_arch(const std::string &name, self_test_foreach_arch_function *function)
struct type * builtin_signed_char
struct type * builtin_long_long
struct type * builtin_uint16
struct type * builtin_double
struct type * builtin_string
struct type * builtin_int8
struct type * builtin_uint128
struct type * builtin_long
struct type * builtin_bool
struct type * builtin_complex
struct type * builtin_long_double
struct type * builtin_unsigned_long_long
struct type * builtin_uint32
struct type * builtin_uint64
struct type * builtin_char16
struct type * builtin_short
struct type * builtin_double_complex
struct type * builtin_int64
struct type * builtin_char
struct type * builtin_int
struct type * builtin_int32
struct type * builtin_unsigned_short
struct type * builtin_unsigned_int
struct type * builtin_char32
struct type * builtin_uint8
struct type * builtin_int128
struct type * builtin_unsigned_long
struct type * builtin_int16
struct type * builtin_void
struct type * builtin_float
bool target_float_from_string(gdb_byte *addr, const struct type *type, const std::string &string)