[nemiver] Don't loose commands sent down the wire



commit 268446aea14a440cc54e9ec9afe1581a8ced1527
Author: Dodji Seketeli <dodji gnome org>
Date:   Fri Apr 1 20:49:18 2011 +0200

    Don't loose commands sent down the wire
    
    	* src/dbgengine/nmv-i-debugger.h (IDebugger::load_program): Add a
    	force flag.
    	* src/dbgengine/nmv-gdb-engine.h (GDBEngine::load_program):
    	Adjust.
    	* src/dbgengine/nmv-gdb-engine.cc (GDBEngine::load_program): Add
    	a_force parameter to control whether to reset the command queue or
    	not.
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc
    	(DBGPerspective::execute_progra): Rename the
    	a_check_is_new_program parameter into a_restarting.  Then, load
    	the program by forcing the reset of the command queue *only* when
    	restarting.
    	* tests/test-breakpoint.cc (test_main): Adjust to the new
    	additional parameter of IDebugger::load_program.
    	* tests/test-disassemble.cc (test_main): Likewise.
    	* tests/test-types.cc (test_main): Likewise.
    	* tests/test-var-path-expr.cc (test_main): Likewise.
    	* tests/test-watchpoint.cc (test_main): Likewise.

 src/dbgengine/nmv-gdb-engine.cc                 |   11 +++++++----
 src/dbgengine/nmv-gdb-engine.h                  |    6 ++++--
 src/dbgengine/nmv-i-debugger.h                  |    6 ++++--
 src/persp/dbgperspective/nmv-dbg-perspective.cc |   13 ++++++++-----
 tests/test-breakpoint.cc                        |    4 +++-
 tests/test-disassemble.cc                       |    3 ++-
 tests/test-types.cc                             |    2 +-
 tests/test-var-path-expr.cc                     |    3 ++-
 tests/test-watchpoint.cc                        |    3 ++-
 9 files changed, 33 insertions(+), 18 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 316db86..a9d1326 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -2739,14 +2739,15 @@ GDBEngine::~GDBEngine ()
 bool
 GDBEngine::load_program (const UString &a_prog,
                          const vector<UString> &a_args,
-                         const UString &a_working_dir)
+                         const UString &a_working_dir,
+                         bool a_force)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
     vector<UString> search_paths;
     UString tty_path;
     return load_program (a_prog, a_args, a_working_dir,
-                         search_paths, tty_path);
+                         search_paths, tty_path, a_force);
 }
 
 bool
@@ -2754,7 +2755,8 @@ GDBEngine::load_program (const UString &a_prog,
                          const vector<UString> &a_argv,
                          const UString &working_dir,
                          const vector<UString> &a_source_search_dirs,
-                         const UString &a_tty_path)
+                         const UString &a_tty_path,
+                         bool a_force)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
@@ -2773,7 +2775,8 @@ GDBEngine::load_program (const UString &a_prog,
 
         // In case we are restarting GDB after a crash, the command
         // queue might be stuck.  Let's restart it.
-        m_priv->reset_command_queue ();
+        if (a_force)
+            m_priv->reset_command_queue ();
 
         queue_command (Command ("set breakpoint pending on"));
 
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index 7f95fe6..964a641 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -246,13 +246,15 @@ public:
 
     bool load_program (const UString &a_prog,
                        const vector<UString> &a_args,
-                       const UString &a_working_dir);
+                       const UString &a_working_dir,
+		       bool a_force);
 
     bool load_program (const UString &a_prog,
                        const vector<UString> &a_argv,
                        const UString &working_dir,
                        const vector<UString> &a_source_search_dirs,
-                       const UString &a_tty_path);
+                       const UString &a_tty_path,
+		       bool a_force);
 
     void load_core_file (const UString &a_prog_file,
                          const UString &a_core_path);
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 6fce75f..4d54b6a 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -1047,14 +1047,16 @@ public:
 
     virtual bool load_program (const UString &a_prog,
                                const vector<UString> &a_args,
-                               const UString &a_working_dir) = 0;
+                               const UString &a_working_dir,
+                               bool a_force = false) = 0;
 
     virtual bool load_program
                 (const UString &a_prog,
                  const vector<UString> &a_argv,
                  const UString &working_dir,
                  const vector<UString> &a_source_search_dirs,
-                 const UString &a_tty_path="") = 0;
+                 const UString &a_tty_path,
+                 bool a_force = false) = 0;
 
     virtual void load_core_file (const UString &a_prog_file,
                                  const UString &a_core_file) = 0;
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 05ca088..0197027 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -555,7 +555,7 @@ public:
                           const map<UString, UString> &a_env,
                           const UString &a_cwd,
                           const vector<IDebugger::Breakpoint> &a_breaks,
-                          bool a_check_is_new_program = true,
+                          bool a_restarting = true,
                           bool a_close_opened_files = false);
 
     void attach_to_program ();
