OpenASIP  2.0
SimulatorInterpreter.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file SimulatorInterpreter.cc
26  *
27  * Implementation of SimulatorInterpreter class
28  *
29  * @author Pekka Jääskeläinen 2005-2010
30  * @note rating: red
31  */
32 
33 #include "SimulatorInterpreter.hh"
34 #include "TclInterpreter.hh"
35 
36 // commands of the simulator control language
37 #include "HelpCommand.hh"
38 #include "ProgCommand.hh"
39 #include "MachCommand.hh"
40 #include "ConfCommand.hh"
41 #include "QuitCommand.hh"
42 #include "RunCommand.hh"
43 #include "StepiCommand.hh"
44 #include "DisassembleCommand.hh"
45 #include "UntilCommand.hh"
46 #include "SettingCommand.hh"
47 #include "ResumeCommand.hh"
48 #include "InfoCommand.hh"
49 #include "BPCommand.hh"
50 #include "TBPCommand.hh"
51 #include "ConditionCommand.hh"
52 #include "IgnoreCommand.hh"
53 #include "DeleteBPCommand.hh"
54 #include "EnableBPCommand.hh"
55 #include "DisableBPCommand.hh"
56 #include "NextiCommand.hh"
57 #include "KillCommand.hh"
58 #include "MemDumpCommand.hh"
59 #include "WatchCommand.hh"
60 #include "CommandsCommand.hh"
61 #include "SymbolAddressCommand.hh"
62 #include "BackTraceCommand.hh"
63 #include "MemWriteCommand.hh"
64 
65 /**
66  * Constructor.
67  *
68  * Initializes the interpreter. argc and argv variables are set to be
69  * visible as interpreter variables.
70  *
71  * @param argc The number of command line arguments.
72  * @param argv The command line arguments.
73  * @param context The context data for the interpreter.
74  * @param reader LineReader used by the interpreter.
75  */
77  int argc,
78  char* argv[],
80  LineReader& reader) : TclInterpreter(), quitted_(false) {
81 
82  initialize(argc, argv, &context, &reader);
83 
88  addCustomCommand(new QuitCommand("quit"));
89  addCustomCommand(new QuitCommand("exit"));
97  context.simulatorFrontend().isCompiledSimulation()));
112 
114 
115  context.simulatorFrontend().setOutputStream(lineReader()->outputStream());
116 }
117 
118 /**
119  * Destructor.
120  *
121  * Finalizes the internal structures of the interpreter.
122  */
124  finalize();
125 }
126 
127 
128 /**
129  * Returns true in case interpreter has received the quit command.
130  *
131  * @param True if quite command has been given.
132  */
133 bool
135  return quitted_;
136 }
137 
138 /**
139  * Sets the quit command to be given.
140  */
141 void
143  quitted_ = true;
144 }
WatchCommand
Definition: WatchCommand.hh:47
ScriptInterpreter::finalize
virtual void finalize()
Definition: ScriptInterpreter.cc:329
SimulatorInterpreter::~SimulatorInterpreter
virtual ~SimulatorInterpreter()
Definition: SimulatorInterpreter.cc:123
DisableBPCommand
Definition: DisableBPCommand.hh:47
BackTraceCommand.hh
QuitCommand.hh
SimulatorInterpreterContext
Definition: SimulatorInterpreterContext.hh:45
MemDumpCommand
Definition: MemDumpCommand.hh:47
InfoCommand
Definition: InfoCommand.hh:48
TBPCommand
Definition: TBPCommand.hh:47
SimulatorInterpreter::quitted_
bool quitted_
Definition: SimulatorInterpreter.hh:62
SettingCommand
Definition: SettingCommand.hh:51
DisassembleCommand
Definition: DisassembleCommand.hh:48
MemDumpCommand.hh
HelpCommand.hh
MachCommand
Definition: MachCommand.hh:46
ConfCommand
Definition: ConfCommand.hh:46
TclInterpreter
Definition: TclInterpreter.hh:52
RunCommand
Definition: RunCommand.hh:47
SimulatorInterpreter::isQuitCommandGiven
bool isQuitCommandGiven() const
Definition: SimulatorInterpreter.cc:134
BPCommand.hh
QuitCommand
Definition: QuitCommand.hh:46
SimulatorInterpreter::setQuitCommandGiven
void setQuitCommandGiven()
Definition: SimulatorInterpreter.cc:142
RunCommand.hh
NextiCommand
Definition: NextiCommand.hh:47
ResumeCommand.hh
HelpCommand
Definition: HelpCommand.hh:45
EnableBPCommand.hh
IgnoreCommand
Definition: IgnoreCommand.hh:47
ConditionCommand
Definition: ConditionCommand.hh:47
MemWriteCommand.hh
DisableBPCommand.hh
SymbolAddressCommand.hh
SimulatorInterpreter::SimulatorInterpreter
SimulatorInterpreter(int argc, char *argv[], SimulatorInterpreterContext &context, LineReader &reader)
Definition: SimulatorInterpreter.cc:76
UntilCommand.hh
ProgCommand.hh
CommandsCommand.hh
BPCommand
Definition: BPCommand.hh:47
StepiCommand
Definition: StepiCommand.hh:47
TBPCommand.hh
ProgCommand
Definition: ProgCommand.hh:46
InfoCommand.hh
ResumeCommand
Definition: ResumeCommand.hh:47
IgnoreCommand.hh
KillCommand.hh
DeleteBPCommand
Definition: DeleteBPCommand.hh:47
SymbolAddressCommand
Definition: SymbolAddressCommand.hh:48
BackTraceCommand
Definition: BackTraceCommand.hh:47
ConfCommand.hh
TclInterpreter.hh
CommandsCommand
Definition: CommandsCommand.hh:47
ConditionCommand.hh
SettingCommand.hh
TclInterpreter::context
virtual InterpreterContext & context() const
Definition: TclInterpreter.cc:298
DisassembleCommand.hh
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
LineReader
Definition: LineReader.hh:52
NextiCommand.hh
WatchCommand.hh
DeleteBPCommand.hh
TclInterpreter::initialize
virtual void initialize(int argc, char *argv[], InterpreterContext *context, LineReader *reader)
Definition: TclInterpreter.cc:72
KillCommand
Definition: KillCommand.hh:46
SimulatorInterpreter.hh
MachCommand.hh
UntilCommand
Definition: UntilCommand.hh:47
EnableBPCommand
Definition: EnableBPCommand.hh:47
ScriptInterpreter::lineReader
virtual LineReader * lineReader() const
Definition: ScriptInterpreter.cc:367
StepiCommand.hh
ScriptInterpreter::addCustomCommand
virtual void addCustomCommand(CustomCommand *command)
Definition: ScriptInterpreter.cc:78
MemWriteCommand
Definition: MemWriteCommand.hh:48