gem5  v20.1.0.0
remote_gdb.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 The University of Virginia
3  * Copyright 2015 LabWare
4  * Copyright 2014 Google, Inc.
5  * Copyright (c) 2007 The Regents of The University of Michigan
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met: redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer;
12  * redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution;
15  * neither the name of the copyright holders nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef __ARCH_RISCV_REMOTE_GDB_HH__
33 #define __ARCH_RISCV_REMOTE_GDB_HH__
34 
35 #include <string>
36 
37 #include "arch/riscv/registers.hh"
38 #include "base/remote_gdb.hh"
39 
40 class System;
41 class ThreadContext;
42 
43 namespace RiscvISA
44 {
45 
46 class RemoteGDB : public BaseRemoteGDB
47 {
48  protected:
49  static const int NumGDBRegs = 4162;
50  static const int NumCSRs = 4096;
51 
52  bool acc(Addr addr, size_t len) override;
53  // A breakpoint will be 2 bytes if it is compressed and 4 if not
54  bool checkBpLen(size_t len) override { return len == 2 || len == 4; }
55 
57  {
59  private:
60  struct {
61  uint64_t gpr[NumIntArchRegs];
62  uint64_t pc;
63  } r;
64  public:
65  char *data() const { return (char *)&r; }
66  size_t size() const { return sizeof(r); }
67  void getRegs(ThreadContext*);
68  void setRegs(ThreadContext*) const;
69 
70  const std::string
71  name() const
72  {
73  return gdb->name() + ".RiscvGdbRegCache";
74  }
75  };
76 
78 
79  public:
80  RemoteGDB(System *_system, ThreadContext *tc, int _port);
81  BaseGdbRegCache *gdbRegs() override;
82 };
83 
84 } // namespace RiscvISA
85 
86 #endif /* __ARCH_RISCV_REMOTE_GDB_H__ */
RiscvISA::RemoteGDB::RiscvGdbRegCache
Definition: remote_gdb.hh:56
RiscvISA::RemoteGDB::NumCSRs
static const int NumCSRs
Definition: remote_gdb.hh:50
remote_gdb.hh
RiscvISA::RemoteGDB::RiscvGdbRegCache::getRegs
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
Definition: remote_gdb.cc:179
BaseGdbRegCache::gdb
BaseRemoteGDB * gdb
Definition: remote_gdb.hh:125
BaseGdbRegCache::BaseGdbRegCache
BaseGdbRegCache(BaseRemoteGDB *g)
Definition: remote_gdb.hh:119
RiscvISA::RemoteGDB::RiscvGdbRegCache::setRegs
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
Definition: remote_gdb.cc:188
RiscvISA::RemoteGDB::gdbRegs
BaseGdbRegCache * gdbRegs() override
Definition: remote_gdb.cc:197
RiscvISA::RemoteGDB::RiscvGdbRegCache::size
size_t size() const
Return the size of the raw buffer, in bytes (i.e., half of the number of digits in the g/G packet).
Definition: remote_gdb.hh:66
BaseRemoteGDB::tc
ThreadContext * tc
Definition: remote_gdb.hh:212
RiscvISA::RemoteGDB::RiscvGdbRegCache::pc
uint64_t pc
Definition: remote_gdb.hh:62
RiscvISA
Definition: fs_workload.cc:36
RiscvISA::RemoteGDB::checkBpLen
bool checkBpLen(size_t len) override
Definition: remote_gdb.hh:54
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
RiscvISA::RemoteGDB::RiscvGdbRegCache::r
struct RiscvISA::RemoteGDB::RiscvGdbRegCache::@17 r
System
Definition: system.hh:73
BaseRemoteGDB::_port
int _port
Definition: remote_gdb.hh:193
RiscvISA::RemoteGDB::RiscvGdbRegCache::data
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
Definition: remote_gdb.hh:65
RiscvISA::RemoteGDB::acc
bool acc(Addr addr, size_t len) override
Definition: remote_gdb.cc:154
RiscvISA::NumIntArchRegs
const int NumIntArchRegs
Definition: registers.hh:79
BaseRemoteGDB
Definition: remote_gdb.hh:43
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
BaseGdbRegCache
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
Definition: remote_gdb.hh:70
registers.hh
RiscvISA::RemoteGDB
Definition: remote_gdb.hh:46
RiscvISA::RemoteGDB::regCache
RiscvGdbRegCache regCache
Definition: remote_gdb.hh:77
RiscvISA::RemoteGDB::NumGDBRegs
static const int NumGDBRegs
Definition: remote_gdb.hh:49
RiscvISA::RemoteGDB::RiscvGdbRegCache::name
const std::string name() const
Return the name to use in places like DPRINTF.
Definition: remote_gdb.hh:71
RiscvISA::RemoteGDB::RiscvGdbRegCache::gpr
uint64_t gpr[NumIntArchRegs]
Definition: remote_gdb.hh:61
ArmISA::len
Bitfield< 18, 16 > len
Definition: miscregs_types.hh:439
addr
ip6_addr_t addr
Definition: inet.hh:423
BaseRemoteGDB::name
std::string name()
Definition: remote_gdb.cc:332
RiscvISA::RemoteGDB::RemoteGDB
RemoteGDB(System *_system, ThreadContext *tc, int _port)
Definition: remote_gdb.cc:148

Generated on Wed Sep 30 2020 14:02:01 for gem5 by doxygen 1.8.17