remote_gdb.cc (9020:14321ce30881) | remote_gdb.cc (10595:25ecfc14f73f) |
---|---|
1/* | 1/* |
2 * Copyright 2014 Google, Inc. |
|
2 * Copyright (c) 2010 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license --- 133 unchanged lines hidden (view full) --- 143#include "debug/GDBMisc.hh" 144#include "mem/page_table.hh" 145#include "sim/full_system.hh" 146 147using namespace std; 148using namespace MipsISA; 149 150RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) | 3 * Copyright (c) 2010 ARM Limited 4 * All rights reserved 5 * 6 * The license below extends only to copyright in the software and shall 7 * not be construed as granting a license to any other intellectual 8 * property including but not limited to intellectual property relating 9 * to a hardware implementation of the functionality of the software 10 * licensed hereunder. You may use the software subject to the license --- 133 unchanged lines hidden (view full) --- 144#include "debug/GDBMisc.hh" 145#include "mem/page_table.hh" 146#include "sim/full_system.hh" 147 148using namespace std; 149using namespace MipsISA; 150 151RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) |
151 : BaseRemoteGDB(_system, tc, GdbNumRegs) | 152 : BaseRemoteGDB(_system, tc, GdbNumRegs * sizeof(uint32_t)) |
152{ 153} 154 155/* 156 * Determine if the mapping at va..(va+len) is valid. 157 */ 158bool 159RemoteGDB::acc(Addr va, size_t len) --- 16 unchanged lines hidden (view full) --- 176{ 177 DPRINTF(GDBAcc, "getregs in remotegdb \n"); 178 memset(gdbregs.regs, 0, gdbregs.bytes()); 179 180 // MIPS registers are 32 bits wide, gdb registers are 64 bits wide 181 // two MIPS registers are packed into one gdb register (little endian) 182 183 // INTREG: R0~R31 | 153{ 154} 155 156/* 157 * Determine if the mapping at va..(va+len) is valid. 158 */ 159bool 160RemoteGDB::acc(Addr va, size_t len) --- 16 unchanged lines hidden (view full) --- 177{ 178 DPRINTF(GDBAcc, "getregs in remotegdb \n"); 179 memset(gdbregs.regs, 0, gdbregs.bytes()); 180 181 // MIPS registers are 32 bits wide, gdb registers are 64 bits wide 182 // two MIPS registers are packed into one gdb register (little endian) 183 184 // INTREG: R0~R31 |
184 for (int i = 0; i < GdbIntArchRegs; i++) { 185 gdbregs.regs[i] = pack( 186 context->readIntReg(i * 2), 187 context->readIntReg(i * 2 + 1)); 188 } | 185 for (int i = 0; i < GdbIntArchRegs; i++) 186 gdbregs.regs32[i] = context->readIntReg(i); |
189 // SR, LO, HI, BADVADDR, CAUSE, PC | 187 // SR, LO, HI, BADVADDR, CAUSE, PC |
190 gdbregs.regs[GdbIntArchRegs + 0] = pack( 191 context->readMiscRegNoEffect(MISCREG_STATUS), 192 context->readIntReg(INTREG_LO)); 193 gdbregs.regs[GdbIntArchRegs + 1] = pack( 194 context->readIntReg(INTREG_HI), 195 context->readMiscRegNoEffect(MISCREG_BADVADDR)); 196 gdbregs.regs[GdbIntArchRegs + 2] = pack( 197 context->readMiscRegNoEffect(MISCREG_CAUSE), 198 context->pcState().pc()); | 188 gdbregs.regs32[GdbIntArchRegs + 0] = 189 context->readMiscRegNoEffect(MISCREG_STATUS); 190 gdbregs.regs32[GdbIntArchRegs + 1] = context->readIntReg(INTREG_LO); 191 gdbregs.regs32[GdbIntArchRegs + 2] = context->readIntReg(INTREG_HI); 192 gdbregs.regs32[GdbIntArchRegs + 3] = 193 context->readMiscRegNoEffect(MISCREG_BADVADDR); 194 gdbregs.regs32[GdbIntArchRegs + 4] = 195 context->readMiscRegNoEffect(MISCREG_CAUSE); 196 gdbregs.regs32[GdbIntArchRegs + 5] = context->pcState().pc(); |
199 // FLOATREG: F0~F31 | 197 // FLOATREG: F0~F31 |
200 for (int i = 0; i < GdbFloatArchRegs; i++) { 201 gdbregs.regs[GdbIntRegs + i] = pack( 202 context->readFloatRegBits(i * 2), 203 context->readFloatRegBits(i * 2 + 1)); 204 } | 198 for (int i = 0; i < GdbFloatArchRegs; i++) 199 gdbregs.regs32[GdbIntRegs + i] = context->readFloatRegBits(i); |
205 // FCR, FIR | 200 // FCR, FIR |
206 gdbregs.regs[GdbIntRegs + GdbFloatArchRegs + 0] = pack( 207 context->readFloatRegBits(FLOATREG_FCCR), 208 context->readFloatRegBits(FLOATREG_FIR)); | 201 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 0] = 202 context->readFloatRegBits(FLOATREG_FCCR); 203 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1] = 204 context->readFloatRegBits(FLOATREG_FIR); |
209} 210 211/* 212 * Translate the GDB register format into the kernel debugger register 213 * format. 214 */ 215void 216RemoteGDB::setregs() 217{ 218 DPRINTF(GDBAcc, "setregs in remotegdb \n"); 219 | 205} 206 207/* 208 * Translate the GDB register format into the kernel debugger register 209 * format. 210 */ 211void 212RemoteGDB::setregs() 213{ 214 DPRINTF(GDBAcc, "setregs in remotegdb \n"); 215 |
220 // MIPS registers are 32 bits wide, gdb registers are 64 bits wide 221 // two MIPS registers are packed into one gdb register (little endian) 222 | |
223 // INTREG: R0~R31 | 216 // INTREG: R0~R31 |
224 for (int i = 0; i < GdbIntArchRegs; i++) { 225 if (i) context->setIntReg(i * 2, 226 unpackLo(gdbregs.regs[i])); 227 context->setIntReg(i * 2 + 1, 228 unpackHi(gdbregs.regs[i])); 229 } | 217 for (int i = 1; i < GdbIntArchRegs; i++) 218 context->setIntReg(i, gdbregs.regs32[i]); |
230 // SR, LO, HI, BADVADDR, CAUSE, PC 231 context->setMiscRegNoEffect(MISCREG_STATUS, | 219 // SR, LO, HI, BADVADDR, CAUSE, PC 220 context->setMiscRegNoEffect(MISCREG_STATUS, |
232 unpackLo(gdbregs.regs[GdbIntArchRegs + 0])); 233 context->setIntReg(INTREG_LO, 234 unpackHi(gdbregs.regs[GdbIntArchRegs + 0])); 235 context->setIntReg(INTREG_HI, 236 unpackLo(gdbregs.regs[GdbIntArchRegs + 1])); | 221 gdbregs.regs32[GdbIntArchRegs + 0]); 222 context->setIntReg(INTREG_LO, gdbregs.regs32[GdbIntArchRegs + 1]); 223 context->setIntReg(INTREG_HI, gdbregs.regs32[GdbIntArchRegs + 2]); |
237 context->setMiscRegNoEffect(MISCREG_BADVADDR, | 224 context->setMiscRegNoEffect(MISCREG_BADVADDR, |
238 unpackHi(gdbregs.regs[GdbIntArchRegs + 1])); | 225 gdbregs.regs32[GdbIntArchRegs + 3]); |
239 context->setMiscRegNoEffect(MISCREG_CAUSE, | 226 context->setMiscRegNoEffect(MISCREG_CAUSE, |
240 unpackLo(gdbregs.regs[GdbIntArchRegs + 2])); 241 context->pcState( 242 unpackHi(gdbregs.regs[GdbIntArchRegs + 2])); | 227 gdbregs.regs32[GdbIntArchRegs + 4]); 228 context->pcState(gdbregs.regs32[GdbIntArchRegs + 5]); |
243 // FLOATREG: F0~F31 | 229 // FLOATREG: F0~F31 |
244 for (int i = 0; i < GdbFloatArchRegs; i++) { 245 context->setFloatRegBits(i * 2, 246 unpackLo(gdbregs.regs[GdbIntRegs + i])); 247 context->setFloatRegBits(i * 2 + 1, 248 unpackHi(gdbregs.regs[GdbIntRegs + i])); 249 } | 230 for (int i = 0; i < GdbFloatArchRegs; i++) 231 context->setFloatRegBits(i, gdbregs.regs32[GdbIntRegs + i]); |
250 // FCR, FIR 251 context->setFloatRegBits(FLOATREG_FCCR, | 232 // FCR, FIR 233 context->setFloatRegBits(FLOATREG_FCCR, |
252 unpackLo(gdbregs.regs[GdbIntRegs + GdbFloatArchRegs + 0])); | 234 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 0]); |
253 context->setFloatRegBits(FLOATREG_FIR, | 235 context->setFloatRegBits(FLOATREG_FIR, |
254 unpackHi(gdbregs.regs[GdbIntRegs + GdbFloatArchRegs + 0])); | 236 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1]); |
255} 256 257void 258RemoteGDB::clearSingleStep() 259{ 260 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n", 261 takenBkpt, notTakenBkpt); 262 --- 37 unchanged lines hidden --- | 237} 238 239void 240RemoteGDB::clearSingleStep() 241{ 242 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n", 243 takenBkpt, notTakenBkpt); 244 --- 37 unchanged lines hidden --- |