remote_gdb.cc revision 10595
13536SN/A/*
210595Sgabeblack@google.com * Copyright 2014 Google Inc.
310037SARM gem5 Developers * Copyright (c) 2010, 2013 ARM Limited
47752SWilliam.Wang@arm.com * All rights reserved
57752SWilliam.Wang@arm.com *
67752SWilliam.Wang@arm.com * The license below extends only to copyright in the software and shall
77752SWilliam.Wang@arm.com * not be construed as granting a license to any other intellectual
87752SWilliam.Wang@arm.com * property including but not limited to intellectual property relating
97752SWilliam.Wang@arm.com * to a hardware implementation of the functionality of the software
107752SWilliam.Wang@arm.com * licensed hereunder.  You may use the software subject to the license
117752SWilliam.Wang@arm.com * terms below provided that you ensure that this notice is replicated
127752SWilliam.Wang@arm.com * unmodified and in its entirety in all distributions of the software,
137752SWilliam.Wang@arm.com * modified or unmodified, in source code or in binary form.
147752SWilliam.Wang@arm.com *
153536SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
163536SN/A * All rights reserved.
173536SN/A *
183536SN/A * Redistribution and use in source and binary forms, with or without
193536SN/A * modification, are permitted provided that the following conditions are
203536SN/A * met: redistributions of source code must retain the above copyright
213536SN/A * notice, this list of conditions and the following disclaimer;
223536SN/A * redistributions in binary form must reproduce the above copyright
233536SN/A * notice, this list of conditions and the following disclaimer in the
243536SN/A * documentation and/or other materials provided with the distribution;
253536SN/A * neither the name of the copyright holders nor the names of its
263536SN/A * contributors may be used to endorse or promote products derived from
273536SN/A * this software without specific prior written permission.
283536SN/A *
293536SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
303536SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
313536SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
323536SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
333536SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
343536SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
353536SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
363536SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
373536SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
383536SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
393536SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
403536SN/A *
413536SN/A * Authors: Nathan Binkert
427752SWilliam.Wang@arm.com *          William Wang
433536SN/A */
443536SN/A
453536SN/A/*
468332Snate@binkert.org * Copyright (c) 1990, 1993 The Regents of the University of California
478332Snate@binkert.org * All rights reserved
483536SN/A *
493536SN/A * This software was developed by the Computer Systems Engineering group
503536SN/A * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
513536SN/A * contributed to Berkeley.
523536SN/A *
533536SN/A * All advertising materials mentioning features or use of this software
543536SN/A * must display the following acknowledgement:
555543SN/A *      This product includes software developed by the University of
565543SN/A *      California, Lawrence Berkeley Laboratories.
573536SN/A *
583536SN/A * Redistribution and use in source and binary forms, with or without
593536SN/A * modification, are permitted provided that the following conditions
603536SN/A * are met:
613536SN/A * 1. Redistributions of source code must retain the above copyright
623536SN/A *    notice, this list of conditions and the following disclaimer.
633536SN/A * 2. Redistributions in binary form must reproduce the above copyright
643536SN/A *    notice, this list of conditions and the following disclaimer in the
653536SN/A *    documentation and/or other materials provided with the distribution.
663536SN/A * 3. All advertising materials mentioning features or use of this software
673536SN/A *    must display the following acknowledgement:
685543SN/A *      This product includes software developed by the University of
695543SN/A *      California, Berkeley and its contributors.
703536SN/A * 4. Neither the name of the University nor the names of its contributors
713536SN/A *    may be used to endorse or promote products derived from this software
723536SN/A *    without specific prior written permission.
733536SN/A *
743536SN/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
753536SN/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
763536SN/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
773536SN/A * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
783536SN/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
793536SN/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
803536SN/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
813536SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
823536SN/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
833536SN/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
843536SN/A * SUCH DAMAGE.
853536SN/A *
865543SN/A *      @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
873536SN/A */
883536SN/A
893536SN/A/*-
903536SN/A * Copyright (c) 2001 The NetBSD Foundation, Inc.
913536SN/A * All rights reserved.
923536SN/A *
933536SN/A * This code is derived from software contributed to The NetBSD Foundation
943536SN/A * by Jason R. Thorpe.
953536SN/A *
963536SN/A * Redistribution and use in source and binary forms, with or without
973536SN/A * modification, are permitted provided that the following conditions
983536SN/A * are met:
993536SN/A * 1. Redistributions of source code must retain the above copyright
1003536SN/A *    notice, this list of conditions and the following disclaimer.
1013536SN/A * 2. Redistributions in binary form must reproduce the above copyright
1023536SN/A *    notice, this list of conditions and the following disclaimer in the
1033536SN/A *    documentation and/or other materials provided with the distribution.
1043536SN/A * 3. All advertising materials mentioning features or use of this software
1053536SN/A *    must display the following acknowledgement:
1065543SN/A *      This product includes software developed by the NetBSD
1075543SN/A *      Foundation, Inc. and its contributors.
1083536SN/A * 4. Neither the name of The NetBSD Foundation nor the names of its
1093536SN/A *    contributors may be used to endorse or promote products derived
1103536SN/A *    from this software without specific prior written permission.
1113536SN/A *
1123536SN/A * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1133536SN/A * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1143536SN/A * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1153536SN/A * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1163536SN/A * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1173536SN/A * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1183536SN/A * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1193536SN/A * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1203536SN/A * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1213536SN/A * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1223536SN/A * POSSIBILITY OF SUCH DAMAGE.
1233536SN/A */
1243536SN/A
1253536SN/A/*
1263536SN/A * $NetBSD: kgdb_stub.c,v 1.8 2001/07/07 22:58:00 wdk Exp $
1273536SN/A *
1283536SN/A * Taken from NetBSD
1293536SN/A *
1303536SN/A * "Stub" to allow remote cpu to debug over a serial line using gdb.
1313536SN/A */
1323536SN/A
1333536SN/A#include <sys/signal.h>
1345569SN/A#include <unistd.h>
1353536SN/A
1363536SN/A#include <string>
1373536SN/A
1389020Sgblack@eecs.umich.edu#include "arch/arm/decoder.hh"
1398229Snate@binkert.org#include "arch/arm/pagetable.hh"
1408229Snate@binkert.org#include "arch/arm/registers.hh"
1418229Snate@binkert.org#include "arch/arm/remote_gdb.hh"
14210037SARM gem5 Developers#include "arch/arm/system.hh"
1437752SWilliam.Wang@arm.com#include "arch/arm/utility.hh"
1447752SWilliam.Wang@arm.com#include "arch/arm/vtophys.hh"
1453536SN/A#include "base/intmath.hh"
1463536SN/A#include "base/remote_gdb.hh"
1473536SN/A#include "base/socket.hh"
1483536SN/A#include "base/trace.hh"
1498229Snate@binkert.org#include "cpu/static_inst.hh"
1503536SN/A#include "cpu/thread_context.hh"
1517752SWilliam.Wang@arm.com#include "cpu/thread_state.hh"
1528232Snate@binkert.org#include "debug/GDBAcc.hh"
1538232Snate@binkert.org#include "debug/GDBMisc.hh"
1548229Snate@binkert.org#include "mem/page_table.hh"
1553536SN/A#include "mem/physical.hh"
1563536SN/A#include "mem/port.hh"
1578782Sgblack@eecs.umich.edu#include "sim/full_system.hh"
1583536SN/A#include "sim/system.hh"
1593536SN/A
1603536SN/Ausing namespace std;
1617752SWilliam.Wang@arm.comusing namespace ArmISA;
1623536SN/A
1635569SN/ARemoteGDB::RemoteGDB(System *_system, ThreadContext *tc)
16410595Sgabeblack@google.com    : BaseRemoteGDB(_system, tc, GDB_REG_BYTES),
16510595Sgabeblack@google.com      notTakenBkpt(0), takenBkpt(0)
1663536SN/A{
1673536SN/A}
1683536SN/A
1695569SN/A/*
1705569SN/A * Determine if the mapping at va..(va+len) is valid.
1715569SN/A */
1723536SN/Abool
1733536SN/ARemoteGDB::acc(Addr va, size_t len)
1743536SN/A{
1758782Sgblack@eecs.umich.edu    if (FullSystem) {
1768782Sgblack@eecs.umich.edu        Addr last_va;
1778782Sgblack@eecs.umich.edu        va       = truncPage(va);
1788782Sgblack@eecs.umich.edu        last_va  = roundPage(va + len);
1793536SN/A
1808782Sgblack@eecs.umich.edu        do  {
1818782Sgblack@eecs.umich.edu            if (virtvalid(context, va)) {
1828782Sgblack@eecs.umich.edu                return true;
1838782Sgblack@eecs.umich.edu            }
1848782Sgblack@eecs.umich.edu            va += PageBytes;
1858782Sgblack@eecs.umich.edu        } while (va < last_va);
1868782Sgblack@eecs.umich.edu
1878782Sgblack@eecs.umich.edu        DPRINTF(GDBAcc, "acc:   %#x mapping is valid\n", va);
1888782Sgblack@eecs.umich.edu        return true;
1898782Sgblack@eecs.umich.edu    } else {
1908782Sgblack@eecs.umich.edu        TlbEntry entry;
1918782Sgblack@eecs.umich.edu        //Check to make sure the first byte is mapped into the processes address
1928782Sgblack@eecs.umich.edu        //space.
1938782Sgblack@eecs.umich.edu        if (context->getProcessPtr()->pTable->lookup(va, entry))
1943536SN/A            return true;
1958782Sgblack@eecs.umich.edu        return false;
1968782Sgblack@eecs.umich.edu    }
1973536SN/A}
1983536SN/A
1995569SN/A/*
2005569SN/A * Translate the kernel debugger register format into the GDB register
2015569SN/A * format.
2025569SN/A */
2033536SN/Avoid
2043536SN/ARemoteGDB::getregs()
2053536SN/A{
2067752SWilliam.Wang@arm.com    DPRINTF(GDBAcc, "getregs in remotegdb \n");
2077752SWilliam.Wang@arm.com
2083579SN/A    memset(gdbregs.regs, 0, gdbregs.bytes());
2093536SN/A
21010037SARM gem5 Developers    if (inAArch64(context)) {  // AArch64
21110037SARM gem5 Developers        // x0-x31
21210595Sgabeblack@google.com        for (int i = 0; i < 32; ++i)
21310595Sgabeblack@google.com            gdbregs.regs64[GDB64_X0 + i] = context->readIntReg(INTREG_X0 + i);
21410037SARM gem5 Developers        // pc
21510595Sgabeblack@google.com        gdbregs.regs64[GDB64_PC] = context->pcState().pc();
21610037SARM gem5 Developers        // cpsr
21710595Sgabeblack@google.com        gdbregs.regs64[GDB64_CPSR] =
21810595Sgabeblack@google.com            context->readMiscRegNoEffect(MISCREG_CPSR);
21910037SARM gem5 Developers        // v0-v31
22010595Sgabeblack@google.com        for (int i = 0; i < 128; i += 4) {
22110595Sgabeblack@google.com            int gdboff = GDB64_V0_32 + i;
22210595Sgabeblack@google.com            gdbregs.regs32[gdboff + 0] = context->readFloatRegBits(i + 2);
22310595Sgabeblack@google.com            gdbregs.regs32[gdboff + 1] = context->readFloatRegBits(i + 3);
22410595Sgabeblack@google.com            gdbregs.regs32[gdboff + 2] = context->readFloatRegBits(i + 0);
22510595Sgabeblack@google.com            gdbregs.regs32[gdboff + 3] = context->readFloatRegBits(i + 1);
22610037SARM gem5 Developers        }
22710037SARM gem5 Developers    } else {  // AArch32
22810037SARM gem5 Developers        // R0-R15 supervisor mode
22910595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 0] = context->readIntReg(INTREG_R0);
23010595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 1] = context->readIntReg(INTREG_R1);
23110595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 2] = context->readIntReg(INTREG_R2);
23210595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 3] = context->readIntReg(INTREG_R3);
23310595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 4] = context->readIntReg(INTREG_R4);
23410595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 5] = context->readIntReg(INTREG_R5);
23510595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 6] = context->readIntReg(INTREG_R6);
23610595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 7] = context->readIntReg(INTREG_R7);
23710595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 8] = context->readIntReg(INTREG_R8);
23810595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 9] = context->readIntReg(INTREG_R9);
23910595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 10] = context->readIntReg(INTREG_R10);
24010595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 11] = context->readIntReg(INTREG_R11);
24110595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 12] = context->readIntReg(INTREG_R12);
24210595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 13] = context->readIntReg(INTREG_SP);
24310595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 14] = context->readIntReg(INTREG_LR);
24410595Sgabeblack@google.com        gdbregs.regs32[GDB32_R0 + 15] = context->pcState().pc();
2453536SN/A
24610037SARM gem5 Developers        // CPSR
24710595Sgabeblack@google.com        gdbregs.regs32[GDB32_CPSR] = context->readMiscRegNoEffect(MISCREG_CPSR);
2487752SWilliam.Wang@arm.com
24910037SARM gem5 Developers        // vfpv3/neon floating point registers (32 double or 64 float)
25010595Sgabeblack@google.com        for (int i = 0; i < NumFloatV7ArchRegs; ++i)
25110595Sgabeblack@google.com            gdbregs.regs32[GDB32_F0 + i] = context->readFloatRegBits(i);
25210037SARM gem5 Developers
25310037SARM gem5 Developers        // FPSCR
25410595Sgabeblack@google.com        gdbregs.regs32[GDB32_FPSCR] =
25510595Sgabeblack@google.com            context->readMiscRegNoEffect(MISCREG_FPSCR);
2563536SN/A    }
2573536SN/A}
2583536SN/A
2595569SN/A/*
2605569SN/A * Translate the GDB register format into the kernel debugger register
2615569SN/A * format.
2625569SN/A */
2633536SN/Avoid
2643536SN/ARemoteGDB::setregs()
2653536SN/A{
2667752SWilliam.Wang@arm.com
2677752SWilliam.Wang@arm.com    DPRINTF(GDBAcc, "setregs in remotegdb \n");
26810037SARM gem5 Developers    if (inAArch64(context)) {  // AArch64
26910037SARM gem5 Developers        // x0-x31
27010595Sgabeblack@google.com        for (int i = 0; i < 32; ++i)
27110595Sgabeblack@google.com            context->setIntReg(INTREG_X0 + i, gdbregs.regs64[GDB64_X0 + i]);
27210037SARM gem5 Developers        // pc
27310595Sgabeblack@google.com        context->pcState(gdbregs.regs64[GDB64_PC]);
27410037SARM gem5 Developers        // cpsr
27510595Sgabeblack@google.com        context->setMiscRegNoEffect(MISCREG_CPSR, gdbregs.regs64[GDB64_CPSR]);
27610037SARM gem5 Developers        // v0-v31
27710595Sgabeblack@google.com        for (int i = 0; i < 128; i += 4) {
27810595Sgabeblack@google.com            int gdboff = GDB64_V0_32 + i;
27910595Sgabeblack@google.com            context->setFloatRegBits(i + 2, gdbregs.regs32[gdboff + 0]);
28010595Sgabeblack@google.com            context->setFloatRegBits(i + 3, gdbregs.regs32[gdboff + 1]);
28110595Sgabeblack@google.com            context->setFloatRegBits(i + 0, gdbregs.regs32[gdboff + 2]);
28210595Sgabeblack@google.com            context->setFloatRegBits(i + 1, gdbregs.regs32[gdboff + 3]);
28310037SARM gem5 Developers        }
28410037SARM gem5 Developers    } else {  // AArch32
28510037SARM gem5 Developers        // R0-R15 supervisor mode
28610037SARM gem5 Developers        // arm registers are 32 bits wide, gdb registers are 64 bits wide
28710037SARM gem5 Developers        // two arm registers are packed into one gdb register (little endian)
28810595Sgabeblack@google.com        context->setIntReg(INTREG_R0, gdbregs.regs32[GDB32_R0 + 0]);
28910595Sgabeblack@google.com        context->setIntReg(INTREG_R1, gdbregs.regs32[GDB32_R0 + 1]);
29010595Sgabeblack@google.com        context->setIntReg(INTREG_R2, gdbregs.regs32[GDB32_R0 + 2]);
29110595Sgabeblack@google.com        context->setIntReg(INTREG_R3, gdbregs.regs32[GDB32_R0 + 3]);
29210595Sgabeblack@google.com        context->setIntReg(INTREG_R4, gdbregs.regs32[GDB32_R0 + 4]);
29310595Sgabeblack@google.com        context->setIntReg(INTREG_R5, gdbregs.regs32[GDB32_R0 + 5]);
29410595Sgabeblack@google.com        context->setIntReg(INTREG_R6, gdbregs.regs32[GDB32_R0 + 6]);
29510595Sgabeblack@google.com        context->setIntReg(INTREG_R7, gdbregs.regs32[GDB32_R0 + 7]);
29610595Sgabeblack@google.com        context->setIntReg(INTREG_R8, gdbregs.regs32[GDB32_R0 + 8]);
29710595Sgabeblack@google.com        context->setIntReg(INTREG_R9, gdbregs.regs32[GDB32_R0 + 9]);
29810595Sgabeblack@google.com        context->setIntReg(INTREG_R10, gdbregs.regs32[GDB32_R0 + 10]);
29910595Sgabeblack@google.com        context->setIntReg(INTREG_R11, gdbregs.regs32[GDB32_R0 + 11]);
30010595Sgabeblack@google.com        context->setIntReg(INTREG_R12, gdbregs.regs32[GDB32_R0 + 12]);
30110595Sgabeblack@google.com        context->setIntReg(INTREG_SP, gdbregs.regs32[GDB32_R0 + 13]);
30210595Sgabeblack@google.com        context->setIntReg(INTREG_LR, gdbregs.regs32[GDB32_R0 + 14]);
30310595Sgabeblack@google.com        context->pcState(gdbregs.regs32[GDB32_R0 + 7]);
3047752SWilliam.Wang@arm.com
30510037SARM gem5 Developers        //CPSR
30610595Sgabeblack@google.com        context->setMiscRegNoEffect(MISCREG_CPSR, gdbregs.regs32[GDB32_CPSR]);
3077752SWilliam.Wang@arm.com
30810037SARM gem5 Developers        //vfpv3/neon floating point registers (32 double or 64 float)
30910595Sgabeblack@google.com        for (int i = 0; i < NumFloatV7ArchRegs; ++i)
31010595Sgabeblack@google.com            context->setFloatRegBits(i, gdbregs.regs32[GDB32_F0 + i]);
3117752SWilliam.Wang@arm.com
31210037SARM gem5 Developers        //FPSCR
31310595Sgabeblack@google.com        context->setMiscReg(MISCREG_FPSCR, gdbregs.regs32[GDB32_FPSCR]);
3143536SN/A    }
3153536SN/A}
3163536SN/A
3173536SN/Avoid
3183536SN/ARemoteGDB::clearSingleStep()
3193536SN/A{
3203536SN/A    DPRINTF(GDBMisc, "clearSingleStep bt_addr=%#x nt_addr=%#x\n",
3213550SN/A            takenBkpt, notTakenBkpt);
3223536SN/A
3233550SN/A    if (takenBkpt != 0)
3243536SN/A        clearTempBreakpoint(takenBkpt);
3253536SN/A
3263550SN/A    if (notTakenBkpt != 0)
3273536SN/A        clearTempBreakpoint(notTakenBkpt);
3283536SN/A}
3293536SN/A
3303536SN/Avoid
3313536SN/ARemoteGDB::setSingleStep()
3323536SN/A{
3337720SN/A    PCState pc = context->pcState();
3347720SN/A    PCState bpc;
3353536SN/A    bool set_bt = false;
3363536SN/A
3373536SN/A    // User was stopped at pc, e.g. the instruction at pc was not
3383536SN/A    // executed.
3397720SN/A    MachInst inst = read<MachInst>(pc.pc());
3408541Sgblack@eecs.umich.edu    StaticInstPtr si = context->getDecoderPtr()->decode(inst, pc.pc());
3413536SN/A    if (si->hasBranchTarget(pc, context, bpc)) {
3423536SN/A        // Don't bother setting a breakpoint on the taken branch if it
3433536SN/A        // is the same as the next pc
3447720SN/A        if (bpc.pc() != pc.npc())
3453536SN/A            set_bt = true;
3463536SN/A    }
3473536SN/A
3483536SN/A    DPRINTF(GDBMisc, "setSingleStep bt_addr=%#x nt_addr=%#x\n",
3493550SN/A            takenBkpt, notTakenBkpt);
3503536SN/A
3517720SN/A    setTempBreakpoint(notTakenBkpt = pc.npc());
3523536SN/A
3533536SN/A    if (set_bt)
3547720SN/A        setTempBreakpoint(takenBkpt = bpc.pc());
3553536SN/A}
3563536SN/A
3573536SN/A// Write bytes to kernel address space for debugger.
3583536SN/Abool
3593536SN/ARemoteGDB::write(Addr vaddr, size_t size, const char *data)
3603536SN/A{
3617752SWilliam.Wang@arm.com    return BaseRemoteGDB::write(vaddr, size, data);
3623536SN/A}
3633536SN/A
364