remote_gdb.cc (7678:f19b6a3a8cec) | 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; --- 165 unchanged lines hidden (view full) --- 174// 175// Translate the kernel debugger register format into 176// the GDB register format. 177void 178RemoteGDB::getregs() 179{ 180 memset(gdbregs.regs, 0, gdbregs.size); 181 | 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; --- 165 unchanged lines hidden (view full) --- 174// 175// Translate the kernel debugger register format into 176// the GDB register format. 177void 178RemoteGDB::getregs() 179{ 180 memset(gdbregs.regs, 0, gdbregs.size); 181 |
182 PCState pc = context->pcState(); 183 |
|
182 if (context->readMiscReg(MISCREG_PSTATE) & 183 PSTATE::am) { 184 uint32_t *regs; 185 regs = (uint32_t*)gdbregs.regs; | 184 if (context->readMiscReg(MISCREG_PSTATE) & 185 PSTATE::am) { 186 uint32_t *regs; 187 regs = (uint32_t*)gdbregs.regs; |
186 regs[Reg32Pc] = htobe((uint32_t)context->readPC()); 187 regs[Reg32Npc] = htobe((uint32_t)context->readNextPC()); | 188 regs[Reg32Pc] = htobe((uint32_t)pc.pc()); 189 regs[Reg32Npc] = htobe((uint32_t)pc.npc()); |
188 for(int x = RegG0; x <= RegI0 + 7; x++) 189 regs[x] = htobe((uint32_t)context->readIntReg(x - RegG0)); 190 191 regs[Reg32Y] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 1)); 192 regs[Reg32Psr] = htobe((uint32_t)context->readMiscReg(MISCREG_PSTATE)); 193 regs[Reg32Fsr] = htobe((uint32_t)context->readMiscReg(MISCREG_FSR)); 194 regs[Reg32Csr] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 2)); 195 } else { | 190 for(int x = RegG0; x <= RegI0 + 7; x++) 191 regs[x] = htobe((uint32_t)context->readIntReg(x - RegG0)); 192 193 regs[Reg32Y] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 1)); 194 regs[Reg32Psr] = htobe((uint32_t)context->readMiscReg(MISCREG_PSTATE)); 195 regs[Reg32Fsr] = htobe((uint32_t)context->readMiscReg(MISCREG_FSR)); 196 regs[Reg32Csr] = htobe((uint32_t)context->readIntReg(NumIntArchRegs + 2)); 197 } else { |
196 gdbregs.regs[RegPc] = htobe(context->readPC()); 197 gdbregs.regs[RegNpc] = htobe(context->readNextPC()); | 198 gdbregs.regs[RegPc] = htobe(pc.pc()); 199 gdbregs.regs[RegNpc] = htobe(pc.npc()); |
198 for(int x = RegG0; x <= RegI0 + 7; x++) 199 gdbregs.regs[x] = htobe(context->readIntReg(x - RegG0)); 200 201 gdbregs.regs[RegFsr] = htobe(context->readMiscReg(MISCREG_FSR)); 202 gdbregs.regs[RegFprs] = htobe(context->readMiscReg(MISCREG_FPRS)); 203 gdbregs.regs[RegY] = htobe(context->readIntReg(NumIntArchRegs + 1)); 204 gdbregs.regs[RegState] = htobe( 205 context->readMiscReg(MISCREG_CWP) | --- 13 unchanged lines hidden (view full) --- 219// RemoteGDB::setregs 220// 221// Translate the GDB register format into the kernel 222// debugger register format. 223// 224void 225RemoteGDB::setregs() 226{ | 200 for(int x = RegG0; x <= RegI0 + 7; x++) 201 gdbregs.regs[x] = htobe(context->readIntReg(x - RegG0)); 202 203 gdbregs.regs[RegFsr] = htobe(context->readMiscReg(MISCREG_FSR)); 204 gdbregs.regs[RegFprs] = htobe(context->readMiscReg(MISCREG_FPRS)); 205 gdbregs.regs[RegY] = htobe(context->readIntReg(NumIntArchRegs + 1)); 206 gdbregs.regs[RegState] = htobe( 207 context->readMiscReg(MISCREG_CWP) | --- 13 unchanged lines hidden (view full) --- 221// RemoteGDB::setregs 222// 223// Translate the GDB register format into the kernel 224// debugger register format. 225// 226void 227RemoteGDB::setregs() 228{ |
227 context->setPC(gdbregs.regs[RegPc]); 228 context->setNextPC(gdbregs.regs[RegNpc]); | 229 PCState pc; 230 pc.pc(gdbregs.regs[RegPc]); 231 pc.npc(gdbregs.regs[RegNpc]); 232 pc.nnpc(pc.npc() + sizeof(MachInst)); 233 pc.upc(0); 234 pc.nupc(1); 235 context->pcState(pc); |
229 for(int x = RegG0; x <= RegI0 + 7; x++) 230 context->setIntReg(x - RegG0, gdbregs.regs[x]); 231 //Only the integer registers, pc and npc are set in netbsd 232} 233 234void 235RemoteGDB::clearSingleStep() 236{ 237 if (nextBkpt) 238 clearTempBreakpoint(nextBkpt); 239} 240 241void 242RemoteGDB::setSingleStep() 243{ | 236 for(int x = RegG0; x <= RegI0 + 7; x++) 237 context->setIntReg(x - RegG0, gdbregs.regs[x]); 238 //Only the integer registers, pc and npc are set in netbsd 239} 240 241void 242RemoteGDB::clearSingleStep() 243{ 244 if (nextBkpt) 245 clearTempBreakpoint(nextBkpt); 246} 247 248void 249RemoteGDB::setSingleStep() 250{ |
244 nextBkpt = context->readNextPC(); | 251 nextBkpt = context->pcState().npc(); |
245 setTempBreakpoint(nextBkpt); 246} | 252 setTempBreakpoint(nextBkpt); 253} |