gem5 v24.0.0.0
Loading...
Searching...
No Matches
remote_gdb.cc
Go to the documentation of this file.
1/* * Copyright 2022 Google, Inc.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met: redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer;
7 * redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution;
10 * neither the name of the copyright holders nor the names of its
11 * contributors may be used to endorse or promote products derived from
12 * this software without specific prior written permission.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
28
30#include "arch/arm/utility.hh"
31#include "base/trace.hh"
32#include "debug/GDBAcc.hh"
33
34namespace gem5 {
35
36using namespace ArmISA;
37
38namespace fastmodel {
39
40void
42{
43 DPRINTF(GDBAcc, "setRegs in remotegdb \n");
44
45 for (int i = 0; i < 31; ++i)
47 auto pc_state = context->pcState().as<PCState>();
48 pc_state.set(r.pc);
49 context->pcState(pc_state);
51 // Update the stack pointer. This should be done after
52 // updating CPSR/PSTATE since that might affect how SPX gets
53 // mapped.
55
56 // Remove the vector registers update in FastmodelRemoteGDB since it's not
57 // implemented in iris::ThreadContext.
58 warn("Skip update vector registers in remotegdb\n");
59
62}
63
65 ListenSocketConfig _listen_config)
66 : gem5::ArmISA::RemoteGDB(_system, _listen_config), regCache64(this)
67{
68}
69
70bool
72{
73 auto tc = dynamic_cast<Iris::ThreadContext *>(context());
74 panic_if(!tc,
75 "FastmodelRemoteGdb can only work on Iris::ThreadContext");
76 tc->readMemWithCurrentMsn(vaddr, size, data);
77 return true;
78}
79
80bool
81FastmodelRemoteGDB::writeBlob(Addr vaddr, size_t size, const char *data)
82{
83 auto tc = dynamic_cast<Iris::ThreadContext *>(context());
84 panic_if(!tc,
85 "FastmodelRemoteGdb can only work on Iris::ThreadContext");
86 tc->writeMemWithCurrentMsn(vaddr, size, data);
87 return true;
88}
89
92{
93 if (inAArch64(context()))
94 return &regCache64;
95 else
96 return &regCache32;
97}
98
99} // namespace fastmodel
100} // namespace gem5
#define DPRINTF(x,...)
Definition trace.hh:210
const char data[]
struct gem5::ArmISA::RemoteGDB::AArch64GdbRegCache::GEM5_PACKED r
AArch32GdbRegCache regCache32
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
Definition remote_gdb.hh:86
ThreadContext * tc
ThreadContext * context()
void set(Addr val) override
Force this PC to reflect a particular value, resetting all its other fields around it.
Definition pcstate.hh:378
Target & as()
Definition pcstate.hh:73
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual void setReg(const RegId &reg, RegVal val)
virtual const PCStateBase & pcState() const =0
void setRegs(ThreadContext *) const override
Set the ThreadContext's registers from the values in the raw buffer.
Definition remote_gdb.cc:41
bool readBlob(Addr vaddr, size_t size, char *data) override
Definition remote_gdb.cc:71
BaseGdbRegCache * gdbRegs() override
Definition remote_gdb.cc:91
bool writeBlob(Addr vaddr, size_t size, const char *data) override
Definition remote_gdb.cc:81
FastmodelRemoteGDB(System *_system, ListenSocketConfig _listen_config)
Definition remote_gdb.cc:64
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition logging.hh:214
#define warn(...)
Definition logging.hh:256
static RegId x(unsigned index)
Definition int.hh:445
constexpr RegId Spx
Definition int.hh:238
Bitfield< 7 > i
Definition misc_types.hh:67
@ MISCREG_FPSR
Definition misc.hh:636
@ MISCREG_CPSR
Definition misc.hh:67
@ MISCREG_FPCR
Definition misc.hh:635
bool inAArch64(ThreadContext *tc)
Definition utility.cc:126
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Tue Jun 18 2024 16:23:59 for gem5 by doxygen 1.11.0