remote_gdb.hh revision 14186:146c010fa764
16145SN/A/* 26145SN/A * Copyright (c) 2017 The University of Virginia 36145SN/A * Copyright 2015 LabWare 46145SN/A * Copyright 2014 Google, Inc. 56145SN/A * Copyright (c) 2007 The Regents of The University of Michigan 66145SN/A * All rights reserved. 76145SN/A * 86145SN/A * Redistribution and use in source and binary forms, with or without 96145SN/A * modification, are permitted provided that the following conditions are 106145SN/A * met: redistributions of source code must retain the above copyright 116145SN/A * notice, this list of conditions and the following disclaimer; 126145SN/A * redistributions in binary form must reproduce the above copyright 136145SN/A * notice, this list of conditions and the following disclaimer in the 146145SN/A * documentation and/or other materials provided with the distribution; 156145SN/A * neither the name of the copyright holders nor the names of its 166145SN/A * contributors may be used to endorse or promote products derived from 176145SN/A * this software without specific prior written permission. 186145SN/A * 196145SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 206145SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 216145SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 226145SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 236145SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 246145SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 256145SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 266145SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 276145SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 286145SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 297832SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 307832SN/A * 318232SN/A * Authors: Nathan Binkert 326154SN/A * Boris Shingarov 336154SN/A * Alec Roelke 347054SN/A */ 357054SN/A 368257SBrad.Beckmann@amd.com#ifndef __ARCH_RISCV_REMOTE_GDB_HH__ 378257SBrad.Beckmann@amd.com#define __ARCH_RISCV_REMOTE_GDB_HH__ 387054SN/A 398255SBrad.Beckmann@amd.com#include <string> 407054SN/A 416285SN/A#include "arch/riscv/registers.hh" 426145SN/A#include "base/remote_gdb.hh" 437055SN/A 447055SN/Aclass System; 457054SN/Aclass ThreadContext; 468257SBrad.Beckmann@amd.com 478257SBrad.Beckmann@amd.comnamespace RiscvISA 486145SN/A{ 496145SN/A 506145SN/Aclass RemoteGDB : public BaseRemoteGDB 516145SN/A{ 526145SN/A protected: 536145SN/A static const int NumGDBRegs = 4162; 546145SN/A static const int NumCSRs = 4096; 556145SN/A 566145SN/A bool acc(Addr addr, size_t len); 577054SN/A // A breakpoint will be 2 bytes if it is compressed and 4 if not 587054SN/A bool checkBpLen(size_t len) override { return len == 2 || len == 4; } 597054SN/A 607054SN/A class RiscvGdbRegCache : public BaseGdbRegCache 617054SN/A { 627054SN/A using BaseGdbRegCache::BaseGdbRegCache; 637054SN/A private: 647054SN/A struct { 656145SN/A uint64_t gpr[NumIntArchRegs]; 666876SN/A uint64_t pc; 676876SN/A } r; 686145SN/A public: 696876SN/A char *data() const { return (char *)&r; } 708257SBrad.Beckmann@amd.com size_t size() const { return sizeof(r); } 718257SBrad.Beckmann@amd.com void getRegs(ThreadContext*); 726881SN/A void setRegs(ThreadContext*) const; 737454SN/A 747454SN/A const std::string 756145SN/A name() const 766881SN/A { 776881SN/A return gdb->name() + ".RiscvGdbRegCache"; 786879SN/A } 796881SN/A }; 806285SN/A 817054SN/A RiscvGdbRegCache regCache; 827054SN/A 836879SN/A public: 848257SBrad.Beckmann@amd.com RemoteGDB(System *_system, ThreadContext *tc, int _port); 856879SN/A BaseGdbRegCache *gdbRegs(); 866879SN/A}; 878257SBrad.Beckmann@amd.com 888257SBrad.Beckmann@amd.com} // namespace RiscvISA 898257SBrad.Beckmann@amd.com 908257SBrad.Beckmann@amd.com#endif /* __ARCH_RISCV_REMOTE_GDB_H__ */ 918257SBrad.Beckmann@amd.com