static void
prefixify_expression PARAMS ((struct expression *));
-static int
-length_of_subexp PARAMS ((struct expression *, int));
-
static void
prefixify_subexp PARAMS ((struct expression *, struct expression *, int, int));
#endif
+/* The generic method for targets to specify how their registers are named.
+ The mapping can be derived from three sources: reg_names; std_regs; or
+ a target specific alias hook. */
+
+int
+target_map_name_to_register (str, len)
+ char *str;
+ int len;
+{
+ int i;
+
+ /* First try target specific aliases. We try these first because on some
+ systems standard names can be context dependent (eg. $pc on a
+ multiprocessor can be could be any of several PCs). */
+#ifdef REGISTER_NAME_ALIAS_HOOK
+ i = REGISTER_NAME_ALIAS_HOOK (str, len);
+ if (i >= 0)
+ return i;
+#endif
+
+ /* Search architectural register name space. */
+ for (i = 0; i < NUM_REGS; i++)
+ if (reg_names[i] && len == strlen (reg_names[i])
+ && STREQN (str, reg_names[i], len))
+ {
+ return i;
+ }
+
+ /* Try standard aliases */
+ for (i = 0; i < num_std_regs; i++)
+ if (std_regs[i].name && len == strlen (std_regs[i].name)
+ && STREQN (str, std_regs[i].name, len))
+ {
+ return std_regs[i].regnum;
+ }
+
+ return -1;
+}
/* Begin counting arguments for a function call,
saving the data about any containing call. */
/* Handle tokens that refer to machine registers:
$ followed by a register name. */
- for (i = 0; i < NUM_REGS; i++)
- if (reg_names[i] && str.length - 1 == strlen (reg_names[i])
- && STREQN (str.ptr + 1, reg_names[i], str.length - 1))
- {
- goto handle_register;
- }
- for (i = 0; i < num_std_regs; i++)
- if (std_regs[i].name && str.length - 1 == strlen (std_regs[i].name)
- && STREQN (str.ptr + 1, std_regs[i].name, str.length - 1))
- {
- i = std_regs[i].regnum;
- goto handle_register;
- }
+ i = target_map_name_to_register( str.ptr + 1, str.length - 1 );
+ if( i >= 0 )
+ goto handle_register;
/* Any other names starting in $ are debugger internal variables. */
/* Return the number of exp_elements in the subexpression of EXPR
whose last exp_element is at index ENDPOS - 1 in EXPR. */
-static int
+int
length_of_subexp (expr, endpos)
register struct expression *expr;
register int endpos;
case OP_LABELED:
case STRUCTOP_STRUCT:
case STRUCTOP_PTR:
-/* start-sanitize-gm */
-#ifdef GENERAL_MAGIC
- case STRUCTOP_FIELD:
-#endif /* GENERAL_MAGIC */
-/* end-sanitize-gm */
args = 1;
/* fall through */
case OP_M2_STRING: