aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c97
1 files changed, 22 insertions, 75 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index b3fbe19..9c1f3e1 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -47,6 +47,8 @@
#include "inferior.h" /* for NUM_PSEUDO_REGS. NOTE: replace
with "gdbarch.h" when appropriate. */
#include "doublest.h"
+#include "builtin-regs.h"
+#include "gdb_assert.h"
/* Symbols which architectures can redefine. */
@@ -74,6 +76,7 @@ int arglist_len;
union type_stack_elt *type_stack;
int type_stack_depth, type_stack_size;
char *lexptr;
+char *prev_lexptr;
char *namecopy;
int paren_depth;
int comma_terminates;
@@ -102,15 +105,9 @@ struct funcall
static struct funcall *funcall_chain;
-/* Assign machine-independent names to certain registers
- (unless overridden by the REGISTER_NAMES table) */
-
-unsigned num_std_regs = 0;
-struct std_regs *std_regs;
-
/* The generic method for targets to specify how their registers are
- named. The mapping can be derived from three sources:
- REGISTER_NAME; std_regs; or a target specific alias hook. */
+ named. The mapping can be derived from two sources: REGISTER_NAME;
+ or builtin regs. */
int
target_map_name_to_register (char *str, int len)
@@ -125,13 +122,21 @@ target_map_name_to_register (char *str, int 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;
- }
+ /* Try builtin registers. */
+ i = builtin_reg_map_name_to_regnum (str, len);
+ if (i >= 0)
+ {
+ gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS);
+ return i;
+ }
+
+ /* Try builtin registers. */
+ i = builtin_reg_map_name_to_regnum (str, len);
+ if (i >= 0)
+ {
+ gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS);
+ return i;
+ }
return -1;
}
@@ -1122,6 +1127,7 @@ parse_exp_1 (char **stringptr, struct block *block, int comma)
struct cleanup *old_chain;
lexptr = *stringptr;
+ prev_lexptr = NULL;
paren_depth = 0;
type_stack_depth = 0;
@@ -1134,7 +1140,7 @@ parse_exp_1 (char **stringptr, struct block *block, int comma)
old_chain = make_cleanup (free_funcalls, 0 /*ignore*/);
funcall_chain = 0;
- expression_context_block = block ? block : get_selected_block ();
+ expression_context_block = block ? block : get_selected_block (0);
namecopy = (char *) alloca (strlen (lexptr) + 1);
expout_size = 10;
@@ -1351,63 +1357,6 @@ build_parse (void)
init_type (TYPE_CODE_INT, 1, 0,
"<variable (not text or data), no debug info>",
NULL);
-
- /* create the std_regs table */
-
- num_std_regs = 0;
-#ifdef PC_REGNUM
- if (PC_REGNUM >= 0)
- num_std_regs++;
-#endif
-#ifdef FP_REGNUM
- if (FP_REGNUM >= 0)
- num_std_regs++;
-#endif
-#ifdef SP_REGNUM
- if (SP_REGNUM >= 0)
- num_std_regs++;
-#endif
-#ifdef PS_REGNUM
- if (PS_REGNUM >= 0)
- num_std_regs++;
-#endif
- /* create an empty table */
- std_regs = xmalloc ((num_std_regs + 1) * sizeof *std_regs);
- i = 0;
- /* fill it in */
-#ifdef PC_REGNUM
- if (PC_REGNUM >= 0)
- {
- std_regs[i].name = "pc";
- std_regs[i].regnum = PC_REGNUM;
- i++;
- }
-#endif
-#ifdef FP_REGNUM
- if (FP_REGNUM >= 0)
- {
- std_regs[i].name = "fp";
- std_regs[i].regnum = FP_REGNUM;
- i++;
- }
-#endif
-#ifdef SP_REGNUM
- if (SP_REGNUM >= 0)
- {
- std_regs[i].name = "sp";
- std_regs[i].regnum = SP_REGNUM;
- i++;
- }
-#endif
-#ifdef PS_REGNUM
- if (PS_REGNUM >= 0)
- {
- std_regs[i].name = "ps";
- std_regs[i].regnum = PS_REGNUM;
- i++;
- }
-#endif
- memset (&std_regs[i], 0, sizeof (std_regs[i]));
}
void
@@ -1427,8 +1376,6 @@ _initialize_parse (void)
register_gdbarch_swap (&msym_data_symbol_type, sizeof (msym_data_symbol_type), NULL);
register_gdbarch_swap (&msym_unknown_symbol_type, sizeof (msym_unknown_symbol_type), NULL);
- register_gdbarch_swap (&num_std_regs, sizeof (std_regs), NULL);
- register_gdbarch_swap (&std_regs, sizeof (std_regs), NULL);
register_gdbarch_swap (NULL, 0, build_parse);
add_show_from_set (