OpenASIP 2.2
Loading...
Searching...
No Matches
EnableBPCommand.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 EnableBPCommand.cc
26 *
27 * Implementation of EnableBPCommand class
28 *
29 * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include "EnableBPCommand.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 */
55
56/**
57 * Destructor.
58 *
59 * Does nothing.
60 */
63
64/**
65 * Executes the "enablebp" command.
66 *
67 * Enables 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 */
74bool
75EnableBPCommand::execute(const std::vector<DataObject>& arguments) {
76 if (!checkArgumentCount(arguments.size() - 1, 1, INT_MAX)) {
77 return false;
78 }
79
82 return false;
83 }
84 }
85
86 const std::string firstArgument =
88 arguments[1].stringValue()));
89
90 bool enableOnce = false;
91 bool temporary = false;
92 int firstHandleIndex = 1;
93 if (firstArgument == "once") {
94 enableOnce = true;
95 firstHandleIndex = 2;
96 } else if (firstArgument == "delete") {
97 temporary = true;
98 firstHandleIndex = 2;
99 }
100
101 StopPointManager& breakpointManager =
103
104 if (!verifyBreakpointHandles(arguments, firstHandleIndex)) {
105 return false;
106 }
107
108 // enable (and modify the properties of) the given breakpoints
109 for (size_t i = firstHandleIndex; i < arguments.size(); ++i) {
110 const unsigned int breakpointHandle = arguments[i].integerValue();
111 breakpointManager.enable(breakpointHandle);
112 if (enableOnce) {
113 breakpointManager.enableOnceAndDisable(breakpointHandle);
114 }
115 if (temporary) {
116 breakpointManager.enableOnceAndDelete(breakpointHandle);
117 }
118 printBreakpointInfo(breakpointHandle);
119 }
120 return true;
121}
122
123/**
124 * Returns the help text for this command.
125 *
126 * Help text is searched from SimulatorTextGenerator.
127 *
128 * @return The help text.
129 * @todo Use SimulatorTextGenerator to get the help text.
130 */
131std::string
SimValue * temporary
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
virtual ~EnableBPCommand()
virtual std::string helpText() const
virtual bool execute(const std::vector< DataObject > &arguments)
bool verifyBreakpointHandles(const std::vector< DataObject > &arguments, std::size_t startIndex=1)
virtual bool printBreakpointInfo(unsigned int breakpointHandle)
StopPointManager & stopPointManager()
static SimulatorTextGenerator & textGenerator()
void enableOnceAndDisable(unsigned int handle)
void enable(unsigned int handle)
void enableOnceAndDelete(unsigned int handle)
static std::string stringToLower(const std::string &source)
static std::string trim(const std::string &source)
virtual boost::format text(int textId)
@ TXT_INTERP_HELP_ENABLEBP
Help text for command "enablebp" of the CLI.