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)
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);
using namespace ArmISA;
RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc)
- : BaseRemoteGDB(_system, tc, GDB_REG_BYTES),
- notTakenBkpt(0), takenBkpt(0)
+ : BaseRemoteGDB(_system, tc, GDB_REG_BYTES)
{
}
}
}
-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)
class RemoteGDB : public BaseRemoteGDB
{
+ protected:
+ bool acc(Addr addr, size_t len);
+ bool write(Addr addr, size_t size, const char *data);
-protected:
- Addr notTakenBkpt;
- Addr takenBkpt;
+ void getregs();
+ void setregs();
-protected:
- bool acc(Addr addr, size_t len);
- bool write(Addr addr, size_t size, const char *data);
-
- void getregs();
- void setregs();
-
- void clearSingleStep();
- void setSingleStep();
-
-public:
- RemoteGDB(System *_system, ThreadContext *tc);
+ public:
+ RemoteGDB(System *_system, ThreadContext *tc);
};
} // namespace ArmISA
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<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 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);
- }
-}
-
class RemoteGDB : public BaseRemoteGDB
{
- protected:
- Addr notTakenBkpt;
- Addr takenBkpt;
-
public:
RemoteGDB(System *_system, ThreadContext *tc);
void getregs();
void setregs();
-
- void clearSingleStep();
- void setSingleStep();
};
}
{
panic("setregs not implemented for POWER!");
}
-
- void
- clearSingleStep()
- {
- panic("clearSingleStep not implemented for POWER!");
- }
-
- void
- setSingleStep()
- {
- panic("setSingleStep not implemented for POWER!");
- }
};
} // namespace PowerISA
using namespace SparcISA;
RemoteGDB::RemoteGDB(System *_system, ThreadContext *c)
- : BaseRemoteGDB(_system, c, NumGDBRegs * sizeof(uint64_t)), nextBkpt(0)
+ : BaseRemoteGDB(_system, c, NumGDBRegs * sizeof(uint64_t))
{}
///////////////////////////////////////////////////////////
context->setIntReg(x - RegG0, gdbregs.regs64[x]);
// Only the integer registers, pc and npc are set in netbsd
}
-
-void
-RemoteGDB::clearSingleStep()
-{
- if (nextBkpt)
- clearTempBreakpoint(nextBkpt);
-}
-
-void
-RemoteGDB::setSingleStep()
-{
- nextBkpt = context->pcState().npc();
- setTempBreakpoint(nextBkpt);
-}
protected:
void getregs();
void setregs();
-
- void clearSingleStep();
- void setSingleStep();
-
- Addr nextBkpt;
};
}
using namespace X86ISA;
RemoteGDB::RemoteGDB(System *_system, ThreadContext *c) :
- BaseRemoteGDB(_system, c, GDB_REG_BYTES), singleStepEvent(this)
+ BaseRemoteGDB(_system, c, GDB_REG_BYTES)
{}
bool
}
}
-void
-RemoteGDB::SingleStepEvent::process()
-{
- if (!gdb->singleStepEvent.scheduled())
- gdb->scheduleInstCommitEvent(&gdb->singleStepEvent, 1);
- gdb->trap(SIGTRAP);
-}
-
void
RemoteGDB::getregs()
{
}
}
}
-
-void
-RemoteGDB::clearSingleStep()
-{
- descheduleInstCommitEvent(&singleStepEvent);
-}
-
-void
-RemoteGDB::setSingleStep()
-{
- if (!singleStepEvent.scheduled())
- scheduleInstCommitEvent(&singleStepEvent, 1);
-}
bool acc(Addr addr, size_t len);
protected:
- class SingleStepEvent : public Event
- {
- protected:
- RemoteGDB *gdb;
-
- public:
- SingleStepEvent(RemoteGDB *g) : gdb(g)
- {}
-
- void process();
- };
-
- SingleStepEvent singleStepEvent;
-
void getregs();
void setregs();
- void clearSingleStep();
- void setSingleStep();
-
bool checkBpLen(size_t len) { return len == 1; }
};
gdb->trap(_type);
}
-BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c, size_t cacheSize)
- : inputEvent(NULL), trapEvent(this), listener(NULL), number(-1), fd(-1),
- active(false), attached(false),
- system(_system), context(c),
- gdbregs(cacheSize)
+void
+BaseRemoteGDB::SingleStepEvent::process()
+{
+ if (!gdb->singleStepEvent.scheduled())
+ gdb->scheduleInstCommitEvent(&gdb->singleStepEvent, 1);
+ gdb->trap(SIGTRAP);
+}
+
+BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c,
+ size_t cacheSize) : inputEvent(NULL), trapEvent(this), listener(NULL),
+ number(-1), fd(-1), active(false), attached(false), system(_system),
+ context(c), gdbregs(cacheSize), singleStepEvent(this)
{
memset(gdbregs.regs, 0, gdbregs.bytes());
}
return true;
}
+void
+BaseRemoteGDB::clearSingleStep()
+{
+ descheduleInstCommitEvent(&singleStepEvent);
+}
+
+void
+BaseRemoteGDB::setSingleStep()
+{
+ if (!singleStepEvent.scheduled())
+ scheduleInstCommitEvent(&singleStepEvent, 1);
+}
+
PCEventQueue *BaseRemoteGDB::getPcEventQueue()
{
return &system->pcEventQueue;
}
protected:
+ class SingleStepEvent : public Event
+ {
+ protected:
+ BaseRemoteGDB *gdb;
+
+ public:
+ SingleStepEvent(BaseRemoteGDB *g) : gdb(g)
+ {}
+
+ void process();
+ };
+
+ SingleStepEvent singleStepEvent;
+
virtual void getregs() = 0;
virtual void setregs() = 0;
- virtual void clearSingleStep() = 0;
- virtual void setSingleStep() = 0;
+ void clearSingleStep();
+ void setSingleStep();
PCEventQueue *getPcEventQueue();
EventQueue *getComInstEventQueue();