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/printcmd.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/printcmd.c')
-rw-r--r-- | gdb/printcmd.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b0d7a17..49ae9d1 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1105,6 +1105,8 @@ sym_info (char *arg, int from_tty) static void address_info (char *exp, int from_tty) { + struct gdbarch *gdbarch; + int regno; struct symbol *sym; struct minimal_symbol *msymbol; long val; @@ -1167,6 +1169,7 @@ address_info (char *exp, int from_tty) printf_filtered ("\" is "); val = SYMBOL_VALUE (sym); section = SYMBOL_OBJ_SECTION (sym); + gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile); switch (SYMBOL_CLASS (sym)) { @@ -1191,20 +1194,28 @@ address_info (char *exp, int from_tty) case LOC_COMPUTED: /* FIXME: cagney/2004-01-26: It should be possible to - unconditionally call the SYMBOL_OPS method when available. + unconditionally call the SYMBOL_COMPUTED_OPS method when available. Unfortunately DWARF 2 stores the frame-base (instead of the function) location in a function's symbol. Oops! For the moment enable this when/where applicable. */ - SYMBOL_OPS (sym)->describe_location (sym, gdb_stdout); + SYMBOL_COMPUTED_OPS (sym)->describe_location (sym, gdb_stdout); break; case LOC_REGISTER: + /* GDBARCH is the architecture associated with the objfile the symbol + is defined in; the target architecture may be different, and may + provide additional registers. However, we do not know the target + architecture at this point. We assume the objfile architecture + will contain all the standard registers that occur in debug info + in that objfile. */ + regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch); + if (SYMBOL_IS_ARGUMENT (sym)) printf_filtered (_("an argument in register %s"), - gdbarch_register_name (current_gdbarch, val)); + gdbarch_register_name (gdbarch, regno)); else printf_filtered (_("a variable in register %s"), - gdbarch_register_name (current_gdbarch, val)); + gdbarch_register_name (gdbarch, regno)); break; case LOC_STATIC: @@ -1222,8 +1233,10 @@ address_info (char *exp, int from_tty) break; case LOC_REGPARM_ADDR: + /* Note comment at LOC_REGISTER. */ + regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch); printf_filtered (_("address of an argument in register %s"), - gdbarch_register_name (current_gdbarch, val)); + gdbarch_register_name (gdbarch, regno)); break; case LOC_ARG: |