remote_gdb.cc (10595:25ecfc14f73f) remote_gdb.cc (10601:6efb37480d87)
1/*
2 * Copyright 2014 Google, Inc.
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
11 * terms below provided that you ensure that this notice is replicated
12 * unmodified and in its entirety in all distributions of the software,
13 * modified or unmodified, in source code or in binary form.
14 *
15 * Copyright (c) 2002-2005 The Regents of The University of Michigan
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;
22 * redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution;
25 * neither the name of the copyright holders nor the names of its
26 * contributors may be used to endorse or promote products derived from
27 * this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * Authors: Nathan Binkert
42 * William Wang
43 * Deyuan Guo
44 */
45
46/*
47 * Copyright (c) 1990, 1993 The Regents of the University of California
48 * All rights reserved
49 *
50 * This software was developed by the Computer Systems Engineering group
51 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
52 * contributed to Berkeley.
53 *
54 * All advertising materials mentioning features or use of this software
55 * must display the following acknowledgement:
56 * This product includes software developed by the University of
57 * California, Lawrence Berkeley Laboratories.
58 *
59 * Redistribution and use in source and binary forms, with or without
60 * modification, are permitted provided that the following conditions
61 * are met:
62 * 1. Redistributions of source code must retain the above copyright
63 * notice, this list of conditions and the following disclaimer.
64 * 2. Redistributions in binary form must reproduce the above copyright
65 * notice, this list of conditions and the following disclaimer in the
66 * documentation and/or other materials provided with the distribution.
67 * 3. All advertising materials mentioning features or use of this software
68 * must display the following acknowledgement:
69 * This product includes software developed by the University of
70 * California, Berkeley and its contributors.
71 * 4. Neither the name of the University nor the names of its contributors
72 * may be used to endorse or promote products derived from this software
73 * without specific prior written permission.
74 *
75 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
76 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
77 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
78 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
79 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
80 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
81 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
82 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
83 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
84 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
85 * SUCH DAMAGE.
86 *
87 * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
88 */
89
90/*-
91 * Copyright (c) 2001 The NetBSD Foundation, Inc.
92 * All rights reserved.
93 *
94 * This code is derived from software contributed to The NetBSD Foundation
95 * by Jason R. Thorpe.
96 *
97 * Redistribution and use in source and binary forms, with or without
98 * modification, are permitted provided that the following conditions
99 * are met:
100 * 1. Redistributions of source code must retain the above copyright
101 * notice, this list of conditions and the following disclaimer.
102 * 2. Redistributions in binary form must reproduce the above copyright
103 * notice, this list of conditions and the following disclaimer in the
104 * documentation and/or other materials provided with the distribution.
105 * 3. All advertising materials mentioning features or use of this software
106 * must display the following acknowledgement:
107 * This product includes software developed by the NetBSD
108 * Foundation, Inc. and its contributors.
109 * 4. Neither the name of The NetBSD Foundation nor the names of its
110 * contributors may be used to endorse or promote products derived
111 * from this software without specific prior written permission.
112 *
113 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
114 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
115 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
116 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
117 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
118 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
119 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
120 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
121 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
122 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
123 * POSSIBILITY OF SUCH DAMAGE.
124 */
125
126/*
127 * $NetBSD: kgdb_stub.c,v 1.8 2001/07/07 22:58:00 wdk Exp $
128 *
129 * Taken from NetBSD
130 *
131 * "Stub" to allow remote cpu to debug over a serial line using gdb.
132 */
133
134#include <sys/signal.h>
135#include <unistd.h>
136
137#include <string>
138
139#include "arch/mips/decoder.hh"
140#include "arch/mips/remote_gdb.hh"
141#include "arch/mips/vtophys.hh"
142#include "cpu/thread_state.hh"
143#include "debug/GDBAcc.hh"
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)
152 : BaseRemoteGDB(_system, tc, GdbNumRegs * sizeof(uint32_t))
153{
154}
155
156/*
157 * Determine if the mapping at va..(va+len) is valid.
158 */
159bool
160RemoteGDB::acc(Addr va, size_t len)
161{
162 TlbEntry entry;
163 //Check to make sure the first byte is mapped into the processes address
164 //space.
165 if (FullSystem)
166 panic("acc not implemented for MIPS FS!");
167 else
168 return context->getProcessPtr()->pTable->lookup(va, entry);
169}
170
171/*
172 * Translate the kernel debugger register format into the GDB register
173 * format.
174 */
175void
176RemoteGDB::getregs()
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
185 for (int i = 0; i < GdbIntArchRegs; i++)
186 gdbregs.regs32[i] = context->readIntReg(i);
187 // SR, LO, HI, BADVADDR, CAUSE, 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();
197 // FLOATREG: F0~F31
198 for (int i = 0; i < GdbFloatArchRegs; i++)
199 gdbregs.regs32[GdbIntRegs + i] = context->readFloatRegBits(i);
200 // FCR, FIR
201 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 0] =
202 context->readFloatRegBits(FLOATREG_FCCR);
203 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1] =
204 context->readFloatRegBits(FLOATREG_FIR);
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
216 // INTREG: R0~R31
217 for (int i = 1; i < GdbIntArchRegs; i++)
218 context->setIntReg(i, gdbregs.regs32[i]);
219 // SR, LO, HI, BADVADDR, CAUSE, PC
220 context->setMiscRegNoEffect(MISCREG_STATUS,
221 gdbregs.regs32[GdbIntArchRegs + 0]);
222 context->setIntReg(INTREG_LO, gdbregs.regs32[GdbIntArchRegs + 1]);
223 context->setIntReg(INTREG_HI, gdbregs.regs32[GdbIntArchRegs + 2]);
224 context->setMiscRegNoEffect(MISCREG_BADVADDR,
225 gdbregs.regs32[GdbIntArchRegs + 3]);
226 context->setMiscRegNoEffect(MISCREG_CAUSE,
227 gdbregs.regs32[GdbIntArchRegs + 4]);
228 context->pcState(gdbregs.regs32[GdbIntArchRegs + 5]);
229 // FLOATREG: F0~F31
230 for (int i = 0; i < GdbFloatArchRegs; i++)
231 context->setFloatRegBits(i, gdbregs.regs32[GdbIntRegs + i]);
232 // FCR, FIR
233 context->setFloatRegBits(FLOATREG_FCCR,
234 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 0]);
235 context->setFloatRegBits(FLOATREG_FIR,
236 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1]);
237}
1/*
2 * Copyright 2014 Google, Inc.
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
11 * terms below provided that you ensure that this notice is replicated
12 * unmodified and in its entirety in all distributions of the software,
13 * modified or unmodified, in source code or in binary form.
14 *
15 * Copyright (c) 2002-2005 The Regents of The University of Michigan
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;
22 * redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution;
25 * neither the name of the copyright holders nor the names of its
26 * contributors may be used to endorse or promote products derived from
27 * this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * Authors: Nathan Binkert
42 * William Wang
43 * Deyuan Guo
44 */
45
46/*
47 * Copyright (c) 1990, 1993 The Regents of the University of California
48 * All rights reserved
49 *
50 * This software was developed by the Computer Systems Engineering group
51 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
52 * contributed to Berkeley.
53 *
54 * All advertising materials mentioning features or use of this software
55 * must display the following acknowledgement:
56 * This product includes software developed by the University of
57 * California, Lawrence Berkeley Laboratories.
58 *
59 * Redistribution and use in source and binary forms, with or without
60 * modification, are permitted provided that the following conditions
61 * are met:
62 * 1. Redistributions of source code must retain the above copyright
63 * notice, this list of conditions and the following disclaimer.
64 * 2. Redistributions in binary form must reproduce the above copyright
65 * notice, this list of conditions and the following disclaimer in the
66 * documentation and/or other materials provided with the distribution.
67 * 3. All advertising materials mentioning features or use of this software
68 * must display the following acknowledgement:
69 * This product includes software developed by the University of
70 * California, Berkeley and its contributors.
71 * 4. Neither the name of the University nor the names of its contributors
72 * may be used to endorse or promote products derived from this software
73 * without specific prior written permission.
74 *
75 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
76 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
77 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
78 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
79 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
80 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
81 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
82 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
83 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
84 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
85 * SUCH DAMAGE.
86 *
87 * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
88 */
89
90/*-
91 * Copyright (c) 2001 The NetBSD Foundation, Inc.
92 * All rights reserved.
93 *
94 * This code is derived from software contributed to The NetBSD Foundation
95 * by Jason R. Thorpe.
96 *
97 * Redistribution and use in source and binary forms, with or without
98 * modification, are permitted provided that the following conditions
99 * are met:
100 * 1. Redistributions of source code must retain the above copyright
101 * notice, this list of conditions and the following disclaimer.
102 * 2. Redistributions in binary form must reproduce the above copyright
103 * notice, this list of conditions and the following disclaimer in the
104 * documentation and/or other materials provided with the distribution.
105 * 3. All advertising materials mentioning features or use of this software
106 * must display the following acknowledgement:
107 * This product includes software developed by the NetBSD
108 * Foundation, Inc. and its contributors.
109 * 4. Neither the name of The NetBSD Foundation nor the names of its
110 * contributors may be used to endorse or promote products derived
111 * from this software without specific prior written permission.
112 *
113 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
114 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
115 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
116 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
117 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
118 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
119 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
120 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
121 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
122 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
123 * POSSIBILITY OF SUCH DAMAGE.
124 */
125
126/*
127 * $NetBSD: kgdb_stub.c,v 1.8 2001/07/07 22:58:00 wdk Exp $
128 *
129 * Taken from NetBSD
130 *
131 * "Stub" to allow remote cpu to debug over a serial line using gdb.
132 */
133
134#include <sys/signal.h>
135#include <unistd.h>
136
137#include <string>
138
139#include "arch/mips/decoder.hh"
140#include "arch/mips/remote_gdb.hh"
141#include "arch/mips/vtophys.hh"
142#include "cpu/thread_state.hh"
143#include "debug/GDBAcc.hh"
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)
152 : BaseRemoteGDB(_system, tc, GdbNumRegs * sizeof(uint32_t))
153{
154}
155
156/*
157 * Determine if the mapping at va..(va+len) is valid.
158 */
159bool
160RemoteGDB::acc(Addr va, size_t len)
161{
162 TlbEntry entry;
163 //Check to make sure the first byte is mapped into the processes address
164 //space.
165 if (FullSystem)
166 panic("acc not implemented for MIPS FS!");
167 else
168 return context->getProcessPtr()->pTable->lookup(va, entry);
169}
170
171/*
172 * Translate the kernel debugger register format into the GDB register
173 * format.
174 */
175void
176RemoteGDB::getregs()
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
185 for (int i = 0; i < GdbIntArchRegs; i++)
186 gdbregs.regs32[i] = context->readIntReg(i);
187 // SR, LO, HI, BADVADDR, CAUSE, 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();
197 // FLOATREG: F0~F31
198 for (int i = 0; i < GdbFloatArchRegs; i++)
199 gdbregs.regs32[GdbIntRegs + i] = context->readFloatRegBits(i);
200 // FCR, FIR
201 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 0] =
202 context->readFloatRegBits(FLOATREG_FCCR);
203 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1] =
204 context->readFloatRegBits(FLOATREG_FIR);
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
216 // INTREG: R0~R31
217 for (int i = 1; i < GdbIntArchRegs; i++)
218 context->setIntReg(i, gdbregs.regs32[i]);
219 // SR, LO, HI, BADVADDR, CAUSE, PC
220 context->setMiscRegNoEffect(MISCREG_STATUS,
221 gdbregs.regs32[GdbIntArchRegs + 0]);
222 context->setIntReg(INTREG_LO, gdbregs.regs32[GdbIntArchRegs + 1]);
223 context->setIntReg(INTREG_HI, gdbregs.regs32[GdbIntArchRegs + 2]);
224 context->setMiscRegNoEffect(MISCREG_BADVADDR,
225 gdbregs.regs32[GdbIntArchRegs + 3]);
226 context->setMiscRegNoEffect(MISCREG_CAUSE,
227 gdbregs.regs32[GdbIntArchRegs + 4]);
228 context->pcState(gdbregs.regs32[GdbIntArchRegs + 5]);
229 // FLOATREG: F0~F31
230 for (int i = 0; i < GdbFloatArchRegs; i++)
231 context->setFloatRegBits(i, gdbregs.regs32[GdbIntRegs + i]);
232 // FCR, FIR
233 context->setFloatRegBits(FLOATREG_FCCR,
234 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 0]);
235 context->setFloatRegBits(FLOATREG_FIR,
236 gdbregs.regs32[GdbIntRegs + GdbFloatArchRegs + 1]);
237}
238
239void
240RemoteGDB::clearSingleStep()
241{
242 DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n",
243 takenBkpt, notTakenBkpt);
244
245 if (takenBkpt != 0)
246 clearTempBreakpoint(takenBkpt);
247
248 if (notTakenBkpt != 0)
249 clearTempBreakpoint(notTakenBkpt);
250}
251
252void
253RemoteGDB::setSingleStep()
254{
255 PCState pc = context->pcState();
256 PCState bpc;
257 bool set_bt = false;
258
259 // User was stopped at pc, e.g. the instruction at pc was not
260 // executed.
261 MachInst inst = read<MachInst>(pc.pc());
262 StaticInstPtr si = context->getDecoderPtr()->decode(inst, pc.pc());
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 npc
266 if (bpc.npc() != pc.nnpc())
267 set_bt = true;
268 }
269
270 DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n",
271 takenBkpt, notTakenBkpt);
272
273 notTakenBkpt = pc.nnpc();
274 setTempBreakpoint(notTakenBkpt);
275
276 if (set_bt) {
277 takenBkpt = bpc.npc();
278 setTempBreakpoint(takenBkpt);
279 }
280}
281