remote_gdb.cc (3550:515e876568b4) | remote_gdb.cc (3571:ced6d2818217) |
---|---|
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; --- 135 unchanged lines hidden (view full) --- 144/////////////////////////////////////////////////////////// 145// RemoteGDB::acc 146// 147// Determine if the mapping at va..(va+len) is valid. 148// 149bool 150RemoteGDB::acc(Addr va, size_t len) 151{ | 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; --- 135 unchanged lines hidden (view full) --- 144/////////////////////////////////////////////////////////// 145// RemoteGDB::acc 146// 147// Determine if the mapping at va..(va+len) is valid. 148// 149bool 150RemoteGDB::acc(Addr va, size_t len) 151{ |
152#if 0 153 Addr last_va; 154 155 va = TheISA::TruncPage(va); 156 last_va = TheISA::RoundPage(va + len); 157 158 do { 159 if (TheISA::IsK0Seg(va)) { 160 if (va < (TheISA::K0SegBase + pmem->size())) { 161 DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= " 162 "%#x < K0SEG + size\n", va); 163 return true; 164 } else { 165 DPRINTF(GDBAcc, "acc: Mapping invalid %#x > K0SEG + size\n", 166 va); 167 return false; 168 } 169 } 170 171 /** 172 * This code says that all accesses to palcode (instruction and data) 173 * are valid since there isn't a va->pa mapping because palcode is 174 * accessed physically. At some point this should probably be cleaned up 175 * but there is no easy way to do it. 176 */ 177 178 if (AlphaISA::PcPAL(va) || va < 0x10000) 179 return true; 180 181 Addr ptbr = context->readMiscReg(AlphaISA::IPR_PALtemp20); 182 TheISA::PageTableEntry pte = TheISA::kernel_pte_lookup(context->getPhysPort(), ptbr, va); 183 if (!pte.valid()) { 184 DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va); 185 return false; 186 } 187 va += TheISA::PageBytes; 188 } while (va < last_va); 189 190 DPRINTF(GDBAcc, "acc: %#x mapping is valid\n", va); 191#endif | 152 //@Todo In NetBSD, this function checks if all addresses 153 //from va to va + len have valid page mape entries. Not 154 //sure how this will work for other OSes or in general. |
192 return true; 193} 194 195/////////////////////////////////////////////////////////// 196// RemoteGDB::getregs 197// 198// Translate the kernel debugger register format into 199// the GDB register format. 200void 201RemoteGDB::getregs() 202{ 203 memset(gdbregs.regs, 0, gdbregs.size); 204 205 gdbregs.regs[RegPc] = context->readPC(); 206 gdbregs.regs[RegNpc] = context->readNextPC(); | 155 return true; 156} 157 158/////////////////////////////////////////////////////////// 159// RemoteGDB::getregs 160// 161// Translate the kernel debugger register format into 162// the GDB register format. 163void 164RemoteGDB::getregs() 165{ 166 memset(gdbregs.regs, 0, gdbregs.size); 167 168 gdbregs.regs[RegPc] = context->readPC(); 169 gdbregs.regs[RegNpc] = context->readNextPC(); |
207 for(int x = RegG0; x <= RegI7; x++) | 170 for(int x = RegG0; x <= RegI0 + 7; x++) |
208 gdbregs.regs[x] = context->readIntReg(x - RegG0); | 171 gdbregs.regs[x] = context->readIntReg(x - RegG0); |
209 for(int x = RegF0; x <= RegF31; x++) 210 gdbregs.regs[x] = context->readFloatRegBits(x - RegF0); 211 gdbregs.regs[RegY] = context->readMiscReg(MISCREG_Y); 212 //XXX need to also load up Psr, Wim, Tbr, Fpsr, and Cpsr | 172 //Floating point registers are left at 0 in netbsd 173 //All registers other than the pc, npc and int regs 174 //are ignored as well. |
213} 214 215/////////////////////////////////////////////////////////// 216// RemoteGDB::setregs 217// 218// Translate the GDB register format into the kernel 219// debugger register format. 220// 221void 222RemoteGDB::setregs() 223{ 224 context->setPC(gdbregs.regs[RegPc]); 225 context->setNextPC(gdbregs.regs[RegNpc]); | 175} 176 177/////////////////////////////////////////////////////////// 178// RemoteGDB::setregs 179// 180// Translate the GDB register format into the kernel 181// debugger register format. 182// 183void 184RemoteGDB::setregs() 185{ 186 context->setPC(gdbregs.regs[RegPc]); 187 context->setNextPC(gdbregs.regs[RegNpc]); |
226 for(int x = RegG0; x <= RegI7; x++) | 188 for(int x = RegG0; x <= RegI0 + 7; x++) |
227 context->setIntReg(x - RegG0, gdbregs.regs[x]); | 189 context->setIntReg(x - RegG0, gdbregs.regs[x]); |
228 for(int x = RegF0; x <= RegF31; x++) 229 context->setFloatRegBits(x - RegF0, gdbregs.regs[x]); 230 context->setMiscRegWithEffect(MISCREG_Y, gdbregs.regs[RegY]); 231 //XXX need to also set Psr, Wim, Tbr, Fpsr, and Cpsr | 190 //Only the integer registers, pc and npc are set in netbsd |
232} 233 234void 235RemoteGDB::clearSingleStep() 236{ | 191} 192 193void 194RemoteGDB::clearSingleStep() 195{ |
237#if 0 238 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n", 239 takenBkpt.address, notTakenBkpt.address); 240 241 if (takenBkpt.address != 0) 242 clearTempBreakpoint(takenBkpt); 243 244 if (notTakenBkpt.address != 0) 245 clearTempBreakpoint(notTakenBkpt); 246#endif | 196 panic("SPARC does not support hardware single stepping\n"); |
247} 248 249void 250RemoteGDB::setSingleStep() 251{ | 197} 198 199void 200RemoteGDB::setSingleStep() 201{ |
252#if 0 253 Addr pc = context->readPC(); 254 Addr npc, bpc; 255 bool set_bt = false; 256 257 npc = pc + sizeof(MachInst); 258 259 // User was stopped at pc, e.g. the instruction at pc was not 260 // executed. 261 MachInst inst = read<MachInst>(pc); 262 StaticInstPtr si(inst); 263 if (si->hasBranchTarget(pc, context, bpc)) { 264 // Don't bother setting a breakpoint on the taken branch if it 265 // is the same as the next pc 266 if (bpc != npc) 267 set_bt = true; 268 } 269 270 DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n", 271 takenBkpt.address, notTakenBkpt.address); 272 273 setTempBreakpoint(notTakenBkpt, npc); 274 275 if (set_bt) 276 setTempBreakpoint(takenBkpt, bpc); 277#endif | 202 panic("SPARC does not support hardware single stepping\n"); |
278} | 203} |