50 SST_ELI_REGISTER_INTERACTIVE_CONSOLE(
53 "interactive.debugger",
54 SST_ELI_ELEMENT_VERSION(1, 0, 0),
55 "{EXPERIMENTAL} Interactive console debug probe")
57 SST_ELI_DOCUMENT_PARAMS(
58 {
"replayFile",
"script for playback upon entering interactive debug console",
""}
67 int execute(
const std::string& msg)
override;
71 void get_listing_strings(std::list<std::string>&);
79 std::deque<std::string> name_stack;
83 bool exit_console =
false;
86 void save_name_stack();
89 ExecutionType exec_type;
93 bool autoCompleteEnable =
true;
96 std::ofstream loggingFile;
97 std::ifstream replayFile;
98 std::string loggingFilePath =
"sst-console.out";
99 std::string replayFilePath =
"sst-console.in";
100 bool enLogging =
false;
103 std::stringstream injectedCommand;
107 std::stack<ExecState> eStack = {};
113 std::vector<std::pair<WatchPoint*, BaseComponent*>> watch_points_;
114 bool query_clear_watchlist();
115 bool clear_watchlist(std::vector<std::string>& tokens);
116 bool confirm_ =
true;
118 std::vector<std::string> tokenize(std::vector<std::string>& tokens,
const std::string& input);
121 bool cmd_help(std::string& cmd_str);
123 bool cmd_verbose_query();
124 bool cmd_verbose_serial(std::string& cmd_str);
125 bool cmd_verbose_thread(std::string& cmd_str);
126 bool cmd_verbose_rank_serial(std::string& cmd_str);
127 bool cmd_verbose_rank_parallel(std::string& cmd_str);
128 bool cmd_verbose_remote(std::vector<std::string>&(tokens));
130 bool cmd_info_serial(std::string& cmd_str);
131 bool cmd_info_thread(std::string& cmd_str);
132 bool cmd_info_rank_serial(std::string& cmd_str);
133 bool cmd_info_rank_parallel(std::string& cmd_str);
134 bool cmd_info_remote(std::vector<std::string>& tokens);
137 bool cmd_thread_serial(std::string& cmd_str);
138 bool cmd_thread_thread(std::string& cmd_str);
139 bool cmd_thread_rank_serial(std::string& cmd_str);
140 bool cmd_thread_rank_parallel(std::string& cmd_str);
141 bool cmd_thread_remote(std::vector<std::string>& tokens);
144 bool cmd_rank_serial(std::string& cmd_str);
145 bool cmd_rank_thread(std::string& cmd_str);
146 bool cmd_rank_rank_serial(std::string& cmd_str);
147 bool cmd_rank_rank_parallel(std::string& cmd_str);
148 bool cmd_rank_remote(std::vector<std::string>& tokens);
150 bool cmd_setConfirm(std::string& cmd_str);
152 bool cmd_pwd_serial(std::string& cmd_str);
153 bool cmd_pwd_thread(std::string& cmd_str);
154 bool cmd_pwd_rank_serial(std::string& cmd_str);
155 bool cmd_pwd_rank_parallel(std::string& cmd_str);
156 bool cmd_pwd_remote(std::vector<std::string>& tokens);
158 bool cmd_cd_serial(std::string& cmd_str);
159 bool cmd_cd_thread(std::string& cmd_str);
160 bool cmd_cd_rank_serial(std::string& cmd_str);
161 bool cmd_cd_rank_parallel(std::string& cmd_str);
162 bool cmd_cd_remote(std::vector<std::string>& tokens);
164 bool cmd_ls_serial(std::string& cmd_str);
165 bool cmd_ls_thread(std::string& cmd_str);
166 bool cmd_ls_rank_serial(std::string& cmd_str);
167 bool cmd_ls_rank_parallel(std::string& cmd_str);
168 bool cmd_ls_remote(std::vector<std::string>& tokens);
171 bool cmd_time(std::string& cmd_str);
173 bool cmd_print_serial(std::string& cmd_str);
174 bool cmd_print_thread(std::string& cmd_str);
175 bool cmd_print_rank_serial(std::string& cmd_str);
176 bool cmd_print_rank_parallel(std::string& cmd_str);
177 bool cmd_print_remote(std::vector<std::string>& tokens);
179 bool cmd_set_serial(std::string& cmd_str);
180 bool cmd_set_thread(std::string& cmd_str);
181 bool cmd_set_rank_serial(std::string& cmd_str);
182 bool cmd_set_rank_parallel(std::string& cmd_str);
183 bool cmd_set_remote(std::vector<std::string>& tokens);
185 bool cmd_watch_serial(std::string& cmd_str);
186 bool cmd_watch_thread(std::string& cmd_str);
187 bool cmd_watch_rank_serial(std::string& cmd_str);
188 bool cmd_watch_rank_parallel(std::string& cmd_str);
189 bool cmd_watch_remote(std::vector<std::string>& tokens);
191 bool cmd_trace_serial(std::string& cmd_str);
192 bool cmd_trace_thread(std::string& cmd_str);
193 bool cmd_trace_rank_serial(std::string& cmd_str);
194 bool cmd_trace_rank_parallel(std::string& cmd_str);
195 bool cmd_trace_remote(std::vector<std::string>& tokens);
197 bool cmd_watchlist_serial(std::string& cmd_str);
198 bool cmd_watchlist_thread(std::string& cmd_str);
199 bool cmd_watchlist_rank_serial(std::string& cmd_str);
200 bool cmd_watchlist_rank_parallel(std::string& cmd_str);
201 bool cmd_watchlist_remote(std::vector<std::string>& tokens);
203 bool cmd_addTraceVar_serial(std::string& cmd_str);
204 bool cmd_addTraceVar_thread(std::string& cmd_str);
205 bool cmd_addTraceVar_rank_serial(std::string& cmd_str);
206 bool cmd_addTraceVar_rank_parallel(std::string& cmd_str);
207 bool cmd_addTraceVar_remote(std::vector<std::string>& tokens);
209 bool cmd_printWatchpoint_serial(std::string& cmd_str);
210 bool cmd_printWatchpoint_thread(std::string& cmd_str);
211 bool cmd_printWatchpoint_rank_serial(std::string& cmd_str);
212 bool cmd_printWatchpoint_rank_parallel(std::string& cmd_str);
213 bool cmd_printWatchpoint_remote(std::vector<std::string>& tokens);
215 bool cmd_printTrace_serial(std::string& cmd_str);
216 bool cmd_printTrace_thread(std::string& cmd_str);
217 bool cmd_printTrace_rank_serial(std::string& cmd_str);
218 bool cmd_printTrace_rank_parallel(std::string& cmd_str);
219 bool cmd_printTrace_remote(std::vector<std::string>& tokens);
221 bool cmd_resetTraceBuffer_serial(std::string& cmd_str);
222 bool cmd_resetTraceBuffer_thread(std::string& cmd_str);
223 bool cmd_resetTraceBuffer_rank_serial(std::string& cmd_str);
224 bool cmd_resetTraceBuffer_rank_parallel(std::string& cmd_str);
225 bool cmd_resetTraceBuffer_remote(std::vector<std::string>& tokens);
227 bool cmd_setHandler_serial(std::string& cmd_str);
228 bool cmd_setHandler_thread(std::string& cmd_str);
229 bool cmd_setHandler_rank_serial(std::string& cmd_str);
230 bool cmd_setHandler_rank_parallel(std::string& cmd_str);
231 bool cmd_setHandler_remote(std::vector<std::string>& tokens);
233 bool cmd_unwatch_serial(std::string& cmd_str);
234 bool cmd_unwatch_thread(std::string& cmd_str);
235 bool cmd_unwatch_rank_serial(std::string& cmd_str);
236 bool cmd_unwatch_rank_parallel(std::string& cmd_str);
237 bool cmd_unwatch_remote(std::vector<std::string>& tokens);
240 bool cmd_run(std::string& cmd_str);
242 bool cmd_exit_serial(std::string& cmd_str);
243 bool cmd_exit_thread(std::string& cmd_str);
244 bool cmd_exit_rank_serial(std::string& cmd_str);
245 bool cmd_exit_rank_parallel(std::string& cmd_str);
247 bool cmd_shutdown(std::string& cmd_str);
250 bool cmd_logging(std::string& cmd_str);
251 bool cmd_replay(std::string& cmd_str);
252 bool cmd_history(std::string& cmd_str);
255 bool cmd_autoComplete(std::string& cmd_str);
258 bool cmd_clear(std::string& cmd_str);
261 bool cmd_define(std::string& cmd_str);
262 bool cmd_document(std::string& cmd_str);
265 bool dispatch_cmd(std::string& cmd);
275 LINE_ENTRY_MODE line_entry_mode = LINE_ENTRY_MODE::NORMAL;
278 uint32_t verbosity = 0;
279 void msg(VERBOSITY_MASK mask, std::string message);
285 static uint32_t current_thread;
286 static uint32_t current_rank;
287 static std::vector<std::string> tokens;
288 static std::stringstream result;
290 int consoleExecute(
const std::string& msg);
291 int executeThread(
const std::string& msg);
292 int executeRankSerial(
const std::string& msg);
293 int executeRankParallel(
const std::string& msg);
294 bool handleCommand();
295 bool handleCommandAll();
296 bool sendCommand(uint32_t rank_id, uint32_t thread_id,
const std::string& cmd);
297 bool sendCommandAll(
const std::string& cmd);
298 void receiveCommandRankSerial();
299 void receiveCommandRankParallel();