remote_gdb.hh revision 11274
13963Sgblack@eecs.umich.edu/* 211274Sshingarov@labware.com * Copyright 2015 LabWare 310595Sgabeblack@google.com * Copyright 2014 Google, Inc. 45254Sksewell@umich.edu * Copyright (c) 2007 The Regents of The University of Michigan 55254Sksewell@umich.edu * All rights reserved. 63963Sgblack@eecs.umich.edu * 75254Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without 85254Sksewell@umich.edu * modification, are permitted provided that the following conditions are 95254Sksewell@umich.edu * met: redistributions of source code must retain the above copyright 105254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer; 115254Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright 125254Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the 135254Sksewell@umich.edu * documentation and/or other materials provided with the distribution; 145254Sksewell@umich.edu * neither the name of the copyright holders nor the names of its 155254Sksewell@umich.edu * contributors may be used to endorse or promote products derived from 165254Sksewell@umich.edu * this software without specific prior written permission. 173963Sgblack@eecs.umich.edu * 185254Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 195254Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 205254Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 215254Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 225254Sksewell@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 235254Sksewell@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 245254Sksewell@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255254Sksewell@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265254Sksewell@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275254Sksewell@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 285254Sksewell@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 293963Sgblack@eecs.umich.edu * 305254Sksewell@umich.edu * Authors: Nathan Binkert 3111274Sshingarov@labware.com * Boris Shingarov 323963Sgblack@eecs.umich.edu */ 333963Sgblack@eecs.umich.edu 343963Sgblack@eecs.umich.edu#ifndef __ARCH_MIPS_REMOTE_GDB_HH__ 353963Sgblack@eecs.umich.edu#define __ARCH_MIPS_REMOTE_GDB_HH__ 363963Sgblack@eecs.umich.edu 378544Sguodeyuan@tsinghua.org.cn#include "arch/mips/registers.hh" 388544Sguodeyuan@tsinghua.org.cn#include "base/bitfield.hh" 393963Sgblack@eecs.umich.edu#include "base/remote_gdb.hh" 403963Sgblack@eecs.umich.edu 418544Sguodeyuan@tsinghua.org.cnclass System; 428544Sguodeyuan@tsinghua.org.cnclass ThreadContext; 438544Sguodeyuan@tsinghua.org.cn 443963Sgblack@eecs.umich.edunamespace MipsISA 453963Sgblack@eecs.umich.edu{ 468544Sguodeyuan@tsinghua.org.cn 4711274Sshingarov@labware.comclass RemoteGDB : public BaseRemoteGDB 4811274Sshingarov@labware.com{ 4911274Sshingarov@labware.com protected: 5011274Sshingarov@labware.com bool acc(Addr addr, size_t len); 518544Sguodeyuan@tsinghua.org.cn 5211274Sshingarov@labware.com class MipsGdbRegCache : public BaseGdbRegCache 5311274Sshingarov@labware.com { 5411274Sshingarov@labware.com using BaseGdbRegCache::BaseGdbRegCache; 5511274Sshingarov@labware.com private: 5611274Sshingarov@labware.com struct { 5711274Sshingarov@labware.com uint32_t gpr[32]; 5811274Sshingarov@labware.com uint32_t sr; 5911274Sshingarov@labware.com uint32_t lo; 6011274Sshingarov@labware.com uint32_t hi; 6111274Sshingarov@labware.com uint32_t badvaddr; 6211274Sshingarov@labware.com uint32_t cause; 6311274Sshingarov@labware.com uint32_t pc; 6411274Sshingarov@labware.com uint32_t fpr[32]; 6511274Sshingarov@labware.com uint32_t fsr; 6611274Sshingarov@labware.com uint32_t fir; 6711274Sshingarov@labware.com } r; 6811274Sshingarov@labware.com public: 6911274Sshingarov@labware.com char *data() const { return (char *)&r; } 7011274Sshingarov@labware.com size_t size() const { return sizeof(r); } 7111274Sshingarov@labware.com void getRegs(ThreadContext*); 7211274Sshingarov@labware.com void setRegs(ThreadContext*) const; 7311274Sshingarov@labware.com const std::string name() const { return gdb->name() + ".MipsGdbRegCache"; } 7411274Sshingarov@labware.com }; 758544Sguodeyuan@tsinghua.org.cn 763963Sgblack@eecs.umich.edu 7711274Sshingarov@labware.com public: 7811274Sshingarov@labware.com RemoteGDB(System *_system, ThreadContext *tc); 7911274Sshingarov@labware.com BaseGdbRegCache *gdbRegs(); 8011274Sshingarov@labware.com}; 813963Sgblack@eecs.umich.edu 8211274Sshingarov@labware.com} // namespace MipsISA 833963Sgblack@eecs.umich.edu 848544Sguodeyuan@tsinghua.org.cn#endif /* __ARCH_MIPS_REMOTE_GDB_H__ */ 85