case Common::Assignment::A_MODULEPAR:
case Common::Assignment::A_MODULEPAR_TEMP:
case Common::Assignment::A_TEMPLATE:
- is_constant = scope_name != NULL;
+ is_constant = true; //scope_name != NULL;
default:
break;
}
"AR = ar\n"
"ARFLAGS = \n\n"
"# Flags for the TTCN-3 and ASN.1 compiler:\n"
- "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n"
+ "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n"
"# Execution mode: (either ttcn3 or ttcn3-parallel)\n"
"TTCN3_LIB = ttcn3%s%s%s\n\n"
#ifdef LICENSE
if (param.get_type() == Module_Param::MP_Reference) {
mp = param.get_referenced_param();
}
- if (Ttcn_String_Parsing::happening()) {
- // accept all component values in case it's a string2ttcn operation
+ if (Ttcn_String_Parsing::happening() || Debugger_Value_Parsing::happening()) {
+ // accept all component values in case it's a string2ttcn operation or
+ // an overwrite operation through the debugger
switch (mp->get_type()) {
case Module_Param::MP_Integer:
component_value = (component)mp->get_integer()->get_val();
halt(NULL, false);
}
}
- halt_at_start = false;
+ halt_at_start = true;
}
void TTCN3_Debugger::test_execution_finished()
/** adds a new breakpoint at the specified module and line with the specified
* batch file (if not NULL), or changes the batch file of an existing
* breakpoint
- * handles the D_ADD_BREAKPOINT command */
+ * handles the D_SET_BREAKPOINT command */
void set_breakpoint(const char* p_module, int p_line, const char* batch_file);
/** removes the breakpoint from the specified module/line, if it exists
* can also be used to remove all breakpoints from the specified module or
* all breakpoints in all modules
- * handles the D_REMOVE_BREAKPOINT command */
+ * handles the D_REMOVE_BREAKPOINT command */
void remove_breakpoint(const char* p_module, const char* p_line);
/** switches an automatic breakpoint related to the specified event on or off
/** finds the variable with the specified name, and prints its value or an
* error message
+ * the variable's value is printed using its log() function
* handles (one parameter of) the D_PRINT_VARIABLE command */
void print_variable(const char* p_var_name);
+ /** finds the variable with the specified name, and overwrites its value or
+ * displays an error message
+ * the new value is received in a string array; this is concatenated into one
+ * string (with one space separating each string element); then it is passed
+ * to the module parameter parser, which creates a Module_Param object from it
+ * (if its syntax is correct)
+ * the variable's value is overwritten by passing the Module_Param object to
+ * its set_param() function
+ * handles the D_OVERWRITE_VARIABLE command */
void overwrite_variable(const char* p_var_name, int p_value_element_count,
char** p_value_elements);
#define PROMPT_TEXT "DEBUG> "
#define BATCH_TEXT "batch"
+#define HELP_TEXT "help"
// use a different file, than the MCTR CLI, since not all commands are the same
#define TTCN3_HISTORY_FILENAME ".ttcn3_history_single"
{ D_SET_BREAKPOINT_TEXT, D_SET_BREAKPOINT,
D_SET_BREAKPOINT_TEXT " <module> <line> [<batch_file>]",
"Add a breakpoint at the specified location, or change the batch file of "
- " an existing breakpoint." },
+ "an existing breakpoint." },
{ D_REMOVE_BREAKPOINT_TEXT, D_REMOVE_BREAKPOINT,
D_REMOVE_BREAKPOINT_TEXT " all|<module> [all|<line>]", "Remove a breakpoint, "
"or all breakpoints from a module, or all breakpoints from all modules." },
"Set whether a batch file should be executed automatically when test execution "
"is halted (breakpoint-specific batch files override this setting)." },
{ D_SET_COMPONENT_TEXT, D_SET_COMPONENT,
- D_SET_COMPONENT_TEXT " mtc|<component_reference>",
- "Set the test component to print debug information from." },
+ D_SET_COMPONENT_TEXT " mtc|<component_reference>", "Set the test component "
+ "to print debug information from (not available in single mode)." },
{ D_PRINT_CALL_STACK_TEXT, D_PRINT_CALL_STACK, D_PRINT_CALL_STACK_TEXT,
"Print call stack." },
{ D_SET_STACK_LEVEL_TEXT, D_SET_STACK_LEVEL, D_SET_STACK_LEVEL_TEXT " <level>",
execute_batch_file(p_line_read + start);
return;
}
+ if (!strncmp(p_line_read + start, HELP_TEXT, end - start)) {
+ start = end;
+ get_next_argument_loc(p_line_read, len, start, end); // just to skip to the argument
+ help(p_line_read + start);
+ return;
+ }
puts("Unknown command, try again...");
}
+void TTCN_Debugger_UI::help(const char* p_argument)
+{
+ if (*p_argument == 0) {
+ puts("Help is available for the following commands:");
+ printf(BATCH_TEXT);
+ for (const command_t *command = debug_command_list;
+ command->name != NULL; command++) {
+ printf(" %s", command->name);
+ }
+ putchar('\n');
+ }
+ else {
+ for (const command_t *command = debug_command_list;
+ command->name != NULL; command++) {
+ if (!strncmp(p_argument, command->name, strlen(command->name))) {
+ printf("%s usage: %s\n%s\n", command->name, command->synopsis,
+ command->description);
+ return;
+ }
+ }
+ if (!strcmp(p_argument, BATCH_TEXT)) {
+ puts(BATCH_TEXT " usage: " BATCH_TEXT "\nRun commands from batch file.");
+ }
+ else {
+ printf("No help for %s.\n", p_argument);
+ }
+ }
+}
+
void TTCN_Debugger_UI::init()
{
// initialize history library
* if it's not valid, an error message is displayed */
static void process_command(const char* p_line_read);
+ static void help(const char* p_argument);
+
public:
/** initializes the UI */
{ D_SET_BREAKPOINT_TEXT, D_SET_BREAKPOINT,
D_SET_BREAKPOINT_TEXT " <module> <line> [<batch_file>]",
"Add a breakpoint at the specified location, or change the batch file of "
- " an existing breakpoint." },
+ "an existing breakpoint." },
{ D_REMOVE_BREAKPOINT_TEXT, D_REMOVE_BREAKPOINT,
D_REMOVE_BREAKPOINT_TEXT " all|<module> [all|<line>]", "Remove a breakpoint, "
"or all breakpoints from a module, or all breakpoints from all modules." },
memset(line_read, ' ', command_name_len);
stripLWS(line_read);
MainController::debug_command(command->commandID, line_read);
+ if (waitState == WAIT_EXECUTE_LIST && command->commandID == D_EXIT &&
+ !strcmp(line_read, "all")) {
+ // stop executing the list from the config file
+ waitState = WAIT_NOTHING;
+ }
return;
}
}
puts("Help is available for the following commands:");
for (const Command *command = command_list;
command->name != NULL; command++) {
- printf(" %s", command->name);
+ printf("%s ", command->name);
}
for (const DebugCommand *command = debug_command_list;
command->name != NULL; command++) {
- printf(" %s", command->name);
+ printf("%s ", command->name);
}
putchar('\n');
} else {