From 4a8a0a07982b7896127d0cb723fde08b3825bb48 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 5 Dec 2014 22:37:03 -0800 Subject: 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. --- src/arch/mips/remote_gdb.cc | 44 -------------------------------------------- src/arch/mips/remote_gdb.hh | 7 ------- 2 files changed, 51 deletions(-) (limited to 'src/arch/mips') diff --git a/src/arch/mips/remote_gdb.cc b/src/arch/mips/remote_gdb.cc index 9c944fc59..a7bde8ba6 100644 --- a/src/arch/mips/remote_gdb.cc +++ b/src/arch/mips/remote_gdb.cc @@ -235,47 +235,3 @@ RemoteGDB::setregs() context->setFloatRegBits(FLOATREG_FIR, gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1]); } - -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(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 npc - if (bpc.npc() != pc.nnpc()) - set_bt = true; - } - - DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n", - takenBkpt, notTakenBkpt); - - notTakenBkpt = pc.nnpc(); - setTempBreakpoint(notTakenBkpt); - - if (set_bt) { - takenBkpt = bpc.npc(); - setTempBreakpoint(takenBkpt); - } -} - diff --git a/src/arch/mips/remote_gdb.hh b/src/arch/mips/remote_gdb.hh index 157276dcf..8d113eb99 100644 --- a/src/arch/mips/remote_gdb.hh +++ b/src/arch/mips/remote_gdb.hh @@ -54,10 +54,6 @@ namespace MipsISA class RemoteGDB : public BaseRemoteGDB { - protected: - Addr notTakenBkpt; - Addr takenBkpt; - public: RemoteGDB(System *_system, ThreadContext *tc); @@ -66,9 +62,6 @@ namespace MipsISA void getregs(); void setregs(); - - void clearSingleStep(); - void setSingleStep(); }; } -- cgit v1.2.3