tdesc_create_reg (feature, "hid0", 119, 1, NULL, 32, "int");
tdesc_create_reg (feature, "hid1", 120, 1, NULL, 32, "int");
tdesc_create_reg (feature, "iabr", 121, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "dabr", 122, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "pir", 123, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "mmcr0", 124, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "pmc1", 125, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "pmc2", 126, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "sia", 127, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "sda", 128, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "pir", 122, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "mmcr0", 123, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "pmc1", 124, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "pmc2", 125, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "sia", 126, 1, NULL, 32, "int");
+ tdesc_create_reg (feature, "sda", 127, 1, NULL, 32, "int");
tdesc_powerpc_604 = result.release ();
}
tdesc_create_reg (feature, "hid0", 119, 1, NULL, 32, "int");
tdesc_create_reg (feature, "hid1", 120, 1, NULL, 32, "int");
tdesc_create_reg (feature, "iabr", 121, 1, NULL, 32, "int");
- tdesc_create_reg (feature, "dabr", 122, 1, NULL, 32, "int");
tdesc_create_reg (feature, "ummcr0", 124, 1, NULL, 32, "int");
tdesc_create_reg (feature, "upmc1", 125, 1, NULL, 32, "int");
tdesc_create_reg (feature, "upmc2", 126, 1, NULL, 32, "int");
#include "gdbarch.h"
#include "scoped-mock-context.h"
+#include <map>
+
namespace selftests {
/* Test gdbarch methods register_to_value and value_to_register. */
{
scoped_mock_context<test_target_ops> mockctx (gdbarch);
+ /* Track the number of times each register name appears. */
+ std::map<const std::string, int> name_counts;
+
const int num_regs = gdbarch_num_cooked_regs (gdbarch);
for (auto regnum = 0; regnum < num_regs; regnum++)
{
debug_printf ("arch: %s, register: %d returned nullptr\n",
gdbarch_bfd_arch_info (gdbarch)->printable_name,
regnum);
-
SELF_CHECK (name != nullptr);
+
+ /* Every register name, that is not the empty string, should be
+ unique. If this is not the case then the user will see duplicate
+ copies of the register in e.g. 'info registers' output, but will
+ only be able to interact with one of the copies. */
+ if (*name != '\0')
+ {
+ std::string s (name);
+ name_counts[s]++;
+ if (run_verbose() && name_counts[s] > 1)
+ debug_printf ("arch: %s, register: %d (%s) is a duplicate\n",
+ gdbarch_bfd_arch_info (gdbarch)->printable_name,
+ regnum, name);
+ SELF_CHECK (name_counts[s] == 1);
+ }
}
}