[nemiver] Support ignore count at breakpoint setting time



commit f38248a2545ab9dee015a0fa457e3eb70f0b70c8
Author: Dodji Seketeli <dodji redhat com>
Date:   Tue Sep 15 16:00:43 2009 +0200

    Support ignore count at breakpoint setting time
    
    	* src/dbgengine/nmv-i-debugger.h (IDebugger::set_breakpoint): Add a
    	parameter to set ignore count.
    	* src/dbgengine/nmv-gdb-engine.h (GDBEngine::set_breakpoint):
    	Adjust.
    	* src/dbgengine/nmv-gdb-engine.cc (GDBEngine::set_breakpoint): Use
    	-break-insert now that it can fully replace the "break" cli command.
    	Let this function specify the ignore count as well.

 src/dbgengine/nmv-gdb-engine.cc |   32 ++++++++++++++++++--------------
 src/dbgengine/nmv-gdb-engine.h  |    2 ++
 src/dbgengine/nmv-i-debugger.h  |   12 ++++++++----
 3 files changed, 28 insertions(+), 18 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 37ac76d..ecad344 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3455,27 +3455,27 @@ void
 GDBEngine::set_breakpoint (const UString &a_path,
                            gint a_line_num,
                            const UString &a_condition,
+                           unsigned a_ignore_count,
                            const UString &a_cookie)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
-    //here, don't use the gdb/mi format, because only the cmd line
-    //format supports the 'set breakpoint pending' option that lets
-    //gdb set pending breakpoint when a breakpoint location doesn't exist.
-    //read http://sourceware.org/gdb/current/onlinedocs/gdb_6.html#SEC33
-    //Also, we don't neet to explicitely 'set breakpoint pending' to have it
-    //work. Even worse, setting it doesn't work.
-    UString break_cmd ("break ");
-    if (!a_path.empty ()) {
-        break_cmd += a_path + ":";
-    }
-    break_cmd += UString::from_int (a_line_num);
+    THROW_IF_FAIL (!a_path.empty ());
+
+    UString break_cmd ("-break-insert -f ");
     if (!a_condition.empty ()) {
         LOG_DD ("setting breakpoint with condition: " << a_condition);
-        break_cmd += " if " + a_condition;
+        break_cmd += " -c \"" + a_condition + "\"";
     } else {
         LOG_DD ("setting breakpoint without condition");
     }
+
+    break_cmd += " -i " + UString::from_int (a_ignore_count);
+
+    if (!a_path.empty ()) {
+        break_cmd += " " + a_path + ":";
+    }
+    break_cmd += UString::from_int (a_line_num);
     queue_command (Command ("set-breakpoint", break_cmd, a_cookie));
     list_breakpoints (a_cookie);
 }
@@ -3579,18 +3579,22 @@ GDBEngine::set_watchpoint (const UString &a_expression,
 void
 GDBEngine::set_breakpoint (const UString &a_func_name,
                            const UString &a_condition,
+                           unsigned a_ignore_count,
                            const UString &a_cookie)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
     UString break_cmd;
-    break_cmd += "break " + a_func_name;
+    break_cmd += "-break-insert -f ";
     if (!a_condition.empty ()) {
         LOG_DD ("setting breakpoint with condition: " << a_condition);
-        break_cmd += " if " + a_condition;
+        break_cmd += " -c \"" + a_condition + "\"";
     } else {
         LOG_DD ("setting breakpoint without condition");
     }
+    break_cmd += " -i " + UString::from_int (a_ignore_count);
+    break_cmd +=  " " + a_func_name;
+
     queue_command (Command ("set-breakpoint", break_cmd, a_cookie));
     list_breakpoints (a_cookie);
 }
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index 5327358..8f6f4ed 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -316,10 +316,12 @@ public:
     void set_breakpoint (const UString &a_path,
                          gint a_line_num,
                          const UString &a_condition,
+                         unsigned a_ignore_count,
                          const UString &a_cookie)  ;
 
     void set_breakpoint (const UString &a_func_name,
                          const UString &a_condition,
+                         unsigned a_ignore_count,
                          const UString &a_cookie)  ;
 
     void enable_breakpoint (gint a_break_num,
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 13bf46b..8f489fd 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -1026,13 +1026,17 @@ public:
     virtual void continue_to_position (const UString &a_path,
                                        gint a_line_num,
                                        const UString &a_cookie="") = 0;
+
     virtual void set_breakpoint (const UString &a_path,
                                  gint a_line_num,
-                                 const UString &a_condition="",
-                                 const UString &a_cookie="") = 0;
+                                 const UString &a_condition= "",
+                                 unsigned a_ignore_count = 0,
+                                 const UString &a_cookie = "") = 0;
+
     virtual void set_breakpoint (const UString &a_func_name,
-                                 const UString &a_condition="",
-                                 const UString &a_cookie="") = 0;
+                                 const UString &a_condition = "",
+                                 unsigned a_ignore_count = 0,
+                                 const UString &a_cookie = "") = 0;
 
     virtual void enable_breakpoint (gint a_break_num,
                                     const UString &a_cookie="") = 0;



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