gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
debug.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "sim/debug.hh"
30
31#include <string>
32#include <vector>
33
34#include "base/debug.hh"
35#include "sim/eventq.hh"
36#include "sim/global_event.hh"
37#include "sim/sim_events.hh"
38#include "sim/sim_exit.hh"
39
40namespace gem5
41{
42
43//
44// Debug event: place a breakpoint on the process function and
45// schedule the event to break at a particular cycle
46//
48{
50 void process(); // process event
51 virtual const char *description() const;
52};
53
54//
55// constructor: schedule at specified time
56//
61
62//
63// handle debug event: set debugger breakpoint on this function
64//
65void
70
71
72const char *
74{
75 return "debug breakpoint";
76}
77
78//
79// handy function to schedule DebugBreakEvent on main event queue
80// (callable from debugger)
81//
82void
84{
85 new DebugBreakEvent(when);
86 warn("need to stop all queues");
87}
88
89void
91{
92 schedBreak(curTick() + delta);
93}
94
98void
100{
101 if (!when)
102 when = curTick() + 1;
103 exitSimLoop("checkpoint", 0, when, 0);
104}
105
106void
108{
109 for (uint32_t i = 0; i < numMainEventQueues; ++i) {
110 mainEventQueue[i]->dump();
111 }
112}
113
114} // namespace gem5
static const FlagsType AutoDelete
Definition eventq.hh:110
GlobalEvent(Priority p, Flags f)
Global events and related declarations.
static const Priority Debug_Break_Pri
Breakpoints should happen before anything else (except enabling trace output), so we don't miss any a...
Definition eventq.hh:156
#define warn(...)
Definition logging.hh:288
Bitfield< 7 > i
Definition misc_types.hh:67
void breakpoint()
Definition debug.cc:64
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
The "old style" exitSimLoop functions.
uint64_t Tick
Tick count type.
Definition types.hh:58
uint32_t numMainEventQueues
Current number of allocated main event queues.
Definition eventq.cc:56
void schedBreak(Tick when)
Cause the simulator to execute a breakpoint.
Definition debug.cc:83
void eventqDump()
Dump all the events currently on the event queue.
Definition debug.cc:107
void takeCheckpoint(Tick when)
Function to cause the simulator to take a checkpoint from the debugger.
Definition debug.cc:99
void schedRelBreak(Tick delta)
Cause the simulator to execute a breakpoint relative to the current tick.
Definition debug.cc:90
std::vector< EventQueue * > mainEventQueue
Array for main event queues.
Definition eventq.cc:57
DebugBreakEvent(Tick when)
Definition debug.cc:57
virtual const char * description() const
Definition debug.cc:73

Generated on Mon Oct 27 2025 04:13:04 for gem5 by doxygen 1.14.0