2000-07-12 Michael Snyder <msnyder@cleaver.cygnus.com>

* regcache.c (registers_changed, registers_fetched): Use
        ARCH_NUM_REGS directly, eliminating an unnecessary variable.

        This change adds pseudo-register capability to GDB.
        Pseudo-registers are handled like registers, but they
        don't come from or live on the target.  They may be
        aliases for an existing register, or they may be computed.
        * defs.h (NUM_PSEUDO_REGISTERS): Define default of zero.
        (ARCH_FETCH_PSEUDO_REGISTERS): Define default of no-op.
        (ARCH_STORE_PSEUDO_REGISTERS): Define default of no-op.
        # regcache.c (registers_changed): Mark pseudo-registers
        invalid, as well as real registers.
        (registers_fetched): Do not mark pseudo-registers as fetched
        at the same time as other (real) registers.
        (read_register_bytes): Fetch pseudo-registers (if any) from
        the target architecture module instead of from the target.
        (read_register_gen): Ditto.
        (read_register): Ditto.
        (write_register_bytes): Store pseudo-registers (if any) to
        the target architecture module instead of to the target.
        (write_register_gen): Ditto.
        (write_register): Ditto.
        (build_regcache): Allocate enough register_valid space for
        pseudo-registers as well as normal (real) ones.
This commit is contained in:
Michael Snyder
2000-07-12 22:01:17 +00:00
parent 86d65c94b2
commit fcdc5976b3
3 changed files with 98 additions and 17 deletions

View File

@@ -52,12 +52,36 @@ extern void write_inferior_status_register (struct inferior_status
/* This macro gives the number of registers actually in use by the
inferior. This may be less than the total number of registers,
perhaps depending on the actual CPU in use or program being run. */
perhaps depending on the actual CPU in use or program being run.
FIXME: This could be replaced by the new MULTI_ARCH capability. */
#ifndef ARCH_NUM_REGS
#define ARCH_NUM_REGS NUM_REGS
#endif
/* This macro gives the number of pseudo-registers that live in the
register namespace but do not get fetched or stored on the target.
These pseudo-registers may be aliases for other registers,
combinations of other registers, or they may be computed by GDB.
FIXME: move into gdbarch.[ch] */
#ifndef NUM_PSEUDO_REGS
#define NUM_PSEUDO_REGS 0
#endif
/* This function is called when the value of a pseudo-register needs
to be updated. Typically it will be defined on a per-architecture
basis. FIXME: move into gdbarch.[ch]. */
#ifndef ARCH_FETCH_PSEUDO_REGISTERS
#define ARCH_FETCH_PSEUDO_REGISTERS(REGNUM) /* no-op */
#endif
/* This function is called when the value of a pseudo-register needs
to be set or stored. Typically it will be defined on a per-architecture
basis. FIXME: move into gdbarch.[ch]. */
#ifndef ARCH_STORE_PSEUDO_REGISTERS
#define ARCH_STORE_PSEUDO_REGISTERS(REGNUM) /* no-op */
#endif
extern void set_sigint_trap (void);
extern void clear_sigint_trap (void);