[PATCH] Fix "restart loosing inferior argument" bug



Hello,

This patch fixes a transiant bug that became more reproducible
recently.  Basically, sometimes when restarting the inferior, Nemiver
would forget to pass it its arguments.  Fixed thus, tested and applied
to master.

        * src/dbgengine/nmv-gdb-engine.cc (GDBEngine::load_program): Do
        not reset the command queue *after* launching a fresh GDB.  That
        might drop many useful commands sent to the new GDB instance and
        thus make us loose important information such as the arguments to
        the inferior.  Rather, reset the command queue before launching a
        fresh new GDB.
---
 src/dbgengine/nmv-gdb-engine.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index cf0d4b7..b4a12fa 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3207,6 +3207,13 @@ GDBEngine::load_program (const UString &a_prog,
         m_priv->tty_fd = a_slave_tty_fd;
         m_priv->get_tty_attributes ();
 
+        // In case we are restarting GDB after a crash, the command
+        // queue might be stuck.  Let's restart it.
+        if (a_force) {
+            LOG_DD ("Reset command queue");
+            m_priv->reset_command_queue ();
+        }
+
         if (m_priv->launch_gdb_and_set_args (a_working_dir,
                                              a_source_search_dirs,
                                              a_prog, a_argv,
@@ -3215,13 +3222,6 @@ GDBEngine::load_program (const UString &a_prog,
 
         m_priv->uses_launch_tty = a_uses_launch_tty;
 
-        // In case we are restarting GDB after a crash, the command
-        // queue might be stuck.  Let's restart it.
-        if (a_force) {
-            LOG_DD ("Reset command queue");
-            m_priv->reset_command_queue ();
-        }
-
         queue_command (Command ("load-program",
                                 "set breakpoint pending on"));
 
-- 
                Dodji


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]