OpenASIP  2.0
DisableBPCommand.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 DisableBPCommand.cc
26  *
27  * Implementation of DisableBPCommand class
28  *
29  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include "DisableBPCommand.hh"
34 #include "Application.hh"
35 #include "FileSystem.hh"
36 #include "SimulatorFrontend.hh"
38 #include "Exception.hh"
39 #include "SimulatorToolbox.hh"
41 #include "SimValue.hh"
42 #include "StopPointManager.hh"
43 #include "StringTools.hh"
44 
45 #include <iostream>
46 
47 /**
48  * Constructor.
49  *
50  * Sets the name of the command to the base class.
51  */
53  SimControlLanguageCommand("disablebp") {
54 }
55 
56 /**
57  * Destructor.
58  *
59  * Does nothing.
60  */
62 }
63 
64 /**
65  * Executes the "disablebp" command.
66  *
67  * Disables the given breakpoints.
68  *
69  * @param arguments The handle(s) of the breakpoint(s) to enable.
70  * @return True in case simulation is initialized and arguments are ok.
71  * @exception NumberFormatException Is never thrown by this command.
72  * @todo Use the count for the step.
73  */
74 bool
75 DisableBPCommand::execute(const std::vector<DataObject>& arguments) {
76  if (!checkArgumentCount(arguments.size() - 1, 1, INT_MAX)) {
77  return false;
78  }
79 
80  if (!checkSimulationStopped()) {
82  return false;
83  }
84  }
85 
86  StopPointManager& breakpointManager =
88 
89  if (!verifyBreakpointHandles(arguments)) {
90  return false;
91  }
92 
93  // disable the given breakpoints
94  for (size_t i = 1; i < arguments.size(); ++i) {
95  const unsigned int breakpointHandle = arguments[i].integerValue();
96  breakpointManager.disable(breakpointHandle);
97  printBreakpointInfo(breakpointHandle);
98  }
99  return true;
100 }
101 
102 /**
103  * Returns the help text for this command.
104  *
105  * Help text is searched from SimulatorTextGenerator.
106  *
107  * @return The help text.
108  * @todo Use SimulatorTextGenerator to get the help text.
109  */
110 std::string
114 }
StopPointManager.hh
CustomCommand::checkArgumentCount
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
Definition: CustomCommand.cc:82
FileSystem.hh
SimControlLanguageCommand::checkSimulationStopped
bool checkSimulationStopped()
Definition: SimControlLanguageCommand.cc:135
SimulatorInterpreterContext.hh
Texts::TXT_INTERP_HELP_DISABLEBP
@ TXT_INTERP_HELP_DISABLEBP
Help text for command "disablebp" of the CLI.
Definition: SimulatorTextGenerator.hh:99
Exception.hh
DisableBPCommand::DisableBPCommand
DisableBPCommand()
Definition: DisableBPCommand.cc:52
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimControlLanguageCommand::verifyBreakpointHandles
bool verifyBreakpointHandles(const std::vector< DataObject > &arguments, std::size_t startIndex=1)
Definition: SimControlLanguageCommand.cc:712
StringTools.hh
DisableBPCommand.hh
SimulatorToolbox.hh
DisableBPCommand::~DisableBPCommand
virtual ~DisableBPCommand()
Definition: DisableBPCommand.cc:61
StopPointManager
Definition: StopPointManager.hh:50
Application.hh
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
SimulatorTextGenerator.hh
SimControlLanguageCommand::checkSimulationInitialized
bool checkSimulationInitialized()
Definition: SimControlLanguageCommand.cc:88
SimulatorFrontend.hh
StopPointManager::disable
void disable(unsigned int handle)
Definition: StopPointManager.cc:200
SimValue.hh
SimControlLanguageCommand
Definition: SimControlLanguageCommand.hh:63
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
DisableBPCommand::execute
virtual bool execute(const std::vector< DataObject > &arguments)
Definition: DisableBPCommand.cc:75
SimulatorFrontend::stopPointManager
StopPointManager & stopPointManager()
Definition: SimulatorFrontend.cc:2108
SimControlLanguageCommand::printBreakpointInfo
virtual bool printBreakpointInfo(unsigned int breakpointHandle)
Definition: SimControlLanguageCommand.cc:678
DisableBPCommand::helpText
virtual std::string helpText() const
Definition: DisableBPCommand.cc:111