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; --- 107 unchanged lines hidden (view full) --- 116 * "Stub" to allow remote cpu to debug over a serial line using gdb. 117 */ 118 119#include <sys/signal.h> 120 121#include <string> 122#include <unistd.h> 123 |
124#include "arch/alpha/kgdb.h" |
125#include "arch/alpha/remote_gdb.hh" |
126#include "arch/vtophys.hh" |
127#include "base/intmath.hh" 128#include "base/remote_gdb.hh" 129#include "base/socket.hh" 130#include "base/trace.hh" 131#include "config/full_system.hh" 132#include "cpu/thread_context.hh" 133#include "cpu/static_inst.hh" 134#include "mem/physical.hh" 135#include "mem/port.hh" 136#include "sim/system.hh" 137 138using namespace std; |
139using namespace TheISA; |
140 |
141RemoteGDB::RemoteGDB(System *_system, ThreadContext *c) |
142 : BaseRemoteGDB(_system, c, KGDB_NUMREGS) |
143{ |
144 memset(gdbregs.regs, 0, gdbregs.size); |
145} 146 147/////////////////////////////////////////////////////////// 148// RemoteGDB::acc 149// 150// Determine if the mapping at va..(va+len) is valid. 151// 152bool --- 94 unchanged lines hidden (view full) --- 247 for (int i = 0; i < TheISA::NumFloatArchRegs; ++i) { 248 context->setFloatRegBits(i, gdbregs.regs[i + KGDB_REG_F0]); 249 } 250#endif 251 context->setPC(gdbregs.regs[KGDB_REG_PC]); 252} 253 254void |
255RemoteGDB::clearSingleStep() 256{ 257 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n", |
258 takenBkpt, notTakenBkpt); |
259 |
260 if (takenBkpt != 0) |
261 clearTempBreakpoint(takenBkpt); 262 |
263 if (notTakenBkpt != 0) |
264 clearTempBreakpoint(notTakenBkpt); 265} 266 267void 268RemoteGDB::setSingleStep() 269{ 270 Addr pc = context->readPC(); 271 Addr npc, bpc; --- 8 unchanged lines hidden (view full) --- 280 if (si->hasBranchTarget(pc, context, bpc)) { 281 // Don't bother setting a breakpoint on the taken branch if it 282 // is the same as the next pc 283 if (bpc != npc) 284 set_bt = true; 285 } 286 287 DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n", |
288 takenBkpt, notTakenBkpt); |
289 |
290 setTempBreakpoint(notTakenBkpt = npc); |
291 292 if (set_bt) |
293 setTempBreakpoint(takenBkpt = bpc); |
294} 295 296// Write bytes to kernel address space for debugger. 297bool 298RemoteGDB::write(Addr vaddr, size_t size, const char *data) 299{ 300 if (BaseRemoteGDB::write(vaddr, size, data)) { 301#ifdef IMB 302 alpha_pal_imb(); 303#endif 304 return true; 305 } else { 306 return false; 307 } 308} 309 |