# Set it to 'yes' to generate coverage data (requires DEBUG=yes)
COVERAGE := no
+# Set it to 'yes' to enable extra features for the debugger UI in single mode
+# (this requires an extra library when linking the generated code).
+# Set it to 'no' to use a simplified debugger UI.
+ADVANCED_DEBUGGER_UI := yes
+
# Your platform. Allowed values: SOLARIS, SOLARIS8, LINUX, FREEBSD,
# WIN32. Decided automagically if not defined (recommended).
# PLATFORM :=
LDFLAGS += -fprofile-arcs -ftest-coverage -lgcov
endif
+ifeq ($(ADVANCED_DEBUGGER_UI), yes)
+ CPPFLAGS += -DADVANCED_DEBUGGER_UI
+endif
+
# Directory which contains the code for POSIX regular expression handling.
# It is needed on platforms where the system's libc does not support POSIX
# regexps. This is the case for Mingw.
"# Platform specific additional libraries:\n"
"#\n", fp);
- fputs("SOLARIS_LIBS = -lsocket -lnsl -lxml2 -lcurses", fp);
+ fputs("SOLARIS_LIBS = -lsocket -lnsl -lxml2", fp);
#ifdef USAGE_STATS
fputs(" -lresolv", fp);
+#endif
+#ifdef ADVANCED_DEBUGGER_UI
+ fputs(" -lcurses", fp);
#endif
if (makefile->solspeclibraries) {
struct string_list* act_elem = makefile->solspeclibraries;
}
fputs("\n", fp);
- fputs("SOLARIS8_LIBS = -lsocket -lnsl -lxml2 -lcurses", fp);
+ fputs("SOLARIS8_LIBS = -lsocket -lnsl -lxml2", fp);
#ifdef USAGE_STATS
fputs(" -lresolv", fp);
+#endif
+#ifdef ADVANCED_DEBUGGER_UI
+ fputs(" -lcurses", fp);
#endif
if (makefile->sol8speclibraries) {
struct string_list* act_elem = makefile->sol8speclibraries;
}
fputs("\n", fp);
- fputs("LINUX_LIBS = -lxml2 -lncurses", fp);
+ fputs("LINUX_LIBS = -lxml2", fp);
#ifdef USAGE_STATS
fputs(" -lpthread -lrt", fp);
+#endif
+#ifdef ADVANCED_DEBUGGER_UI
+ fputs(" -lncurses", fp);
#endif
if (makefile->linuxspeclibraries) {
struct string_list* act_elem = makefile->linuxspeclibraries;
}
fputs("\n", fp);
- fputs("FREEBSD_LIBS = -lxml2 -lncurses", fp);
+ fputs("FREEBSD_LIBS = -lxml2", fp);
+#ifdef ADVANCED_DEBUGGER_UI
+ fputs(" -lncurses", fp);
+#endif
if (makefile->freebsdspeclibraries) {
struct string_list* act_elem = makefile->freebsdspeclibraries;
while (act_elem) {
}
fputs("\n", fp);
- fputs("WIN32_LIBS = -lxml2 -lncurses", fp);
+ fputs("WIN32_LIBS = -lxml2", fp);
+#ifdef ADVANCED_DEBUGGER_UI
+ fputs(" -lncurses", fp);
+#endif
if (makefile->win32speclibraries) {
struct string_list* act_elem = makefile->win32speclibraries;
while (act_elem) {
#include "DebuggerUI.hh"
#include "DebugCommands.hh"
#include "Debugger.hh"
-#include "../mctr2/editline/libedit/src/editline/readline.h"
#include <stdio.h>
#include <ctype.h>
+#ifdef ADVANCED_DEBUGGER_UI
+#include "../mctr2/editline/libedit/src/editline/readline.h"
+// use a different file, than the MCTR CLI, since not all commands are the same
+#define TTCN3_HISTORY_FILENAME ".ttcn3_history_single"
+#endif
+
#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"
-
const TTCN_Debugger_UI::command_t TTCN_Debugger_UI::debug_command_list[] = {
{ D_SWITCH_TEXT, D_SWITCH, D_SWITCH_TEXT " on|off",
"Switch the debugger on or off." },
{ NULL, D_ERROR, NULL, NULL }
};
+#ifdef ADVANCED_DEBUGGER_UI
char* TTCN_Debugger_UI::ttcn3_history_filename = NULL;
+#endif
/** local function for extracting the command name and its arguments from an
* input line
// empty command
return;
}
+#ifdef ADVANCED_DEBUGGER_UI
add_history(p_line_read + start);
+#endif
for (const command_t *command = debug_command_list; command->name != NULL;
++command) {
if (!strncmp(p_line_read + start, command->name, end - start)) {
void TTCN_Debugger_UI::init()
{
+#ifdef ADVANCED_DEBUGGER_UI
// initialize history library
using_history();
// calculate history file name
read_history(ttcn3_history_filename);
// set our own command completion function
rl_completion_entry_function = (Function*)complete_command;
+#endif
}
void TTCN_Debugger_UI::clean_up()
{
+#ifdef ADVANCED_DEBUGGER_UI
if (write_history(ttcn3_history_filename)) {
puts("Could not save debugger command history.");
}
Free(ttcn3_history_filename);
+#endif
}
void TTCN_Debugger_UI::read_loop()
{
while (ttcn3_debugger.is_halted()) {
+#ifdef ADVANCED_DEBUGGER_UI
// print the prompt and read a line using the readline(), which
// automatically handles command completion and command history
char* line = readline(PROMPT_TEXT);
if (line != NULL) {
+#else
+ // simplified debugger UI: use a simple fgets
+ printf(PROMPT_TEXT);
+ char line[1024];
+ char* res = fgets(line, sizeof(line), stdin);
+ if (res != NULL) {
+#endif
process_command(line);
+#ifdef ADVANCED_DEBUGGER_UI
free(line);
+#endif
}
else {
// EOF was received -> exit all
puts(p_str);
}
+#ifdef ADVANCED_DEBUGGER_UI
char* TTCN_Debugger_UI::complete_command(const char* p_prefix, int p_state)
{
static int command_index;
}
// no match found
return NULL;
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
/** list of commands */
static const command_t debug_command_list[];
-
+
+#ifdef ADVANCED_DEBUGGER_UI
/** name of the file, where the command history is stored */
static char* ttcn3_history_filename;
+#endif
/** processes the command in the specified input line
* if it's a valid command, then it is added to the command history and
* if it's not valid, an error message is displayed */
static void process_command(const char* p_line_read);
+ /** displays help for the specified command, or lists available commands */
static void help(const char* p_argument);
public:
/** prints the specified text to the standard output */
static void print(const char* p_str);
+#ifdef ADVANCED_DEBUGGER_UI
/** command completion function for editline */
static char* complete_command(const char* p_prefix, int p_state);
+#endif
};
#endif /* DEBUGGER_UI_HH */
# -I. is needed because TitanLoggerApi.hh (generated) does #include <TTCN3.hh>
CPPFLAGS += -I. -I$(APIDIR)
-SOLARIS_LIBS := -lsocket -lnsl -lxml2 -lcurses
-SOLARIS8_LIBS := -lsocket -lnsl -lxml2 -lcurses
-LINUX_LIBS := -lxml2 -lncurses
-FREEBSD_LIBS := -lxml2 -lncurses
-WIN32_LIBS := -lxml2 -lncurses
-INTERIX_LIBS := -lxml2 -lncurses
+SOLARIS_LIBS := -lsocket -lnsl -lxml2
+SOLARIS8_LIBS := -lsocket -lnsl -lxml2
+LINUX_LIBS := -lxml2
+FREEBSD_LIBS := -lxml2
+WIN32_LIBS := -lxml2
+INTERIX_LIBS := -lxml2
+
+ifeq ($(ADVANCED_DEBUGGER_UI), yes)
+ SOLARIS_LIBS += -lcurses
+ SOLARIS8_LIBS += -lcurses
+ LINUX_LIBS += -lncurses
+ FREEBSD_LIBS += -lncurses
+ WIN32_LIBS += -lncurses
+ INTERIX_LIBS += -lncurses
+endif
ifeq ($(USAGE_STATS), yes)
SOLARIS_LIBS += -lresolv
COMMON_OBJECTS += ../common/usage_stats.o
endif
+ifeq ($(ADVANCED_DEBUGGER_UI), yes)
EDITLINE_OBJECTS := $(addprefix ../mctr2/editline/build/src/.libs/, chared.o common.o \
emacs.o fgetln.o help.o history.o map.o prompt.o read.o search.o strlcat.o term.o tty.o \
vi.o wcsdup.o chartype.o el.o fcns.o filecomplete.o hist.o key.o parse.o readline.o \
refresh.o sig.o strlcpy.o tokenizer.o unvis.o vis.o)
+endif
LIBRARY_OBJECTS_NOMAIN := $(filter-out Single_main.o Parallel_main.o ProfMerge_main.o, \
$(OBJECTS)) $(COMMON_OBJECTS) $(EDITLINE_OBJECTS)