remote_gdb.cc (6327:f6148086f997) remote_gdb.cc (7720:65d338a8dba4)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 197 unchanged lines hidden (view full) ---

206 * Translate the kernel debugger register format into the GDB register
207 * format.
208 */
209void
210RemoteGDB::getregs()
211{
212 memset(gdbregs.regs, 0, gdbregs.bytes());
213
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 197 unchanged lines hidden (view full) ---

206 * Translate the kernel debugger register format into the GDB register
207 * format.
208 */
209void
210RemoteGDB::getregs()
211{
212 memset(gdbregs.regs, 0, gdbregs.bytes());
213
214 gdbregs.regs[KGDB_REG_PC] = context->readPC();
214 gdbregs.regs[KGDB_REG_PC] = context->pcState().pc();
215
216 // @todo: Currently this is very Alpha specific.
217 if (PcPAL(gdbregs.regs[KGDB_REG_PC])) {
218 for (int i = 0; i < NumIntArchRegs; ++i) {
219 gdbregs.regs[i] = context->readIntReg(reg_redir[i]);
220 }
221 } else {
222 for (int i = 0; i < NumIntArchRegs; ++i) {

--- 26 unchanged lines hidden (view full) ---

249 }
250 }
251
252#ifdef KGDB_FP_REGS
253 for (int i = 0; i < NumFloatArchRegs; ++i) {
254 context->setFloatRegBits(i, gdbregs.regs[i + KGDB_REG_F0]);
255 }
256#endif
215
216 // @todo: Currently this is very Alpha specific.
217 if (PcPAL(gdbregs.regs[KGDB_REG_PC])) {
218 for (int i = 0; i < NumIntArchRegs; ++i) {
219 gdbregs.regs[i] = context->readIntReg(reg_redir[i]);
220 }
221 } else {
222 for (int i = 0; i < NumIntArchRegs; ++i) {

--- 26 unchanged lines hidden (view full) ---

249 }
250 }
251
252#ifdef KGDB_FP_REGS
253 for (int i = 0; i < NumFloatArchRegs; ++i) {
254 context->setFloatRegBits(i, gdbregs.regs[i + KGDB_REG_F0]);
255 }
256#endif
257 context->setPC(gdbregs.regs[KGDB_REG_PC]);
257 context->pcState(gdbregs.regs[KGDB_REG_PC]);
258}
259
260void
261RemoteGDB::clearSingleStep()
262{
263 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n",
264 takenBkpt, notTakenBkpt);
265
266 if (takenBkpt != 0)
267 clearTempBreakpoint(takenBkpt);
268
269 if (notTakenBkpt != 0)
270 clearTempBreakpoint(notTakenBkpt);
271}
272
273void
274RemoteGDB::setSingleStep()
275{
258}
259
260void
261RemoteGDB::clearSingleStep()
262{
263 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n",
264 takenBkpt, notTakenBkpt);
265
266 if (takenBkpt != 0)
267 clearTempBreakpoint(takenBkpt);
268
269 if (notTakenBkpt != 0)
270 clearTempBreakpoint(notTakenBkpt);
271}
272
273void
274RemoteGDB::setSingleStep()
275{
276 Addr pc = context->readPC();
277 Addr npc, bpc;
276 PCState pc = context->pcState();
277 PCState bpc;
278 bool set_bt = false;
279
278 bool set_bt = false;
279
280 npc = pc + sizeof(MachInst);
281
282 // User was stopped at pc, e.g. the instruction at pc was not
283 // executed.
280 // User was stopped at pc, e.g. the instruction at pc was not
281 // executed.
284 MachInst inst = read(pc);
285 StaticInstPtr si(inst, pc);
282 MachInst inst = read<MachInst>(pc.pc());
283 StaticInstPtr si(inst, pc.pc());
286 if (si->hasBranchTarget(pc, context, bpc)) {
287 // Don't bother setting a breakpoint on the taken branch if it
288 // is the same as the next pc
284 if (si->hasBranchTarget(pc, context, bpc)) {
285 // Don't bother setting a breakpoint on the taken branch if it
286 // is the same as the next pc
289 if (bpc != npc)
287 if (bpc.pc() != pc.npc())
290 set_bt = true;
291 }
292
293 DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n",
294 takenBkpt, notTakenBkpt);
295
288 set_bt = true;
289 }
290
291 DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n",
292 takenBkpt, notTakenBkpt);
293
296 setTempBreakpoint(notTakenBkpt = npc);
294 setTempBreakpoint(notTakenBkpt = pc.npc());
297
298 if (set_bt)
295
296 if (set_bt)
299 setTempBreakpoint(takenBkpt = bpc);
297 setTempBreakpoint(takenBkpt = bpc.pc());
300}
301
302// Write bytes to kernel address space for debugger.
303bool
304RemoteGDB::write(Addr vaddr, size_t size, const char *data)
305{
306 if (BaseRemoteGDB::write(vaddr, size, data)) {
307#ifdef IMB
308 alpha_pal_imb();
309#endif
310 return true;
311 } else {
312 return false;
313 }
314}
315
298}
299
300// Write bytes to kernel address space for debugger.
301bool
302RemoteGDB::write(Addr vaddr, size_t size, const char *data)
303{
304 if (BaseRemoteGDB::write(vaddr, size, data)) {
305#ifdef IMB
306 alpha_pal_imb();
307#endif
308 return true;
309 } else {
310 return false;
311 }
312}
313