diff options
author | Gabe Black <gabeblack@google.com> | 2014-12-05 22:37:03 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2014-12-05 22:37:03 -0800 |
commit | 4a8a0a07982b7896127d0cb723fde08b3825bb48 (patch) | |
tree | 32274c02ae9dca6d6ebad156e559c9afcc44cabb /src/arch/alpha | |
parent | fb07d43b1a4a903fb2e51b41685eb5814d9f9e11 (diff) | |
download | gem5-4a8a0a07982b7896127d0cb723fde08b3825bb48.tar.xz |
misc: Generalize GDB single stepping.
The new single stepping implementation for x86 doesn't rely on any ISA
specific properties or functionality. This change pulls out the per ISA
implementation of those functions and promotes the X86 implementation to the
base class.
One drawback of that implementation is that the CPU might stop on an
instruction twice if it's affected by both breakpoints and single stepping.
While that might be a little surprising, it's harmless and would only happen
under somewhat unlikely circumstances.
Diffstat (limited to 'src/arch/alpha')
-rw-r--r-- | src/arch/alpha/remote_gdb.cc | 40 | ||||
-rw-r--r-- | src/arch/alpha/remote_gdb.hh | 9 |
2 files changed, 1 insertions, 48 deletions
diff --git a/src/arch/alpha/remote_gdb.cc b/src/arch/alpha/remote_gdb.cc index 951a20982..a3fcf6136 100644 --- a/src/arch/alpha/remote_gdb.cc +++ b/src/arch/alpha/remote_gdb.cc @@ -255,46 +255,6 @@ RemoteGDB::setregs() context->pcState(gdbregs.regs64[KGDB_REG_PC]); } -void -RemoteGDB::clearSingleStep() -{ - DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n", - takenBkpt, notTakenBkpt); - - if (takenBkpt != 0) - clearTempBreakpoint(takenBkpt); - - if (notTakenBkpt != 0) - clearTempBreakpoint(notTakenBkpt); -} - -void -RemoteGDB::setSingleStep() -{ - PCState pc = context->pcState(); - PCState bpc; - bool set_bt = false; - - // User was stopped at pc, e.g. the instruction at pc was not - // executed. - MachInst inst = read<MachInst>(pc.pc()); - StaticInstPtr si = context->getDecoderPtr()->decode(inst, pc.pc()); - if (si->hasBranchTarget(pc, context, bpc)) { - // Don't bother setting a breakpoint on the taken branch if it - // is the same as the next pc - if (bpc.pc() != pc.npc()) - set_bt = true; - } - - DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n", - takenBkpt, notTakenBkpt); - - setTempBreakpoint(notTakenBkpt = pc.npc()); - - if (set_bt) - setTempBreakpoint(takenBkpt = bpc.pc()); -} - // Write bytes to kernel address space for debugger. bool RemoteGDB::write(Addr vaddr, size_t size, const char *data) diff --git a/src/arch/alpha/remote_gdb.hh b/src/arch/alpha/remote_gdb.hh index d9c124c72..33994653d 100644 --- a/src/arch/alpha/remote_gdb.hh +++ b/src/arch/alpha/remote_gdb.hh @@ -48,21 +48,14 @@ namespace AlphaISA { class RemoteGDB : public BaseRemoteGDB { protected: - Addr notTakenBkpt; - Addr takenBkpt; - - protected: void getregs(); void setregs(); - void clearSingleStep(); - void setSingleStep(); - // Machine memory bool acc(Addr addr, size_t len); bool write(Addr addr, size_t size, const char *data); - virtual bool insertHardBreak(Addr addr, size_t len); + bool insertHardBreak(Addr addr, size_t len); public: RemoteGDB(System *system, ThreadContext *context); |