51 SST_ELI_REGISTER_INTERACTIVE_CONSOLE(
54 "interactive.debugger",
55 SST_ELI_ELEMENT_VERSION(1, 0, 0),
56 "{EXPERIMENTAL} Interactive console debug probe")
58 SST_ELI_DOCUMENT_PARAMS(
59 {
"replayFile",
"script for playback upon entering interactive debug console",
""}
68 int execute(
const std::string& msg)
override;
72 void get_listing_strings(std::list<std::string>&);
80 std::deque<std::string> name_stack;
87 bool exit_console =
false;
90 void save_name_stack();
93 ExecutionType exec_type;
97 bool autoCompleteEnable =
true;
100 std::ofstream loggingFile;
101 std::ifstream replayFile;
102 std::string loggingFilePath =
"sst-console.out";
103 std::string replayFilePath =
"sst-console.in";
104 bool enLogging =
false;
107 std::stringstream injectedCommand;
111 std::stack<ExecState> eStack = {};
114 std::vector<std::pair<WatchPoint*, BaseComponent*>> watch_points_;
115 bool query_clear_watchlist();
116 bool clear_watchlist(std::vector<std::string>& tokens);
117 bool confirm_ =
true;
119 std::vector<std::string> tokenize(std::vector<std::string>& tokens,
const std::string& input);
122 bool cmd_help(std::string& cmd_str);
123 bool cmd_show(std::string& cmd_str);
125 bool cmd_verbose_query();
126 bool cmd_verbose_serial(std::string& cmd_str);
127 bool cmd_verbose_thread(std::string& cmd_str);
128 bool cmd_verbose_rank_serial(std::string& cmd_str);
129 bool cmd_verbose_rank_parallel(std::string& cmd_str);
130 bool cmd_verbose_remote(std::vector<std::string>&(tokens));
132 bool cmd_info_serial(std::string& cmd_str);
133 bool cmd_info_thread(std::string& cmd_str);
134 bool cmd_info_rank_serial(std::string& cmd_str);
135 bool cmd_info_rank_parallel(std::string& cmd_str);
136 bool cmd_info_remote(std::vector<std::string>& tokens);
139 bool cmd_thread_serial(std::string& cmd_str);
140 bool cmd_thread_thread(std::string& cmd_str);
141 bool cmd_thread_rank_serial(std::string& cmd_str);
142 bool cmd_thread_rank_parallel(std::string& cmd_str);
143 bool cmd_thread_remote(std::vector<std::string>& tokens);
146 bool cmd_rank_serial(std::string& cmd_str);
147 bool cmd_rank_thread(std::string& cmd_str);
148 bool cmd_rank_rank_serial(std::string& cmd_str);
149 bool cmd_rank_rank_parallel(std::string& cmd_str);
150 bool cmd_rank_remote(std::vector<std::string>& tokens);
152 bool cmd_setConfirm(std::string& cmd_str);
154 bool cmd_pwd_serial(std::string& cmd_str);
155 bool cmd_pwd_thread(std::string& cmd_str);
156 bool cmd_pwd_rank_serial(std::string& cmd_str);
157 bool cmd_pwd_rank_parallel(std::string& cmd_str);
158 bool cmd_pwd_remote(std::vector<std::string>& tokens);
160 bool cmd_cd_serial(std::string& cmd_str);
161 bool cmd_cd_thread(std::string& cmd_str);
162 bool cmd_cd_rank_serial(std::string& cmd_str);
163 bool cmd_cd_rank_parallel(std::string& cmd_str);
164 bool cmd_cd_remote(std::vector<std::string>& tokens);
166 bool cmd_ls_serial(std::string& cmd_str);
167 bool cmd_ls_thread(std::string& cmd_str);
168 bool cmd_ls_rank_serial(std::string& cmd_str);
169 bool cmd_ls_rank_parallel(std::string& cmd_str);
170 bool cmd_ls_remote(std::vector<std::string>& tokens);
173 bool cmd_time(std::string& cmd_str);
175 bool cmd_print_serial(std::string& cmd_str);
176 bool cmd_print_thread(std::string& cmd_str);
177 bool cmd_print_rank_serial(std::string& cmd_str);
178 bool cmd_print_rank_parallel(std::string& cmd_str);
179 bool cmd_print_remote(std::vector<std::string>& tokens);
181 bool cmd_set_serial(std::string& cmd_str);
182 bool cmd_set_thread(std::string& cmd_str);
183 bool cmd_set_rank_serial(std::string& cmd_str);
184 bool cmd_set_rank_parallel(std::string& cmd_str);
185 bool cmd_set_remote(std::vector<std::string>& tokens);
187 bool cmd_watch_serial(std::string& cmd_str);
188 bool cmd_watch_thread(std::string& cmd_str);
189 bool cmd_watch_rank_serial(std::string& cmd_str);
190 bool cmd_watch_rank_parallel(std::string& cmd_str);
191 bool cmd_watch_remote(std::vector<std::string>& tokens);
193 bool cmd_trace_serial(std::string& cmd_str);
194 bool cmd_trace_thread(std::string& cmd_str);
195 bool cmd_trace_rank_serial(std::string& cmd_str);
196 bool cmd_trace_rank_parallel(std::string& cmd_str);
197 bool cmd_trace_remote(std::vector<std::string>& tokens);
199 bool cmd_watchlist_serial(std::string& cmd_str);
200 bool cmd_watchlist_thread(std::string& cmd_str);
201 bool cmd_watchlist_rank_serial(std::string& cmd_str);
202 bool cmd_watchlist_rank_parallel(std::string& cmd_str);
203 bool cmd_watchlist_remote(std::vector<std::string>& tokens);
205 bool cmd_addTraceVar_serial(std::string& cmd_str);
206 bool cmd_addTraceVar_thread(std::string& cmd_str);
207 bool cmd_addTraceVar_rank_serial(std::string& cmd_str);
208 bool cmd_addTraceVar_rank_parallel(std::string& cmd_str);
209 bool cmd_addTraceVar_remote(std::vector<std::string>& tokens);
211 bool cmd_printWatchpoint_serial(std::string& cmd_str);
212 bool cmd_printWatchpoint_thread(std::string& cmd_str);
213 bool cmd_printWatchpoint_rank_serial(std::string& cmd_str);
214 bool cmd_printWatchpoint_rank_parallel(std::string& cmd_str);
215 bool cmd_printWatchpoint_remote(std::vector<std::string>& tokens);
217 bool cmd_printTrace_serial(std::string& cmd_str);
218 bool cmd_printTrace_thread(std::string& cmd_str);
219 bool cmd_printTrace_rank_serial(std::string& cmd_str);
220 bool cmd_printTrace_rank_parallel(std::string& cmd_str);
221 bool cmd_printTrace_remote(std::vector<std::string>& tokens);
223 bool cmd_resetTraceBuffer_serial(std::string& cmd_str);
224 bool cmd_resetTraceBuffer_thread(std::string& cmd_str);
225 bool cmd_resetTraceBuffer_rank_serial(std::string& cmd_str);
226 bool cmd_resetTraceBuffer_rank_parallel(std::string& cmd_str);
227 bool cmd_resetTraceBuffer_remote(std::vector<std::string>& tokens);
229 bool cmd_setHandler_serial(std::string& cmd_str);
230 bool cmd_setHandler_thread(std::string& cmd_str);
231 bool cmd_setHandler_rank_serial(std::string& cmd_str);
232 bool cmd_setHandler_rank_parallel(std::string& cmd_str);
233 bool cmd_setHandler_remote(std::vector<std::string>& tokens);
235 bool cmd_unwatch_serial(std::string& cmd_str);
236 bool cmd_unwatch_thread(std::string& cmd_str);
237 bool cmd_unwatch_rank_serial(std::string& cmd_str);
238 bool cmd_unwatch_rank_parallel(std::string& cmd_str);
239 bool cmd_unwatch_remote(std::vector<std::string>& tokens);
242 bool cmd_run(std::string& cmd_str);
244 bool cmd_exit_serial(std::string& cmd_str);
245 bool cmd_exit_thread(std::string& cmd_str);
246 bool cmd_exit_rank_serial(std::string& cmd_str);
247 bool cmd_exit_rank_parallel(std::string& cmd_str);
249 bool cmd_shutdown(std::string& cmd_str);
252 bool cmd_logging(std::string& cmd_str);
253 bool cmd_replay(std::string& cmd_str);
254 bool cmd_history(std::string& cmd_str);
257 bool cmd_autoComplete(std::string& cmd_str);
260 bool cmd_clear(std::string& cmd_str);
263 bool cmd_define(std::string& cmd_str);
264 bool cmd_document(std::string& cmd_str);
267 bool dispatch_cmd(std::string& cmd);
277 LINE_ENTRY_MODE line_entry_mode = LINE_ENTRY_MODE::NORMAL;
280 uint32_t verbosity = 0;
281 void msg(VERBOSITY_MASK mask, std::string message);
284 bool containsArg(
const std::string tok,
const char arg);
285 size_t containsArg(
const std::vector<std::string> tokens,
const std::string& arg);
286 std::vector<size_t> parseBracketIndices(std::string& token);
287 bool checkValue(Core::Serialization::ObjTreeCont::NodeKind expectedType,
const std::string& valToCheck);
295 static uint32_t current_thread;
296 static uint32_t current_rank;
297 static std::vector<std::string> tokens;
298 static std::stringstream result;
300 int consoleExecute(
const std::string& msg);
301 int executeThread(
const std::string& msg);
302 int executeRankSerial(
const std::string& msg);
303 int executeRankParallel(
const std::string& msg);
304 bool handleCommand();
305 bool handleCommandAll();
306 bool sendCommand(uint32_t rank_id, uint32_t thread_id,
const std::string& cmd);
307 bool sendCommandAll(
const std::string& cmd);
308 void receiveCommandRankSerial();
309 void receiveCommandRankParallel();