@@ -57,6 +57,44 @@ SimpleDebugger::tokenize(std::vector<std::string>& tokens, const std::string& in
5757 return tokens;
5858}
5959
60+ void
61+ SimpleDebugger::cmd_help (std::vector<std::string>& UNUSED (tokens))
62+ {
63+ std::string help = " SimpleDebug Console Commands\n " ;
64+ help.append (" Navigation: Navigate the current object map\n " );
65+ help.append (" - pwd: print the current working directory in the object map\n " );
66+ help.append (" - cd: change directory level in the object map\n " );
67+ help.append (" - ls: list the objects in the current level of the object map\n " );
68+
69+ help.append (" Current State: Print information about the current simulation state\n " );
70+ help.append (" - time: print current simulation time in cycles\n " );
71+ help.append (" - print [-rN][<obj>]: print objects in the current level of the object map;\n " );
72+ help.append (" if -rN is provided print recursive N levels (default N=4)\n " );
73+
74+ help.append (" Modify State: Modify simulation variables\n " );
75+ help.append (" - set <obj> <value>: sets an object in the current scope to the provided value;\n " );
76+ help.append (" object must be a \" fundamental type\" e.g. int \n " );
77+
78+ help.append (" Watch Points: Manage watch points which break into interactive console when triggered\n " );
79+ help.append (" - watch: prints the current list of watch points and their associated indices\n " );
80+ help.append (" watch <var>: adds var to the watch list; triggered when value changes\n " );
81+ help.append (" watch <var> <comp> <val>: add var to watch list; triggered when comparison with val is true\n " );
82+ help.append (" Valid <comp> operators: <, <=, >, >=, ==, !=\n " );
83+ help.append (" - unwatch <index>: removes the indexed watch point from the watch list;\n " );
84+ help.append (" <index> is the associated index from the list of watch points\n " );
85+
86+ help.append (" Execute: Execute the simulation for a specified duration\n " );
87+ help.append (" - run [TIME]: runs the simulation from the current point for TIME and then returns to\n " );
88+ help.append (" interactive mode; if no time is given, the simulation runs to completion;\n " );
89+ help.append (" TIME is of the format <Number><unit> e.g. 4us\n " );
90+
91+ help.append (" Exit: Exit the interactive console\n " );
92+ help.append (" - exit or quit: exits the interactive console and resumes simulation execution\n " );
93+ help.append (" - shutdown: exits the interactive console and does a clean shutdown of the simulation\n " );
94+
95+ printf (" %s" , help.c_str ());
96+ }
97+
6098void
6199SimpleDebugger::cmd_pwd (std::vector<std::string>& UNUSED (tokens))
62100{
@@ -378,6 +416,15 @@ SimpleDebugger::cmd_unwatch(std::vector<std::string>& tokens)
378416 watch_points_.erase (watch_points_.begin () + index);
379417}
380418
419+ void
420+ SimpleDebugger::cmd_shutdown (std::vector<std::string>& UNUSED (tokens))
421+ {
422+ simulationShutdown ();
423+ done = true ;
424+ printf (" Exiting ObjectExplorer and shutting down simulation\n " );
425+ return ;
426+ }
427+
381428void
382429SimpleDebugger::dispatch_cmd (std::string cmd)
383430{
@@ -415,6 +462,12 @@ SimpleDebugger::dispatch_cmd(std::string cmd)
415462 else if ( tokens[0 ] == " unwatch" ) {
416463 cmd_unwatch (tokens);
417464 }
465+ else if ( tokens[0 ] == " shutdown" ) {
466+ cmd_shutdown (tokens);
467+ }
468+ else if ( tokens[0 ] == " help" ) {
469+ cmd_help (tokens);
470+ }
418471 else {
419472 printf (" Unknown command: %s\n " , tokens[0 ].c_str ());
420473 }
0 commit comments