[nemiver/console] Split Console & Command Interpreter code.
- From: Fabien Parent <fparent src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/console] Split Console & Command Interpreter code.
- Date: Sun, 11 Mar 2012 13:30:21 +0000 (UTC)
commit 98068686d1c4c2cbdaaab3a8bd3c181fe5c68141
Author: Fabien Parent <parent f gmail com>
Date: Sun Mar 11 12:43:01 2012 +0100
Split Console & Command Interpreter code.
src/common/Makefile.am | 3 +-
src/dbgengine/Makefile.am | 12 +-
.../{nmv-dbg-console.cc => nmv-cmd-interpreter.cc} | 320 +++++++++++++++-----
.../nmv-cmd-interpreter.h} | 67 +++--
src/dbgengine/nmv-dbg-console.h | 58 ----
src/persp/dbgperspective/Makefile.am | 4 +-
.../dbgperspective}/nmv-console.cc | 286 +++++-------------
src/persp/dbgperspective/nmv-console.h | 98 ++++++
src/persp/dbgperspective/nmv-dbg-perspective.cc | 49 ++--
9 files changed, 480 insertions(+), 417 deletions(-)
---
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 8318d34..5b61d90 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -71,8 +71,7 @@ $(h)/nmv-sql-statement.cc \
$(h)/nmv-insert-statement.cc \
$(h)/nmv-delete-statement.cc \
$(h)/nmv-proc-utils.cc \
-$(h)/nmv-proc-mgr.cc \
-$(h)/nmv-console.cc
+$(h)/nmv-proc-mgr.cc
publicheaders_DATA=$(headers)
publicheadersdir=$(NEMIVER_INCLUDE_DIR)/common
diff --git a/src/dbgengine/Makefile.am b/src/dbgengine/Makefile.am
index a271197..3a04b22 100644
--- a/src/dbgengine/Makefile.am
+++ b/src/dbgengine/Makefile.am
@@ -21,7 +21,7 @@ libgdbmiparser.la \
libdbgcommon.la \
libdebuggerutils.la \
libgdbengine.la \
-libdbgconsole.la
+libcmdinterpreter.la
h=$(abs_srcdir)
@@ -86,11 +86,11 @@ $(h)/nmv-debugger-utils.cc
libdebuggerutils_la_CFLAGS=-fPIC -DPIC
-libdbgconsole_la_SOURCES= \
-$(h)/nmv-dbg-console.cc \
-$(h)/nmv-dbg-console.h
+libcmdinterpreter_la_SOURCES= \
+$(h)/nmv-cmd-interpreter.cc \
+$(h)/nmv-cmd-interpreter.h
-libdbgconsole_la_CFLAGS=-fPIC -DPIC
+libcmdinterpreter_la_CFLAGS=-fPIC -DPIC
libgdbengine_la_SOURCES= \
$(h)/nmv-gdb-engine.cc \
@@ -103,7 +103,7 @@ publicheadersdir=$(NEMIVER_INCLUDE_DIR)/dynmods
libgdbmod_la_LDFLAGS=-module -avoid-version -Wl,--as-needed
libgdbmod_la_LIBADD=libgdbmiparser.la \
-libgdbengine.la libdebuggerutils.la libdbgconsole.la @NEMIVERCOMMON_LIBS@ \
+libgdbengine.la libdebuggerutils.la libcmdinterpreter.la @NEMIVERCOMMON_LIBS@ \
$(abs_top_builddir)/src/langs/libnemivercparser.la \
$(abs_top_builddir)/src/common/libnemivercommon.la
diff --git a/src/dbgengine/nmv-dbg-console.cc b/src/dbgengine/nmv-cmd-interpreter.cc
similarity index 65%
rename from src/dbgengine/nmv-dbg-console.cc
rename to src/dbgengine/nmv-cmd-interpreter.cc
index 3fc0791..fb22092 100644
--- a/src/dbgengine/nmv-dbg-console.cc
+++ b/src/dbgengine/nmv-cmd-interpreter.cc
@@ -23,18 +23,17 @@
*See COPYRIGHT file copyright information.
*/
-#include "nmv-dbg-console.h"
+
+#include "nmv-cmd-interpreter.h"
#include "nmv-i-debugger.h"
-#include "uicommon/nmv-terminal.h"
-#include "common/nmv-exception.h"
#include "common/nmv-str-utils.h"
-#include "common/nmv-ustring.h"
+#include <map>
+#include <queue>
NEMIVER_BEGIN_NAMESPACE(nemiver)
-const char *const NEMIVER_DBG_CONSOLE_COOKIE = "nemiver-dbg-console";
-
-using namespace common;
+const char *const NEMIVER_CMD_INTERPRETER_COOKIE = "nemiver-dbg-console";
+const unsigned int COMMAND_EXECUTION_TIMEOUT_IN_SECONDS = 10;
struct DebuggingData {
IDebugger &debugger;
@@ -48,7 +47,7 @@ struct DebuggingData {
}
};
-struct CommandContinue : public Console::SynchronousCommand {
+struct CommandContinue : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandContinue (IDebugger &a_debugger) :
@@ -75,13 +74,13 @@ struct CommandContinue : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.do_continue ();
+ debugger.do_continue (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct CommandNext : public Console::SynchronousCommand {
+struct CommandNext : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandNext (IDebugger &a_debugger) :
@@ -108,13 +107,13 @@ struct CommandNext : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.step_over ();
+ debugger.step_over (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct CommandStep : public Console::SynchronousCommand {
+struct CommandStep : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandStep (IDebugger &a_debugger) :
@@ -141,13 +140,13 @@ struct CommandStep : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.step_in ();
+ debugger.step_in (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct CommandNexti : public Console::SynchronousCommand {
+struct CommandNexti : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandNexti (IDebugger &a_debugger) :
@@ -174,13 +173,13 @@ struct CommandNexti : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.step_over_asm ();
+ debugger.step_over_asm (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct CommandStepi : public Console::SynchronousCommand {
+struct CommandStepi : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandStepi (IDebugger &a_debugger) :
@@ -207,13 +206,13 @@ struct CommandStepi : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.step_in_asm ();
+ debugger.step_in_asm (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct CommandStop : public Console::SynchronousCommand {
+struct CommandStop : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandStop (IDebugger &a_debugger) :
@@ -229,13 +228,13 @@ struct CommandStop : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
debugger.stop_target ();
}
};
-struct CommandFinish : public Console::SynchronousCommand {
+struct CommandFinish : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandFinish (IDebugger &a_debugger) :
@@ -251,13 +250,13 @@ struct CommandFinish : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.step_out ();
+ debugger.step_out (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct CommandCall : public Console::SynchronousCommand {
+struct CommandCall : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
std::string cmd;
@@ -274,7 +273,7 @@ struct CommandCall : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString> &a_argv, Console::Stream &a_stream)
+ execute (const std::vector<UString> &a_argv, std::ostream &a_stream)
{
if (a_argv.size ()) {
cmd = str_utils::join (a_argv);
@@ -283,12 +282,12 @@ struct CommandCall : public Console::SynchronousCommand {
if (cmd.empty ()) {
a_stream << "The history is empty.\n";
} else {
- debugger.call_function (cmd);
+ debugger.call_function (cmd, NEMIVER_CMD_INTERPRETER_COOKIE);
}
}
};
-struct CommandThread : public Console::AsynchronousCommand {
+struct CommandThread : public CmdInterpreter::AsynchronousCommand {
IDebugger &debugger;
CommandThread (IDebugger &a_debugger) :
@@ -314,7 +313,7 @@ struct CommandThread : public Console::AsynchronousCommand {
void
display_usage (const std::vector<UString> &a_argv,
- Console::Stream &a_stream) const
+ std::ostream &a_stream) const
{
if (a_argv.size ()) {
return;
@@ -329,11 +328,11 @@ struct CommandThread : public Console::AsynchronousCommand {
void
threads_listed_signal (const std::list<int> a_thread_ids,
const UString &a_cookie,
- Console::Stream &a_stream)
+ std::ostream &a_stream)
{
NEMIVER_TRY
- if (a_cookie != NEMIVER_DBG_CONSOLE_COOKIE) {
+ if (a_cookie != NEMIVER_CMD_INTERPRETER_COOKIE) {
return;
}
@@ -349,7 +348,7 @@ struct CommandThread : public Console::AsynchronousCommand {
}
void
- execute (const std::vector<UString> &a_argv, Console::Stream &a_stream)
+ execute (const std::vector<UString> &a_argv, std::ostream &a_stream)
{
if (a_argv.size () > 1) {
a_stream << "Too much parameters.\n";
@@ -361,10 +360,10 @@ struct CommandThread : public Console::AsynchronousCommand {
(str_utils::from_string<unsigned int> (a_argv[0]));
} else if (a_argv[0] == "list") {
debugger.threads_listed_signal ().connect
- (sigc::bind<Console::Stream&> (sigc::mem_fun
+ (sigc::bind<std::ostream&> (sigc::mem_fun
(*this, &CommandThread::threads_listed_signal),
a_stream));
- debugger.list_threads (NEMIVER_DBG_CONSOLE_COOKIE);
+ debugger.list_threads (NEMIVER_CMD_INTERPRETER_COOKIE);
return;
} else {
a_stream << "Invalid argument: " << a_argv[0] << ".\n";
@@ -374,7 +373,7 @@ struct CommandThread : public Console::AsynchronousCommand {
}
};
-struct CommandBreak : public Console::SynchronousCommand {
+struct CommandBreak : public CmdInterpreter::SynchronousCommand {
DebuggingData &dbg_data;
CommandBreak (DebuggingData &a_dbg_data) :
@@ -401,7 +400,7 @@ struct CommandBreak : public Console::SynchronousCommand {
}
void
- display_usage (const std::vector<UString>&, Console::Stream &a_stream) const
+ display_usage (const std::vector<UString>&, std::ostream &a_stream) const
{
a_stream << "Usage:\n"
<< "\tbreak\n"
@@ -413,7 +412,7 @@ struct CommandBreak : public Console::SynchronousCommand {
}
void
- break_at_current_line (Console::Stream &a_stream)
+ break_at_current_line (std::ostream &a_stream)
{
IDebugger::Frame &frame = dbg_data.current_frame;
IDebugger &debugger = dbg_data.debugger;
@@ -427,7 +426,7 @@ struct CommandBreak : public Console::SynchronousCommand {
void
break_at_line (const std::vector<UString> &a_argv,
- Console::Stream &a_stream)
+ std::ostream &a_stream)
{
IDebugger &debugger = dbg_data.debugger;
@@ -441,7 +440,7 @@ struct CommandBreak : public Console::SynchronousCommand {
void
break_at_offset (const std::vector<UString> &a_argv,
- Console::Stream &a_stream)
+ std::ostream &a_stream)
{
IDebugger::Frame &frame = dbg_data.current_frame;
IDebugger &debugger = dbg_data.debugger;
@@ -464,26 +463,27 @@ struct CommandBreak : public Console::SynchronousCommand {
line -= str_utils::from_string<int> (offset);
}
- debugger.set_breakpoint (frame.file_full_name (), line);
+ debugger.set_breakpoint
+ (frame.file_full_name (), line, NEMIVER_CMD_INTERPRETER_COOKIE);
}
void
break_at_address (const std::vector<UString> &a_argv,
- Console::Stream &a_stream)
+ std::ostream &a_stream)
{
IDebugger &debugger = dbg_data.debugger;
std::string addr (a_argv[0].substr (1));
if (str_utils::string_is_hexa_number (addr)) {
Address address (addr);
- debugger.set_breakpoint (address);
+ debugger.set_breakpoint (address, NEMIVER_CMD_INTERPRETER_COOKIE);
} else {
a_stream << "Invalid address: " << addr << ".\n";
}
}
void
- execute (const std::vector<UString> &a_argv, Console::Stream &a_stream)
+ execute (const std::vector<UString> &a_argv, std::ostream &a_stream)
{
IDebugger &debugger = dbg_data.debugger;
@@ -502,7 +502,7 @@ struct CommandBreak : public Console::SynchronousCommand {
break_at_line (a_argv, a_stream);
} else if ((first_param_char >= 'a' && first_param_char <= 'z')
|| first_param_char == '_') {
- debugger.set_breakpoint (a_argv[0]);
+ debugger.set_breakpoint (a_argv[0], NEMIVER_CMD_INTERPRETER_COOKIE);
} else if (first_param_char == '*') {
break_at_address (a_argv, a_stream);
} else if (first_param_char == '+' || first_param_char == '-') {
@@ -513,7 +513,7 @@ struct CommandBreak : public Console::SynchronousCommand {
}
};
-struct CommandPrint : public Console::AsynchronousCommand {
+struct CommandPrint : public CmdInterpreter::AsynchronousCommand {
IDebugger &debugger;
std::string expression;
@@ -531,7 +531,7 @@ struct CommandPrint : public Console::AsynchronousCommand {
void
on_variable_created_signal (const IDebugger::VariableSafePtr a_var,
- Console::Stream &a_stream)
+ std::ostream &a_stream)
{
NEMIVER_TRY
@@ -544,7 +544,7 @@ struct CommandPrint : public Console::AsynchronousCommand {
}
void
- execute (const std::vector<UString> &a_argv, Console::Stream &a_stream)
+ execute (const std::vector<UString> &a_argv, std::ostream &a_stream)
{
if (a_argv.size ()) {
expression.clear ();
@@ -563,14 +563,14 @@ struct CommandPrint : public Console::AsynchronousCommand {
}
debugger.create_variable
- (expression, sigc::bind<Console::Stream&>
+ (expression, sigc::bind<std::ostream&>
(sigc::mem_fun
(*this, &CommandPrint::on_variable_created_signal),
a_stream));
}
};
-struct CommandOpen : public Console::SynchronousCommand {
+struct CommandOpen : public CmdInterpreter::SynchronousCommand {
DebuggingData &dbg_data;
sigc::signal<void, UString> file_opened_signal;
@@ -607,7 +607,7 @@ struct CommandOpen : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString> &a_argv, Console::Stream&)
+ execute (const std::vector<UString> &a_argv, std::ostream&)
{
for (std::vector<UString>::const_iterator iter = a_argv.begin ();
iter != a_argv.end ();
@@ -621,7 +621,7 @@ struct CommandOpen : public Console::SynchronousCommand {
}
};
-struct CommandLoadExec : public Console::SynchronousCommand {
+struct CommandLoadExec : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandLoadExec (IDebugger &a_debugger) :
@@ -637,18 +637,17 @@ struct CommandLoadExec : public Console::SynchronousCommand {
}
void
- display_usage (const std::vector<UString>&, Console::Stream &a_stream) const
+ display_usage (const std::vector<UString>&, std::ostream &a_stream) const
{
a_stream << "Usage:\n"
<< "\tload-exec PROGRAM_NAME [ARG1 ARG2 ...]\n";
}
void
- execute (const std::vector<UString> &a_argv, Console::Stream &a_stream)
+ execute (const std::vector<UString> &a_argv, std::ostream &a_stream)
{
std::vector<UString> argv;
- if (!a_argv.size ())
- {
+ if (!a_argv.size ()) {
display_usage (argv, a_stream);
return;
}
@@ -672,7 +671,7 @@ struct CommandLoadExec : public Console::SynchronousCommand {
}
};
-struct CommandRun : public Console::SynchronousCommand {
+struct CommandRun : public CmdInterpreter::SynchronousCommand {
IDebugger &debugger;
CommandRun (IDebugger &a_debugger) :
@@ -688,13 +687,23 @@ struct CommandRun : public Console::SynchronousCommand {
}
void
- execute (const std::vector<UString>&, Console::Stream&)
+ execute (const std::vector<UString>&, std::ostream&)
{
- debugger.run ();
+ debugger.run (NEMIVER_CMD_INTERPRETER_COOKIE);
}
};
-struct DBGConsole::Priv {
+struct CmdInterpreter::Priv {
+ std::vector<CmdInterpreter::Command*> command_vector;
+ std::map<std::string, CmdInterpreter::Command&> commands;
+ std::queue<UString> command_queue;
+ std::ostream &output_stream;
+ sigc::signal<void> ready_signal;
+
+ sigc::connection cmd_execution_done_connection;
+ sigc::connection cmd_execution_timeout_connection;
+ bool done_signal_received;
+
DebuggingData data;
CommandContinue cmd_continue;
@@ -712,7 +721,9 @@ struct DBGConsole::Priv {
CommandLoadExec cmd_load_exec;
CommandRun cmd_run;
- Priv (IDebugger &a_debugger) :
+ Priv (IDebugger &a_debugger, std::ostream &a_output_stream) :
+ output_stream (a_output_stream),
+ done_signal_received (true),
data (a_debugger),
cmd_continue (a_debugger),
cmd_next (a_debugger),
@@ -733,6 +744,15 @@ struct DBGConsole::Priv {
}
void
+ init_signals ()
+ {
+ data.debugger.stopped_signal ().connect
+ (sigc::mem_fun (*this, &CmdInterpreter::Priv::on_stopped_signal));
+ data.debugger.files_listed_signal ().connect (sigc::mem_fun
+ (*this, &CmdInterpreter::Priv::on_files_listed_signal));
+ }
+
+ void
on_stopped_signal (IDebugger::StopReason,
bool,
const IDebugger::Frame &a_frame,
@@ -750,19 +770,112 @@ struct DBGConsole::Priv {
data.source_files = a_files;
}
+ bool
+ execute_command (const UString &a_buffer)
+ {
+ std::string command_name;
+ std::vector<UString> cmd_argv;
+
+ std::istringstream is (a_buffer);
+ is >> command_name;
+
+ while (is.good ()) {
+ std::string arg;
+ is >> arg;
+ cmd_argv.push_back (arg);
+ }
+
+ if (command_name.empty ()) {
+ ready_signal.emit ();
+ return false;
+ }
+
+ if (!commands.count (command_name)) {
+ output_stream << "Undefined command: " << command_name << ".\n";
+ ready_signal.emit ();
+ return false;
+ }
+
+ Command &command = commands.at (command_name);
+ done_signal_received = false;
+ cmd_execution_done_connection = command.done_signal ().connect
+ (sigc::mem_fun (*this, &CmdInterpreter::Priv::on_done_signal));
+ commands.at (command_name) (cmd_argv, output_stream);
+ cmd_execution_timeout_connection =
+ Glib::signal_timeout().connect_seconds (sigc::mem_fun
+ (*this, &CmdInterpreter::Priv::on_cmd_execution_timeout_signal),
+ COMMAND_EXECUTION_TIMEOUT_IN_SECONDS);
+
+ return true;
+ }
+
+ bool
+ on_cmd_execution_timeout_signal ()
+ {
+ NEMIVER_TRY
+ on_done_signal ();
+ NEMIVER_CATCH_NOX
+
+ return true;
+ }
+
void
- init_signals ()
+ on_done_signal ()
{
- data.debugger.stopped_signal ().connect
- (sigc::mem_fun (*this, &DBGConsole::Priv::on_stopped_signal));
- data.debugger.files_listed_signal ().connect (sigc::mem_fun
- (*this, &DBGConsole::Priv::on_files_listed_signal));
+ NEMIVER_TRY
+
+ if (done_signal_received) {
+ return;
+ }
+
+ done_signal_received = true;
+ cmd_execution_done_connection.disconnect ();
+ cmd_execution_timeout_connection.disconnect ();
+
+ if (command_queue.size ()) {
+ process_command_queue ();
+ } else {
+ ready_signal.emit ();
+ }
+
+ NEMIVER_CATCH_NOX
+ }
+
+ void
+ process_command_queue ()
+ {
+ bool is_command_launched_successfully = false;
+ while (!is_command_launched_successfully && command_queue.size ()) {
+ NEMIVER_TRY
+ UString command = command_queue.front ();
+ command_queue.pop ();
+ is_command_launched_successfully = execute_command (command);
+ NEMIVER_CATCH_NOX
+ }
+ }
+
+ void
+ queue_command (const UString &a_command)
+ {
+ NEMIVER_TRY
+
+ if (a_command.empty ()) {
+ ready_signal.emit ();
+ return;
+ }
+
+ command_queue.push (a_command);
+ if (command_queue.size () == 1 && done_signal_received) {
+ process_command_queue ();
+ }
+
+ NEMIVER_CATCH_NOX
}
};
-DBGConsole::DBGConsole (int a_fd, IDebugger &a_debugger) :
- Console (a_fd),
- m_priv (new Priv (a_debugger))
+CmdInterpreter::CmdInterpreter (IDebugger &a_debugger,
+ std::ostream &a_output_stream) :
+ m_priv (new Priv (a_debugger, a_output_stream))
{
register_command (m_priv->cmd_continue);
register_command (m_priv->cmd_next);
@@ -780,29 +893,82 @@ DBGConsole::DBGConsole (int a_fd, IDebugger &a_debugger) :
register_command (m_priv->cmd_run);
}
+CmdInterpreter::~CmdInterpreter ()
+{
+}
+
void
-DBGConsole::current_file_path (const UString &a_file_path)
+CmdInterpreter::register_command (CmdInterpreter::Command &a_command)
+{
+ THROW_IF_FAIL (m_priv);
+
+ if (m_priv->commands.count (a_command.name ())) {
+ LOG ("Command '" << a_command.name () << "' is already registered in"
+ " the console. The previous command will be overwritten");
+ }
+
+ m_priv->commands.insert (std::make_pair<std::string, Command&>
+ (a_command.name (), a_command));
+ m_priv->command_vector.push_back (&a_command);
+
+ const char **aliases = a_command.aliases ();
+ for (int i = 0; aliases && aliases[i]; i++) {
+ if (m_priv->commands.count (aliases[i])) {
+ LOG ("Command '" << aliases[i] << "' is already registered in"
+ " the console. The previous command will be overwritten");
+ }
+ m_priv->commands.insert (std::make_pair<std::string, Command&>
+ (aliases[i], a_command));
+ }
+}
+
+void
+CmdInterpreter::current_file_path (const UString &a_file_path)
{
THROW_IF_FAIL (m_priv);
m_priv->data.current_file_path = a_file_path;
}
const UString&
-DBGConsole::current_file_path () const
+CmdInterpreter::current_file_path () const
{
THROW_IF_FAIL (m_priv);
return m_priv->data.current_file_path;
}
-DBGConsole::~DBGConsole ()
+sigc::signal<void, UString>&
+CmdInterpreter::file_opened_signal () const
{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->cmd_open.file_opened_signal;
}
-sigc::signal<void, UString>&
-DBGConsole::file_opened_signal () const
+sigc::signal<void>&
+CmdInterpreter::ready_signal () const
{
THROW_IF_FAIL (m_priv);
- return m_priv->cmd_open.file_opened_signal;
+ return m_priv->ready_signal;
+}
+
+const std::vector<CmdInterpreter::Command*>&
+CmdInterpreter::commands() const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->command_vector;
+}
+
+void
+CmdInterpreter::execute_command (const UString &a_command)
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->queue_command (a_command);
+}
+
+bool
+CmdInterpreter::ready () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->done_signal_received && !m_priv->command_queue.size ();
}
NEMIVER_END_NAMESPACE(nemiver)
diff --git a/src/common/nmv-console.h b/src/dbgengine/nmv-cmd-interpreter.h
similarity index 65%
rename from src/common/nmv-console.h
rename to src/dbgengine/nmv-cmd-interpreter.h
index 62a45c9..41d5885 100644
--- a/src/common/nmv-console.h
+++ b/src/dbgengine/nmv-cmd-interpreter.h
@@ -22,39 +22,36 @@
*
*See COPYRIGHT file copyright information.
*/
-#ifndef __NMV_CONSOLE_H__
-#define __NMV_CONSOLE_H__
-#include "nmv-safe-ptr.h"
-#include "nmv-namespace.h"
-#include "nmv-exception.h"
-#include <string>
+
+#ifndef __NMV_CMD_INTERPRETER_H__
+#define __NMV_CMD_INTERPRETER_H__
+
+#include "common/nmv-safe-ptr.h"
+#include "common/nmv-namespace.h"
+#include "common/nmv-ustring.h"
+#include <sigc++/signal.h>
+#include <ostream>
#include <vector>
NEMIVER_BEGIN_NAMESPACE(nemiver)
-NEMIVER_BEGIN_NAMESPACE(common)
-class Console {
+using namespace common;
+class IDebugger;
+
+class CmdInterpreter {
+ //non copyable
+ CmdInterpreter (const CmdInterpreter&);
+ CmdInterpreter& operator= (const CmdInterpreter&);
+
struct Priv;
SafePtr<Priv> m_priv;
public:
- class Stream {
- struct Priv;
- SafePtr<Priv> m_priv;
-
- public:
- explicit Stream (int a_fd);
- Stream& operator<< (const char *const a_string);
- Stream& operator<< (const std::string &a_string);
- Stream& operator<< (unsigned int a_uint);
- Stream& operator<< (int a_int);
- };
-
class Command {
sigc::signal<void> m_done_signal;
-public:
+ public:
sigc::signal<void>& done_signal ()
{
return m_done_signal;
@@ -72,15 +69,16 @@ public:
{
}
- virtual void display_usage (const std::vector<UString>&, Stream&) const
+ virtual void display_usage (const std::vector<UString>&,
+ std::ostream&) const
{
}
virtual void execute (const std::vector<UString> &a_argv,
- Stream &a_output) = 0;
+ std::ostream &a_output) = 0;
virtual void operator() (const std::vector<UString> &a_argv,
- Stream &a_output)
+ std::ostream &a_output)
{
execute (a_argv, a_output);
}
@@ -93,22 +91,29 @@ public:
typedef Command AsynchronousCommand;
struct SynchronousCommand : public Command{
virtual void operator() (const std::vector<UString> &a_argv,
- Stream &a_output)
+ std::ostream &a_output)
{
execute (a_argv, a_output);
done_signal ().emit ();
}
};
- explicit Console (int a_fd);
- virtual ~Console ();
- void register_command (Console::Command &a_command);
- void execute_command_file (const UString &a_command_file);
+ CmdInterpreter (IDebugger &a_debugger, std::ostream &a_output_stream);
+ ~CmdInterpreter ();
+ void register_command (Command &a_command);
void execute_command (const UString &a_command);
+ const std::vector<Command*>& commands() const;
+
+ void current_file_path (const UString &a_file_path);
+ const UString& current_file_path () const;
+
+ bool ready () const;
+
+ sigc::signal<void, UString>& file_opened_signal () const;
+ sigc::signal<void>& ready_signal () const;
};
-NEMIVER_END_NAMESPACE(common)
NEMIVER_END_NAMESPACE(nemiver)
-#endif /* __NMV_CONSOLE_H__ */
+#endif /* __NMV_CMD_INTERPRETER_H__ */
diff --git a/src/persp/dbgperspective/Makefile.am b/src/persp/dbgperspective/Makefile.am
index 7852432..7e8b667 100644
--- a/src/persp/dbgperspective/Makefile.am
+++ b/src/persp/dbgperspective/Makefile.am
@@ -73,7 +73,9 @@ $(h)/nmv-dbg-perspective-default-layout.h \
$(h)/nmv-dbg-perspective-two-pane-layout.cc \
$(h)/nmv-dbg-perspective-two-pane-layout.h \
$(h)/nmv-dbg-perspective-wide-layout.cc \
-$(h)/nmv-dbg-perspective-wide-layout.h
+$(h)/nmv-dbg-perspective-wide-layout.h \
+$(h)/nmv-console.cc \
+$(h)/nmv-console.h
if BUILD_DYNAMICLAYOUT
dynamiclayout_sources = \
diff --git a/src/common/nmv-console.cc b/src/persp/dbgperspective/nmv-console.cc
similarity index 60%
rename from src/common/nmv-console.cc
rename to src/persp/dbgperspective/nmv-console.cc
index 58c7dca..1d11b2d 100644
--- a/src/common/nmv-console.cc
+++ b/src/persp/dbgperspective/nmv-console.cc
@@ -27,8 +27,10 @@
#define PREFER_STDARG
#include "nmv-console.h"
-#include "nmv-str-utils.h"
-#include <map>
+#include "common/nmv-str-utils.h"
+#include "uicommon/nmv-terminal.h"
+#include "dbgengine/nmv-cmd-interpreter.h"
+#include "dbgengine/nmv-i-debugger.h"
#include <vector>
#include <cstring>
#include <fstream>
@@ -37,89 +39,27 @@
#include <readline/history.h>
NEMIVER_BEGIN_NAMESPACE(nemiver)
-NEMIVER_BEGIN_NAMESPACE(common)
const char *const CONSOLE_PROMPT = "> ";
-const unsigned int COMMAND_EXECUTION_TIMEOUT_IN_SECONDS = 10;
-
-struct Console::Stream::Priv {
- int fd;
-
- Priv () :
- fd (0)
- {
- }
-
- Priv (int a_fd) :
- fd (a_fd)
- {
- }
-
- void
- write (const std::string &a_msg) const
- {
- THROW_IF_FAIL (fd);
- ::write (fd, a_msg.c_str (), a_msg.size ());
- }
-};
-
-Console::Stream::Stream (int a_fd) :
- m_priv (new Priv (a_fd))
-{
-}
-
-Console::Stream&
-Console::Stream::operator<< (const char *const a_string)
-{
- THROW_IF_FAIL (m_priv);
- m_priv->write (a_string);
- return *this;
-}
-
-Console::Stream&
-Console::Stream::operator<< (const std::string &a_string)
-{
- THROW_IF_FAIL (m_priv);
- m_priv->write (a_string);
- return *this;
-}
-
-Console::Stream&
-Console::Stream::operator<< (unsigned int a_uint)
-{
- THROW_IF_FAIL (m_priv);
- m_priv->write (str_utils::to_string (a_uint));
- return *this;
-}
-
-Console::Stream&
-Console::Stream::operator<< (int a_int)
-{
- THROW_IF_FAIL (m_priv);
- m_priv->write (str_utils::to_string (a_int));
- return *this;
-}
struct Console::Priv {
- std::map<std::string, Console::Command&> commands;
- std::vector<Console::Command*> commands_vector;
- std::list<UString> command_queue;
+ Terminal terminal;
+ Console::Stream stream;
+ CmdInterpreter cmd_interpreter;
+ Glib::RefPtr<Glib::IOSource> io_source;
+ IDebugger &debugger;
- int fd;
struct readline_state console_state;
struct readline_state saved_state;
- Console::Stream stream;
- Glib::RefPtr<Glib::IOSource> io_source;
- sigc::connection cmd_execution_done_connection;
- sigc::connection cmd_execution_timeout_connection;
- bool done_signal_received;
-
- Priv (int a_fd) :
- fd (a_fd),
- stream (a_fd),
- io_source (Glib::IOSource::create (a_fd, Glib::IO_IN)),
- done_signal_received (true)
+ Priv (IDebugger &a_debugger,
+ const std::string &a_menu_file_path,
+ const Glib::RefPtr<Gtk::UIManager> &a_ui_manager) :
+ terminal (a_menu_file_path, a_ui_manager),
+ stream (terminal.slave_fd ()),
+ cmd_interpreter (a_debugger, stream),
+ io_source (Glib::IOSource::create (terminal.slave_fd (), Glib::IO_IN)),
+ debugger (a_debugger)
{
init ();
}
@@ -127,14 +67,16 @@ struct Console::Priv {
void
init ()
{
+ int fd = terminal.slave_fd ();
THROW_IF_FAIL (fd);
- THROW_IF_FAIL (io_source);
-
if (consoles ().count (fd)) {
THROW ("Cannot create two consoles from the same file descriptor.");
}
consoles ()[fd] = this;
+ cmd_interpreter.ready_signal ().connect
+ (sigc::mem_fun (*this, &Console::Priv::on_ready_signal));
+
io_source->connect (sigc::mem_fun (*this, &Console::Priv::read_char));
io_source->attach ();
@@ -149,12 +91,18 @@ struct Console::Priv {
rl_restore_state (&saved_state);
}
+ void
+ on_ready_signal ()
+ {
+ stream << CONSOLE_PROMPT;
+ }
+
bool
read_char (Glib::IOCondition)
{
NEMIVER_TRY
- if (cmd_execution_done_connection.connected ())
+ if (!cmd_interpreter.ready ())
return false;
rl_restore_state (&console_state);
@@ -198,10 +146,13 @@ struct Console::Priv {
void
do_command_completion (const std::string &a_line)
{
- std::vector<Console::Command*> matches;
- for (std::vector<Console::Command*>::const_iterator iter =
- commands_vector.begin ();
- iter != commands_vector.end ();
+ const std::vector<CmdInterpreter::Command*> &commands =
+ cmd_interpreter.commands ();
+
+ std::vector<CmdInterpreter::Command*> matches;
+ for (std::vector<CmdInterpreter::Command*>::const_iterator iter =
+ commands.begin ();
+ iter != commands.end ();
++iter) {
if (*iter && !(*iter)->name ().find (a_line)) {
matches.push_back (*iter);
@@ -239,10 +190,13 @@ struct Console::Priv {
return;
}
- Console::Command* command = 0;
- for (std::vector<Console::Command*>::const_iterator iter =
- commands_vector.begin ();
- iter != commands_vector.end ();
+ const std::vector<CmdInterpreter::Command*> &commands =
+ cmd_interpreter.commands ();
+
+ CmdInterpreter::Command* command = 0;
+ for (std::vector<CmdInterpreter::Command*>::const_iterator iter =
+ commands.begin ();
+ iter != commands.end ();
++iter) {
if (*iter && (*iter)->name () == a_tokens[0]) {
command = *iter;
@@ -300,83 +254,6 @@ struct Console::Priv {
}
}
- void
- execute_command (const char *a_buffer)
- {
- std::string command_name;
- std::vector<UString> cmd_argv;
-
- std::istringstream is (a_buffer);
- is >> command_name;
-
- while (is.good ())
- {
- std::string arg;
- is >> arg;
- cmd_argv.push_back (arg);
- }
-
- if (command_name.empty ()) {
- stream << CONSOLE_PROMPT;
- return;
- }
-
- if (!commands.count (command_name)) {
- stream << "Undefined command: " << command_name << ".\n"
- << CONSOLE_PROMPT;
- return;
- }
-
- Command &command = commands.at (command_name);
- done_signal_received = false;
- cmd_execution_done_connection = command.done_signal ().connect
- (sigc::mem_fun (*this, &Console::Priv::on_done_signal));
- commands.at (command_name) (cmd_argv, stream);
- cmd_execution_timeout_connection =
- Glib::signal_timeout().connect_seconds
- (sigc::mem_fun
- (*this, &Console::Priv::on_cmd_execution_timeout_signal),
- COMMAND_EXECUTION_TIMEOUT_IN_SECONDS);
- }
-
- bool
- on_cmd_execution_timeout_signal ()
- {
- NEMIVER_TRY
- on_done_signal ();
- NEMIVER_CATCH_NOX
-
- return true;
- }
-
- void
- on_done_signal ()
- {
- NEMIVER_TRY
-
- if (done_signal_received) {
- return;
- }
-
- done_signal_received = true;
- stream << CONSOLE_PROMPT;
- cmd_execution_timeout_connection.disconnect();
- cmd_execution_done_connection.disconnect ();
-
- while (command_queue.size ())
- {
- NEMIVER_TRY
- UString command = command_queue.front ();
- command_queue.pop_front ();
- stream << command << "\n";
- add_history (command.c_str ());
- execute_command (command.c_str ());
- NEMIVER_CATCH_NOX
- }
-
- NEMIVER_CATCH_NOX
- }
-
static int
on_tab_key_pressed (int, int)
{
@@ -425,36 +302,18 @@ struct Console::Priv {
THROW_IF_FAIL (a_command);
add_history (a_command);
- self ().execute_command (a_command);
+ self ().cmd_interpreter.execute_command (a_command);
NEMIVER_CATCH_NOX
free (a_command);
}
-
- void
- queue_command (const UString &a_command)
- {
- NEMIVER_TRY
-
- if (a_command.empty ()) {
- return;
- }
-
- if (!command_queue.size () && done_signal_received) {
- stream << a_command << "\n";
- add_history (a_command.c_str ());
- execute_command (a_command.c_str ());
- } else {
- command_queue.push_back (a_command);
- }
-
- NEMIVER_CATCH_NOX
- }
};
-Console::Console (int a_fd) :
- m_priv (new Priv (a_fd))
+Console::Console (IDebugger &a_debugger,
+ const std::string &a_menu_file_path,
+ const Glib::RefPtr<Gtk::UIManager> &a_ui_manager) :
+ m_priv (new Priv (a_debugger, a_menu_file_path, a_ui_manager))
{
}
@@ -463,31 +322,6 @@ Console::~Console ()
}
void
-Console::register_command (Console::Command &a_command)
-{
- THROW_IF_FAIL (m_priv);
-
- if (m_priv->commands.count (a_command.name ())) {
- LOG ("Command '" << a_command.name () << "' is already registered in"
- " the console. The previous command will be overwritten");
- }
-
- m_priv->commands.insert (std::make_pair<std::string, Command&>
- (a_command.name (), a_command));
- m_priv->commands_vector.push_back (&a_command);
-
- const char **aliases = a_command.aliases ();
- for (int i = 0; aliases && aliases[i]; i++) {
- if (m_priv->commands.count (aliases[i])) {
- LOG ("Command '" << aliases[i] << "' is already registered in"
- " the console. The previous command will be overwritten");
- }
- m_priv->commands.insert (std::make_pair<std::string, Command&>
- (aliases[i], a_command));
- }
-}
-
-void
Console::execute_command_file (const UString &a_command_file)
{
std::ifstream file (a_command_file.c_str ());
@@ -503,9 +337,31 @@ void
Console::execute_command (const UString &a_command)
{
THROW_IF_FAIL (m_priv);
- m_priv->queue_command (a_command);
+
+ rl_restore_state (&m_priv->console_state);
+
+ add_history (a_command.c_str ());
+ m_priv->stream << a_command << "\n";
+
+ rl_save_state (&m_priv->console_state);
+ rl_restore_state (&m_priv->saved_state);
+
+ m_priv->cmd_interpreter.execute_command (a_command);
+}
+
+CmdInterpreter&
+Console::command_interpreter() const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->cmd_interpreter;
+}
+
+Terminal&
+Console::terminal () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->terminal;
}
-NEMIVER_END_NAMESPACE(common)
NEMIVER_END_NAMESPACE(nemiver)
diff --git a/src/persp/dbgperspective/nmv-console.h b/src/persp/dbgperspective/nmv-console.h
new file mode 100644
index 0000000..f0c83d2
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-console.h
@@ -0,0 +1,98 @@
+//Author: Fabien Parent
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#ifndef __NMV_CONSOLE_H__
+#define __NMV_CONSOLE_H__
+
+#include "common/nmv-safe-ptr.h"
+#include "common/nmv-namespace.h"
+#include "common/nmv-exception.h"
+#include <gtkmm/uimanager.h>
+#include <string>
+#include <vector>
+#include <ostream>
+
+NEMIVER_BEGIN_NAMESPACE(nemiver)
+
+class IDebugger;
+class CmdInterpreter;
+class Terminal;
+
+using nemiver::common::SafePtr;
+using nemiver::common::UString;
+
+class Console {
+ //non copyable
+ Console (const Console&);
+ Console& operator= (const Console&);
+
+ struct Priv;
+ SafePtr<Priv> m_priv;
+
+ struct StreamBuf : public std::streambuf {
+ int fd;
+
+ StreamBuf () :
+ fd (0)
+ {
+ }
+
+ StreamBuf (int a_fd) :
+ fd (a_fd)
+ {
+ }
+
+ virtual std::streamsize
+ xsputn (const char *a_string, std::streamsize a_size)
+ {
+ THROW_IF_FAIL (fd);
+ return ::write (fd, a_string, a_size);
+ }
+ };
+
+public:
+ class Stream : public std::ostream {
+ StreamBuf streambuf;
+ public:
+ explicit Stream (int a_fd) :
+ std::ostream (&streambuf),
+ streambuf (a_fd)
+ {
+ }
+ };
+
+ Console (IDebugger &a_debugger,
+ const std::string &a_menu_file_path,
+ const Glib::RefPtr<Gtk::UIManager> &a_ui_manager);
+ ~Console ();
+ void execute_command_file (const UString &a_command_file);
+ void execute_command (const UString &a_command);
+ CmdInterpreter& command_interpreter() const;
+ Terminal& terminal () const;
+};
+
+NEMIVER_END_NAMESPACE(nemiver)
+
+#endif /* __NMV_CONSOLE_H__ */
+
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index cfcf177..4fec78d 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -53,7 +53,7 @@
#include "common/nmv-str-utils.h"
#include "common/nmv-address.h"
#include "common/nmv-loc.h"
-#include "nmv-dbg-console.h"
+#include "nmv-console.h"
#include "nmv-sess-mgr.h"
#include "nmv-dbg-perspective.h"
#include "nmv-source-editor.h"
@@ -97,6 +97,7 @@
#include "nmv-dbg-perspective-dynamic-layout.h"
#endif // WITH_DYNAMICLAYOUT
#include "nmv-layout-manager.h"
+#include "nmv-cmd-interpreter.h"
using namespace std;
using namespace nemiver::common;
@@ -744,7 +745,7 @@ public:
Gtk::ScrolledWindow& get_local_vars_inspector_scrolled_win ();
- Terminal& console_terminal ();
+ Console& dbg_console ();
Gtk::Box& console_box ();
@@ -906,8 +907,7 @@ struct DBGPerspective::Priv {
Path2MonitorMap path_2_monitor_map;
SafePtr<LocalVarsInspector> variables_editor;
SafePtr<Gtk::ScrolledWindow> variables_editor_scrolled_win;
- SafePtr<Terminal> console_terminal;
- SafePtr<DBGConsole> dbg_console;
+ SafePtr<Console> dbg_console;
SafePtr<Gtk::Box> console_box;
SafePtr<Terminal> terminal;
SafePtr<Gtk::Box> terminal_box;
@@ -1780,8 +1780,8 @@ DBGPerspective::on_switch_page_signal (Gtk::Widget *a_page,
if (iter != nil) {
SourceEditor *editor = get_current_source_editor ();
if (editor) {
- THROW_IF_FAIL (m_priv->dbg_console);
- m_priv->dbg_console->current_file_path (editor->get_path ());
+ dbg_console ().command_interpreter ().current_file_path
+ (editor->get_path ());
}
}
NEMIVER_CATCH
@@ -3716,11 +3716,6 @@ DBGPerspective::init_body ()
(sigc::mem_fun (this, &DBGPerspective::on_notebook_tabs_reordered));
#endif
- IDebuggerSafePtr& dbg = debugger ();
- THROW_IF_FAIL (dbg);
- m_priv->dbg_console.reset
- (new DBGConsole (console_terminal ().slave_fd (), *dbg));
-
UString layout = DBG_PERSPECTIVE_DEFAULT_LAYOUT;
NEMIVER_TRY
conf_mgr.get_key_value (CONF_KEY_DBG_PERSPECTIVE_LAYOUT, layout);
@@ -3769,9 +3764,8 @@ DBGPerspective::init_signals ()
m_priv->layout_mgr.layout_changed_signal ().connect (sigc::mem_fun
(*this, &DBGPerspective::on_layout_changed));
- THROW_IF_FAIL (m_priv->dbg_console);
- m_priv->dbg_console->file_opened_signal ().connect (sigc::mem_fun
- (*this, &DBGPerspective::on_file_opened));
+ dbg_console ().command_interpreter ().file_opened_signal ().connect
+ (sigc::mem_fun (*this, &DBGPerspective::on_file_opened));
}
/// Connect slots (callbacks) to the signals emitted by the
@@ -5724,10 +5718,7 @@ DBGPerspective::session_manager ()
void
DBGPerspective::execute_command_file (const UString &a_command_file)
{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->dbg_console);
-
- m_priv->dbg_console->execute_command_file (a_command_file);
+ dbg_console ().execute_command_file (a_command_file);
}
void
@@ -8063,22 +8054,24 @@ DBGPerspective::get_local_vars_inspector_scrolled_win ()
return *m_priv->variables_editor_scrolled_win;
}
-Terminal&
-DBGPerspective::console_terminal ()
+Console&
+DBGPerspective::dbg_console ()
{
THROW_IF_FAIL (m_priv);
- if (!m_priv->console_terminal) {
+ if (!m_priv->dbg_console) {
string relative_path = Glib::build_filename ("menus",
"terminalmenu.xml");
string absolute_path;
THROW_IF_FAIL (build_absolute_resource_path
(Glib::filename_to_utf8 (relative_path), absolute_path));
- m_priv->console_terminal.reset (new Terminal
- (absolute_path, workbench ().get_ui_manager ()));
+ IDebuggerSafePtr dbg = debugger ();
+ THROW_IF_FAIL (dbg);
+ m_priv->dbg_console.reset
+ (new Console (*dbg, absolute_path, workbench ().get_ui_manager ()));
}
- THROW_IF_FAIL (m_priv->console_terminal);
- return *m_priv->console_terminal;
+ THROW_IF_FAIL (m_priv->dbg_console);
+ return *m_priv->dbg_console;
}
Gtk::Box&
@@ -8090,8 +8083,10 @@ DBGPerspective::console_box ()
THROW_IF_FAIL (m_priv->console_box);
Gtk::VScrollbar *scrollbar = Gtk::manage (new Gtk::VScrollbar);
m_priv->console_box->pack_end (*scrollbar, false, false, 0);
- m_priv->console_box->pack_start (console_terminal ().widget ());
- scrollbar->set_adjustment (console_terminal ().adjustment ());
+
+ Terminal &terminal = dbg_console ().terminal ();
+ m_priv->console_box->pack_start (terminal.widget ());
+ scrollbar->set_adjustment (terminal.adjustment ());
}
THROW_IF_FAIL (m_priv->console_box);
return *m_priv->console_box;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]