nemiver r794 - in trunk: . src/dbgengine src/persp/dbgperspective
- From: dodji svn gnome org
- To: svn-commits-list gnome org
- Subject: nemiver r794 - in trunk: . src/dbgengine src/persp/dbgperspective
- Date: Tue, 8 Apr 2008 08:18:03 +0100 (BST)
Author: dodji
Date: Tue Apr 8 08:18:03 2008
New Revision: 794
URL: http://svn.gnome.org/viewvc/nemiver?rev=794&view=rev
Log:
fix #526696 - Detach from the running program" not properly
Modified:
trunk/ChangeLog
trunk/src/dbgengine/nmv-gdb-engine.cc
trunk/src/dbgengine/nmv-gdb-engine.h
trunk/src/dbgengine/nmv-i-debugger.h
trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
Modified: trunk/src/dbgengine/nmv-gdb-engine.cc
==============================================================================
--- trunk/src/dbgengine/nmv-gdb-engine.cc (original)
+++ trunk/src/dbgengine/nmv-gdb-engine.cc Tue Apr 8 08:18:03 2008
@@ -81,6 +81,7 @@
int gdb_stdout_fd;
int gdb_stderr_fd;
int master_pty_fd;
+ bool is_attached;
Glib::RefPtr<Glib::IOChannel> gdb_stdout_channel;
Glib::RefPtr<Glib::IOChannel> gdb_stderr_channel;
Glib::RefPtr<Glib::IOChannel> master_pty_channel;
@@ -369,6 +370,7 @@
gdb_pid (0), target_pid (0),
gdb_stdout_fd (0), gdb_stderr_fd (0),
master_pty_fd (0),
+ is_attached (false),
line_busy (false),
error_buffer_status (DEFAULT),
state (IDebugger::NOT_STARTED)
@@ -1208,6 +1210,12 @@
m_engine->command_done_signal ().emit (a_in.command ().name (),
a_in.command ().cookie ());
+ if (a_in.command ().name () == "attach-to-program") {
+ m_engine->set_attached_to_target (true);
+ }
+ //TODO: this is not necessarily true. Before setting the state
+ //to ready here, one must now which command exactly was fired so
+ //that gdb returned the "DONE" status for it.
m_engine->set_state (IDebugger::READY);
}
};//struct OnCommandDoneHandler
@@ -2148,6 +2156,22 @@
queue_command (Command ("detach-from-target", "-target-detach", a_cookie));
}
+bool
+GDBEngine::is_attached_to_target () const
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ THROW_IF_FAIL (m_priv);
+ return m_priv->is_attached;
+}
+
+void
+GDBEngine::set_attached_to_target (bool a_is_attached)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ THROW_IF_FAIL (m_priv);
+ m_priv->is_attached = a_is_attached;
+}
+
void
GDBEngine::add_env_variables (const map<UString, UString> &a_vars)
{
@@ -2524,6 +2548,52 @@
NEMIVER_CATCH_NOX
}
+void
+GDBEngine::on_stopped_signal (const UString &a_reason,
+ bool a_has_frame,
+ const IDebugger::Frame &a_frame,
+ int a_thread_id,
+ const UString &a_cookie)
+{
+ if (a_has_frame || a_frame.line () || a_thread_id || a_cookie.empty ()) {
+ //keep compiler happy
+ }
+
+ NEMIVER_TRY
+
+ if (a_reason == "exited-signalled"
+ || a_reason == "exited-normally"
+ || a_reason == "exited") {
+ return;
+ }
+ THROW_IF_FAIL (m_priv);
+ m_priv->is_attached = true;
+
+ NEMIVER_CATCH_NOX
+}
+
+void
+GDBEngine::on_detached_from_target_signal ()
+{
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (m_priv);
+ m_priv->is_attached = false;
+
+ NEMIVER_CATCH_NOX
+}
+
+void
+GDBEngine::on_program_finished_signal ()
+{
+ NEMIVER_TRY
+
+ THROW_IF_FAIL (m_priv);
+ m_priv->is_attached = false;
+
+ NEMIVER_CATCH_NOX
+}
+
//******************
//</signal handlers>
//******************
@@ -2534,6 +2604,12 @@
(*this, &GDBEngine::on_debugger_stdout_signal));
got_target_info_signal ().connect (sigc::mem_fun
(*this, &GDBEngine::on_got_target_info_signal));
+ stopped_signal ().connect (sigc::mem_fun
+ (*this, &GDBEngine::on_stopped_signal));
+ detached_from_target_signal ().connect (sigc::mem_fun
+ (*this, &GDBEngine::on_detached_from_target_signal));
+ program_finished_signal ().connect (sigc::mem_fun
+ (*this, &GDBEngine::on_program_finished_signal));
init_output_handlers ();
}
Modified: trunk/src/dbgengine/nmv-gdb-engine.h
==============================================================================
--- trunk/src/dbgengine/nmv-gdb-engine.h (original)
+++ trunk/src/dbgengine/nmv-gdb-engine.h Tue Apr 8 08:18:03 2008
@@ -182,6 +182,14 @@
void on_debugger_stdout_signal (CommandAndOutput &a_cao) ;
void on_got_target_info_signal (int a_pid, const UString& a_exe_path) ;
+ void on_stopped_signal (const UString &a_reason,
+ bool has_frame,
+ const IDebugger::Frame &a_frame,
+ int a_thread_id,
+ const UString &a_cookie);
+ void on_detached_from_target_signal ();
+
+ void on_program_finished_signal ();
//***************
//</signal handlers>
//***************
@@ -228,6 +236,10 @@
void detach_from_target (const UString &a_cookie="") ;
+ bool is_attached_to_target () const;
+
+ void set_attached_to_target (bool a_is_attached);
+
void add_env_variables (const map<UString, UString> &a_vars) ;
map<UString, UString>& get_env_variables () ;
Modified: trunk/src/dbgengine/nmv-i-debugger.h
==============================================================================
--- trunk/src/dbgengine/nmv-i-debugger.h (original)
+++ trunk/src/dbgengine/nmv-i-debugger.h Tue Apr 8 08:18:03 2008
@@ -687,6 +687,8 @@
virtual void detach_from_target (const UString &a_cookie="") = 0;
+ virtual bool is_attached_to_target () const =0;
+
virtual void add_env_variables (const map<UString, UString> &a_vars) = 0;
virtual map<UString, UString>& get_env_variables () = 0;
Modified: trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc (original)
+++ trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc Tue Apr 8 08:18:03 2008
@@ -1407,7 +1407,9 @@
m_priv->debugger_ready_action_group->set_sensitive (true) ;
m_priv->target_not_started_action_group->set_sensitive (true) ;
m_priv->debugger_busy_action_group->set_sensitive (false) ;
- attached_to_target_signal ().emit (true) ;
+ if (debugger ()->is_attached_to_target ()) {
+ attached_to_target_signal ().emit (true) ;
+ }
} else {
m_priv->target_not_started_action_group->set_sensitive (false) ;
m_priv->debugger_ready_action_group->set_sensitive (false) ;
@@ -1813,6 +1815,7 @@
void
DBGPerspective::on_debugger_connected_to_remote_target_signal ()
{
+ LOG_FUNCTION_SCOPE_NORMAL_DD ;
NEMIVER_TRY
ui_utils::display_info (_("Connected to remote target !")) ;
@@ -1823,10 +1826,22 @@
void
DBGPerspective::on_debugger_detached_from_target_signal ()
{
+ LOG_FUNCTION_SCOPE_NORMAL_DD ;
+
NEMIVER_TRY
clear_status_notebook () ;
workbench ().set_title_extension ("");
+ //****************************
+ //grey out all the menu
+ //items but those to
+ //to restart the debugger etc
+ //***************************
+ THROW_IF_FAIL (m_priv);
+ m_priv->debugger_ready_action_group->set_sensitive (false) ;
+ m_priv->debugger_busy_action_group->set_sensitive (false) ;
+ m_priv->target_connected_action_group->set_sensitive (false);
+ m_priv->target_not_started_action_group->set_sensitive (true) ;
NEMIVER_CATCH
}
@@ -1993,11 +2008,10 @@
//****************************
//grey out all the menu
- //items but the one
- //to restart the debugger
+ //items but those to
+ //to restart the debugger etc
//***************************
THROW_IF_FAIL (m_priv) ;
-
m_priv->target_not_started_action_group->set_sensitive (true) ;
m_priv->debugger_ready_action_group->set_sensitive (false) ;
m_priv->debugger_busy_action_group->set_sensitive (false) ;
@@ -2442,6 +2456,17 @@
ActionEntry::DEFAULT,
""
},
+ {
+ "DetachFromProgramMenuItemAction",
+ Gtk::Stock::DISCONNECT,
+ _("_Detach From the Running Program"),
+ _("Disconnect the debugger from the running target "
+ "without killing it"),
+ sigc::mem_fun (*this,
+ &DBGPerspective::on_detach_from_program_action),
+ ActionEntry::DEFAULT,
+ ""
+ },
};
static ui_utils::ActionEntry s_target_not_started_action_entries [] = {
@@ -2458,17 +2483,6 @@
static ui_utils::ActionEntry s_debugger_ready_action_entries [] = {
{
- "DetachFromProgramMenuItemAction",
- Gtk::Stock::DISCONNECT,
- _("_Detach From the Running Program"),
- _("Disconnect the debugger from the running target "
- "without killing it"),
- sigc::mem_fun (*this,
- &DBGPerspective::on_detach_from_program_action),
- ActionEntry::DEFAULT,
- ""
- },
- {
"NextMenuItemAction",
nemiver::STOCK_STEP_OVER,
_("_Next"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]