@@ -6150,7 +6150,7 @@ DBGPerspective::execute_program (const UString &a_prog,
 /// \param a_breaks the breakpoints to set prior to running the inferior.
 /// \param a_close_opened_files if true, close the files that have been
 ///        opened in the debugging perspective.
-/// \param a_check_is_new_program if true, be kind if the program to run
+/// \param a_restarting if true, be kind if the program to run
 ///        has be run previously. Be kind means things like do not re do
 ///        things that have been done already, e.g. re set breakpoints etc.
 ///        Otherwise, just ignore the fact that the program might have been
@@ -6162,7 +6162,7 @@ DBGPerspective::execute_program
                          const map<UString, UString> &a_env,
                          const UString &a_cwd,
                          const vector<IDebugger::Breakpoint> &a_breaks,
-                         bool a_check_is_new_program,
+                         bool a_restarting,
                          bool a_close_opened_files)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD
@@ -6221,7 +6221,7 @@ DBGPerspective::execute_program
     // that we are not debugging a new program.
     // In that case, we might want to keep things like breakpoints etc,
     // around.
-    bool is_new_program = (a_check_is_new_program)
+    bool is_new_program = a_restarting
         ? (prog != m_priv->prog_path)
         : true;
     LOG_DD ("is new prog: " << is_new_program);
@@ -6253,7 +6253,10 @@ DBGPerspective::execute_program
 
     if (dbg_engine->load_program (prog, a_args, a_cwd,
                                   source_search_dirs,
-                                  get_terminal_name ()) == false) {
+                                  get_terminal_name (),
+                                  a_restarting
+                                  ? true
+                                  : false) == false) {
         UString message;
         message.printf (_("Could not load program: %s"),
                         prog.c_str ());
diff --git a/tests/test-breakpoint.cc b/tests/test-breakpoint.cc
index a244143..2ad77c0 100644
--- a/tests/test-breakpoint.cc
+++ b/tests/test-breakpoint.cc
@@ -241,7 +241,9 @@ test_main (int argc, char *argv[])
 
     std::vector<UString> args, source_search_dir;
     source_search_dir.push_back (".");
-    debugger->load_program ("fooprog", args, ".", source_search_dir);
+    debugger->load_program ("fooprog", args, ".",
+                            source_search_dir, "",
+                            false);
     debugger->set_breakpoint ("main");
     debugger->set_breakpoint ("func1");
     debugger->set_breakpoint ("func2");
diff --git a/tests/test-disassemble.cc b/tests/test-disassemble.cc
index 24f0a1c..e21e507 100644
--- a/tests/test-disassemble.cc
+++ b/tests/test-disassemble.cc
@@ -162,7 +162,8 @@ test_main (int, char**)
     source_search_dir.push_back (".");
 
     // load the program to debug.
-    debugger->load_program (PROG_TO_DEBUG, args, ".", source_search_dir);
+    debugger->load_program (PROG_TO_DEBUG, args, ".",
+                            source_search_dir, "", false);
 
     // set a breakpoint in the main function.
     debugger->set_breakpoint ("main");
diff --git a/tests/test-types.cc b/tests/test-types.cc
index b855764..0e0d0be 100644
--- a/tests/test-types.cc
+++ b/tests/test-types.cc
@@ -99,7 +99,7 @@ test_main (int, char **)
     std::vector<UString> args, source_search_dir;
     source_search_dir.push_back (".");
 
-    debugger->load_program ("fooprog", args, ".", source_search_dir);
+    debugger->load_program ("fooprog", args, ".", source_search_dir, "", false);
     debugger->set_breakpoint ("func1");
     debugger->run ();
     loop->run ();
diff --git a/tests/test-var-path-expr.cc b/tests/test-var-path-expr.cc
index 8dda71d..870d694 100644
--- a/tests/test-var-path-expr.cc
+++ b/tests/test-var-path-expr.cc
@@ -140,7 +140,8 @@ test_main (int argc, char *argv[])
 
     std::vector<UString> args, source_search_dir;
     source_search_dir.push_back (".");
-    debugger->load_program ("fooprog", args, ".", source_search_dir);
+    debugger->load_program ("fooprog", args, ".",
+                            source_search_dir, "", false);
     debugger->set_breakpoint ("main");
     debugger->run ();
     loop->run ();
diff --git a/tests/test-watchpoint.cc b/tests/test-watchpoint.cc
index f24b6d1..c3e8785 100644
--- a/tests/test-watchpoint.cc
+++ b/tests/test-watchpoint.cc
@@ -102,7 +102,8 @@ test_main (int, char **)
 
     std::vector<UString> args, source_search_dir;
     source_search_dir.push_back (".");
-    debugger->load_program ("fooprog", args, ".", source_search_dir);
+    debugger->load_program ("fooprog", args, ".",
+                            source_search_dir, "", false);
     debugger->set_breakpoint ("main");
     debugger->set_breakpoint ("func1");
     debugger->run ();



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