Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions src/sst/core/impl/interactive/simpleDebug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,44 @@ SimpleDebugger::tokenize(std::vector<std::string>& tokens, const std::string& in
return tokens;
}

void
SimpleDebugger::cmd_help(std::vector<std::string>& UNUSED(tokens))
{
std::string help = "SimpleDebug Console Commands\n";
help.append(" Navigation: Navigate the current object map\n");
help.append(" - pwd: print the current working directory in the object map\n");
help.append(" - cd: change directory level in the object map\n");
help.append(" - ls: list the objects in the current level of the object map\n");

help.append(" Current State: Print information about the current simulation state\n");
help.append(" - time: print current simulation time in cycles\n");
help.append(" - print [-rN][<obj>]: print objects in the current level of the object map;\n");
help.append(" if -rN is provided print recursive N levels (default N=4)\n");

help.append(" Modify State: Modify simulation variables\n");
help.append(" - set <obj> <value>: sets an object in the current scope to the provided value;\n");
help.append(" object must be a \"fundamental type\" e.g. int \n");

help.append(" Watch Points: Manage watch points which break into interactive console when triggered\n");
help.append(" - watch: prints the current list of watch points and their associated indices\n");
help.append(" watch <var>: adds var to the watch list; triggered when value changes\n");
help.append(" watch <var> <comp> <val>: add var to watch list; triggered when comparison with val is true\n");
help.append(" Valid <comp> operators: <, <=, >, >=, ==, !=\n");
help.append(" - unwatch <index>: removes the indexed watch point from the watch list;\n");
help.append(" <index> is the associated index from the list of watch points\n");

help.append(" Execute: Execute the simulation for a specified duration\n");
help.append(" - run [TIME]: runs the simulation from the current point for TIME and then returns to\n");
help.append(" interactive mode; if no time is given, the simulation runs to completion;\n");
help.append(" TIME is of the format <Number><unit> e.g. 4us\n");

help.append(" Exit: Exit the interactive console\n");
help.append(" - exit or quit: exits the interactive console and resumes simulation execution\n");
help.append(" - shutdown: exits the interactive console and does a clean shutdown of the simulation\n");

printf("%s", help.c_str());
}

void
SimpleDebugger::cmd_pwd(std::vector<std::string>& UNUSED(tokens))
{
Expand Down Expand Up @@ -378,6 +416,15 @@ SimpleDebugger::cmd_unwatch(std::vector<std::string>& tokens)
watch_points_.erase(watch_points_.begin() + index);
}

void
SimpleDebugger::cmd_shutdown(std::vector<std::string>& UNUSED(tokens))
{
simulationShutdown();
done = true;
printf("Exiting ObjectExplorer and shutting down simulation\n");
return;
}

void
SimpleDebugger::dispatch_cmd(std::string cmd)
{
Expand Down Expand Up @@ -415,6 +462,12 @@ SimpleDebugger::dispatch_cmd(std::string cmd)
else if ( tokens[0] == "unwatch" ) {
cmd_unwatch(tokens);
}
else if ( tokens[0] == "shutdown" ) {
cmd_shutdown(tokens);
}
else if ( tokens[0] == "help" ) {
cmd_help(tokens);
}
else {
printf("Unknown command: %s\n", tokens[0].c_str());
}
Expand Down
2 changes: 2 additions & 0 deletions src/sst/core/impl/interactive/simpleDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class SimpleDebugger : public SST::InteractiveConsole

std::vector<std::string> tokenize(std::vector<std::string>& tokens, const std::string& input);

void cmd_help(std::vector<std::string>& tokens);
void cmd_pwd(std::vector<std::string>& tokens);
void cmd_ls(std::vector<std::string>& tokens);
void cmd_cd(std::vector<std::string>& tokens);
Expand All @@ -75,6 +76,7 @@ class SimpleDebugger : public SST::InteractiveConsole
void cmd_run(std::vector<std::string>& tokens);
void cmd_watch(std::vector<std::string>& tokens);
void cmd_unwatch(std::vector<std::string>& tokens);
void cmd_shutdown(std::vector<std::string>& tokens);

void dispatch_cmd(std::string cmd);
};
Expand Down
7 changes: 7 additions & 0 deletions src/sst/core/interactiveConsole.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,11 @@ InteractiveConsole::getComponentObjectMap()
return Simulation_impl::getSimulation()->getComponentObjectMap();
}

void
InteractiveConsole::simulationShutdown()
{
Simulation_impl::getSimulation()->endSimulation();
}


} // namespace SST
2 changes: 2 additions & 0 deletions src/sst/core/interactiveConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class InteractiveConsole

SST::Core::Serialization::ObjectMap* getComponentObjectMap();

void simulationShutdown();

private:
InteractiveConsole(const InteractiveConsole&) = delete;
InteractiveConsole& operator=(const InteractiveConsole&) = delete;
Expand Down
Loading