[engine] debugged

This commit is contained in:
tangxifan 2023-01-01 10:22:47 -08:00
parent 8d947c7bdb
commit c90f8389f1
3 changed files with 7 additions and 7 deletions

View File

@ -157,7 +157,7 @@ class Shell {
/* Wrapper function, which calls other command thru shell's APIs */ /* Wrapper function, which calls other command thru shell's APIs */
void set_command_execute_function(const ShellCommandId& cmd_id, void set_command_execute_function(const ShellCommandId& cmd_id,
std::function<int(Shell<T>&, T&, const Command&, const CommandContext&)> exec_func); std::function<int(Shell<T>*, T&, const Command&, const CommandContext&)> exec_func);
void set_command_dependency( void set_command_dependency(
const ShellCommandId& cmd_id, const ShellCommandId& cmd_id,
@ -240,7 +240,7 @@ class Shell {
command_builtin_execute_functions_; command_builtin_execute_functions_;
vtr::vector<ShellCommandId, std::function<int(int, char**)>> vtr::vector<ShellCommandId, std::function<int(int, char**)>>
command_macro_execute_functions_; command_macro_execute_functions_;
vtr::vector<ShellCommandId, std::function<int(Shell<T>&, T&, const Command&, const CommandContext&)>> vtr::vector<ShellCommandId, std::function<int(Shell<T>*, T&, const Command&, const CommandContext&)>>
command_wrapper_execute_functions_; command_wrapper_execute_functions_;
/* Type of execute functions for each command. /* Type of execute functions for each command.

View File

@ -210,7 +210,7 @@ void Shell<T>::set_command_execute_function(const ShellCommandId& cmd_id,
template<class T> template<class T>
void Shell<T>::set_command_execute_function(const ShellCommandId& cmd_id, void Shell<T>::set_command_execute_function(const ShellCommandId& cmd_id,
std::function<int(Shell<T>&, T&, const Command&, const CommandContext&)> exec_func) { std::function<int(Shell<T>*, T&, const Command&, const CommandContext&)> exec_func) {
VTR_ASSERT(true == valid_command_id(cmd_id)); VTR_ASSERT(true == valid_command_id(cmd_id));
command_execute_function_types_[cmd_id] = WRAPPER; command_execute_function_types_[cmd_id] = WRAPPER;
command_wrapper_execute_functions_[cmd_id] = exec_func; command_wrapper_execute_functions_[cmd_id] = exec_func;
@ -551,7 +551,7 @@ int Shell<T>::execute_command(const char* cmd_line,
/* Execute the command depending on the type of function ! */ /* Execute the command depending on the type of function ! */
switch (command_execute_function_types_[cmd_id]) { switch (command_execute_function_types_[cmd_id]) {
case WRAPPER: case WRAPPER:
command_status_[cmd_id] = command_wrapper_execute_functions_[cmd_id](*this, common_context, commands_[cmd_id], command_contexts_[cmd_id]); command_status_[cmd_id] = command_wrapper_execute_functions_[cmd_id](this, common_context, commands_[cmd_id], command_contexts_[cmd_id]);
break; break;
case CONST_STANDARD: case CONST_STANDARD:
command_status_[cmd_id] = command_const_execute_functions_[cmd_id](common_context, commands_[cmd_id], command_contexts_[cmd_id]); command_status_[cmd_id] = command_const_execute_functions_[cmd_id](common_context, commands_[cmd_id], command_contexts_[cmd_id]);

View File

@ -12,7 +12,7 @@
/* begin namespace openfpga */ /* begin namespace openfpga */
namespace openfpga { namespace openfpga {
static int source_existing_command(Shell<OpenfpgaContext>& shell, OpenfpgaContext& openfpga_ctx, const Command& cmd, const CommandContext& cmd_context) { static int source_existing_command(openfpga::Shell<OpenfpgaContext>* shell, OpenfpgaContext& openfpga_ctx, const Command& cmd, const CommandContext& cmd_context) {
CommandOptionId opt_file = cmd.option("from_file"); CommandOptionId opt_file = cmd.option("from_file");
CommandOptionId opt_batch_mode = cmd.option("batch_mode"); CommandOptionId opt_batch_mode = cmd.option("batch_mode");
CommandOptionId opt_ss = cmd.option("command_stream"); CommandOptionId opt_ss = cmd.option("command_stream");
@ -24,7 +24,7 @@ static int source_existing_command(Shell<OpenfpgaContext>& shell, OpenfpgaContex
/* If a file is specified, run script mode of the shell, otherwise, */ /* If a file is specified, run script mode of the shell, otherwise, */
if (is_cmd_file) { if (is_cmd_file) {
shell.run_script_mode(cmd_ss.c_str(), openfpga_ctx, cmd_context.option_enable(cmd, opt_batch_mode)); shell->run_script_mode(cmd_ss.c_str(), openfpga_ctx, cmd_context.option_enable(cmd, opt_batch_mode));
} else { } else {
/* Split the string with ';' and run each command */ /* Split the string with ';' and run each command */
/* Remove the space at the end of the line /* Remove the space at the end of the line
@ -38,7 +38,7 @@ static int source_existing_command(Shell<OpenfpgaContext>& shell, OpenfpgaContex
std::string single_cmd_line = cmd_part_tokenizer.data(); std::string single_cmd_line = cmd_part_tokenizer.data();
if (!single_cmd_line.empty()) { if (!single_cmd_line.empty()) {
status = shell.execute_command(single_cmd_line.c_str(), openfpga_ctx); status = shell->execute_command(single_cmd_line.c_str(), openfpga_ctx);
/* Check the execution status of the command, /* Check the execution status of the command,
* if fatal error happened, we should abort immediately * if fatal error happened, we should abort immediately