[nemiver] Support editing breakpoint condition



commit 88eca084ec4341b3e1ab6b8f912b7655ed03d27d
Author: Dodji Seketeli <dodji redhat com>
Date:   Tue Sep 15 15:11:38 2009 +0200

    Support editing breakpoint condition
    
    	* src/dbgengine/nmv-i-debugger.h (BreakPoint::clear): Set
    	BreakPoint::type to its proper default value.
    	(IDebugger::set_breakpoint_condition): Declare new entry point.
    	* src/dbgengine/nmv-gdb-engine.h (GDBEngine::set_breakpoint_condition):
    	Likewise.
    	* src/dbgengine/nmv-gdb-engine.cc (GDBEngine::set_breakpoint_condition):
    	Define new entry point.
    	* src/persp/dbgperspective/nmv-breakpoints-view.cc:
    	(BreakpointsView::Priv::build_tree_view): Make the cell of the
    	breakpoint condition editable and update the breakpoint condition
    	when the value changes.
    	(BreakpointsView::Priv::on_breakpoint_condition_edited): New method.

 src/dbgengine/nmv-gdb-engine.cc                  |   16 ++++++++++
 src/dbgengine/nmv-gdb-engine.h                   |    4 ++
 src/dbgengine/nmv-i-debugger.h                   |    5 +++
 src/persp/dbgperspective/nmv-breakpoints-view.cc |   33 ++++++++++++++++++++--
 4 files changed, 55 insertions(+), 3 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 59862fa..f0fb9b4 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3523,6 +3523,22 @@ GDBEngine::set_breakpoint_ignore_count (gint a_break_num,
 }
 
 void
+GDBEngine::set_breakpoint_condition (gint a_break_num,
+                                     const UString &a_condition,
+                                     const UString &a_cookie)
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+    RETURN_IF_FAIL (a_break_num >= 0);
+
+    Command command ("set-breakpoint-condition",
+                     "-break-condition " + UString::from_int (a_break_num)
+                     + " " + a_condition, a_cookie);
+    queue_command (command);
+    list_breakpoints (a_cookie);
+}
+
+void
 GDBEngine::delete_breakpoint (const UString &a_path,
                               gint a_line_num,
                               const UString &a_cookie)
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index 7543306..5327358 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -332,6 +332,10 @@ public:
                                       gint a_ignore_count,
                                       const UString &a_cookie = "");
 
+    void set_breakpoint_condition (gint a_break_num,
+                                   const UString &a_condition,
+                                   const UString &a_cookie);
+
     void delete_breakpoint (const UString &a_path,
                             gint a_line_num,
                             const UString &a_cookie) ;
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 73155e3..13bf46b 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -157,6 +157,7 @@ public:
         /// \brief clear this instance of breakpoint
         void clear ()
         {
+            m_type = STANDARD_BREAKPOINT_TYPE;
             m_number = 0;
             m_enabled = false;
             m_address.clear ();
@@ -1044,6 +1045,10 @@ public:
                                          gint a_ignore_count,
                                          const UString &a_cookie = "") = 0;
 
+    virtual void set_breakpoint_condition (gint a_break_num,
+                                           const UString &a_condition,
+                                           const UString &a_cookie = "") = 0;
+
     virtual void delete_breakpoint (const UString &a_path,
                                     gint a_line_num,
                                     const UString &a_cookie="") = 0;
diff --git a/src/persp/dbgperspective/nmv-breakpoints-view.cc b/src/persp/dbgperspective/nmv-breakpoints-view.cc
index a8e112f..98369a8 100644
--- a/src/persp/dbgperspective/nmv-breakpoints-view.cc
+++ b/src/persp/dbgperspective/nmv-breakpoints-view.cc
@@ -129,7 +129,8 @@ public:
         tree_view->append_column (_("Line"), get_bp_cols ().line);
         tree_view->append_column (_("Function"), get_bp_cols ().function);
         tree_view->append_column (_("Address"), get_bp_cols ().address);
-        tree_view->append_column (_("Condition"), get_bp_cols ().condition);
+        tree_view->append_column_editable (_("Condition"),
+                                           get_bp_cols ().condition);
         tree_view->append_column (_("Type"), get_bp_cols ().type);
         tree_view->append_column (_("Hits"), get_bp_cols ().hits);
         tree_view->append_column (_("Expression"),
@@ -154,10 +155,16 @@ public:
             (sigc::mem_fun
              (*this,
               &BreakpointsView::Priv::on_breakpoint_ignore_count_edited));
-        Gtk::TreeViewColumn *c = tree_view->get_column (10);
+
+        /*Gtk::TreeViewColumn *c = tree_view->get_column (10);
         THROW_IF_FAIL (c);
         c->add_attribute (r->property_editable (),
-                          get_bp_cols ().is_standard);
+                          get_bp_cols ().is_standard);*/
+
+        r = dynamic_cast<Gtk::CellRendererText*>
+                (tree_view->get_column_cell_renderer (6));
+        r->signal_edited ().connect (sigc::mem_fun
+             (*this, &BreakpointsView::Priv::on_breakpoint_condition_edited));
 
         // we must handle the button press event before the default button
         // handler since there are cases when we need to prevent the default
@@ -637,6 +644,26 @@ public:
         NEMIVER_CATCH
     }
 
+    void on_breakpoint_condition_edited (const Glib::ustring &a_path,
+                                         const Glib::ustring &a_text)
+    {
+        NEMIVER_TRY
+
+        Gtk::TreeModel::iterator it = tree_view->get_model ()->get_iter (a_path);
+
+        bool is_standard_bp =
+            (((IDebugger::BreakPoint)(*it)[get_bp_cols ().breakpoint]).type ()
+             == IDebugger::BreakPoint::STANDARD_BREAKPOINT_TYPE)
+            ? true
+            : false;
+
+        if (is_standard_bp)
+            debugger->set_breakpoint_condition ((*it)[get_bp_cols ().id],
+                                                a_text);
+
+        NEMIVER_CATCH
+    }
+
 };//end class BreakpointsView::Priv
 
 BreakpointsView::BreakpointsView (IWorkbench& a_workbench,



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