diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2009-06-04 12:28:39 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2009-06-04 12:28:39 +0000 |
commit | 768a979c31bbe51154e3363c1061c45aa9cd937f (patch) | |
tree | 8c5f21f3ae813fe4193b79e851fa6bef842f0d1c /gdb/stabsread.c | |
parent | e36aef42209e57273a78919b81cc7ae62d32107a (diff) | |
download | gdb-768a979c31bbe51154e3363c1061c45aa9cd937f.zip gdb-768a979c31bbe51154e3363c1061c45aa9cd937f.tar.gz gdb-768a979c31bbe51154e3363c1061c45aa9cd937f.tar.bz2 |
* symtab.h: Rename SYMBOL_OPS to SYMBOL_COMPUTED_OPS.
* ax-gdb.c (gen_var_ref): Likewise.
* findvar.c (read_var_value, symbol_read_needs_frame): Likewise.
* printcmd.c (address_info): Likewise.
* dwarf2loc.c (dwarf_expr_frame_base): Likewise.
* dwarf2read.c (dwarf2_symbol_mark_computed): Likewise.
* symtab.h: Rename struct symbol_ops to struct symbol_computed_ops.
* dwarf2loc.h: Likewise.
* dwarf2loc.c (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Likewise.
* symtab.h: (struct symbol_register_ops): New struct definition.
(struct symbol): Make "ops" member a union of symbol_computed_ops and
symbol_register_ops callback pointers.
(SYMBOL_REGISTER_OPS): New macro.
* tracepoint.c: Include "objfiles.h".
(scope_info, collect_symbol): Use SYMBOL_REGISTER_OPS register_number
callback to retrieve register numbers.
* ax-gdb.c (gen_var_ref): Likewise.
* findvar.c (read_var_value): Likewise.
* printcmd.c (address_info): Likewise.
* coffread.c (coff_reg_to_regnum): New function.
(coff_register_funcs): New static variable.
(process_coff_symbol): Do not call gdbarch_sdb_reg_to_regnum.
Install SYMBOL_REGISTER_OPS callbacks.
* mdebugread.c (mdebug_reg_to_regnum): New function.
(mdebug_register_funcs): New static variable.
(parse_symbol): Do not call gdbarch_ecoff_reg_to_regnum.
Install SYMBOL_REGISTER_OPS callbacks.
* stabsread.c (stab_reg_to_regnum): New function.
(stab_register_funcs): New static variable.
(define_symbol): Do not call gdbarch_stab_reg_to_regnum.
Install SYMBOL_REGISTER_OPS callbacks.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r-- | gdb/stabsread.c | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 20bc4f5..ed67096 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -579,6 +579,29 @@ symbol_reference_defined (char **string) } } +static int +stab_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) +{ + int regno = gdbarch_stab_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym)); + + if (regno >= gdbarch_num_regs (gdbarch) + + gdbarch_num_pseudo_regs (gdbarch)) + { + reg_value_complaint (regno, + gdbarch_num_regs (gdbarch) + + gdbarch_num_pseudo_regs (gdbarch), + SYMBOL_PRINT_NAME (sym)); + + regno = gdbarch_sp_regnum (gdbarch); /* Known safe, though useless */ + } + + return regno; +} + +static const struct symbol_register_ops stab_register_funcs = { + stab_reg_to_regnum +}; + struct symbol * define_symbol (CORE_ADDR valu, char *string, int desc, int type, struct objfile *objfile) @@ -993,18 +1016,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Parameter which is in a register. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_REGISTER; + SYMBOL_REGISTER_OPS (sym) = &stab_register_funcs; SYMBOL_IS_ARGUMENT (sym) = 1; - SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu); - if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch)) - { - reg_value_complaint (SYMBOL_VALUE (sym), - gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch), - SYMBOL_PRINT_NAME (sym)); - SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch); - /* Known safe, though useless */ - } + SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, &local_symbols); break; @@ -1013,17 +1027,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Register variable (either global or local). */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_REGISTER; - SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu); - if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch)) - { - reg_value_complaint (SYMBOL_VALUE (sym), - gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch), - SYMBOL_PRINT_NAME (sym)); - SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch); - /* Known safe, though useless */ - } + SYMBOL_REGISTER_OPS (sym) = &stab_register_funcs; + SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; if (within_function) { @@ -1059,6 +1064,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_LINKAGE_NAME (sym)) == 0) { SYMBOL_CLASS (prev_sym) = LOC_REGISTER; + SYMBOL_REGISTER_OPS (prev_sym) = &stab_register_funcs; /* Use the type from the LOC_REGISTER; that is the type that is actually in that register. */ SYMBOL_TYPE (prev_sym) = SYMBOL_TYPE (sym); @@ -1296,18 +1302,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Reference parameter which is in a register. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR; + SYMBOL_REGISTER_OPS (sym) = &stab_register_funcs; SYMBOL_IS_ARGUMENT (sym) = 1; - SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu); - if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch)) - { - reg_value_complaint (SYMBOL_VALUE (sym), - gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch), - SYMBOL_PRINT_NAME (sym)); - SYMBOL_VALUE (sym) = gdbarch_sp_regnum (current_gdbarch); - /* Known safe, though useless */ - } + SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, &local_symbols); break; |