[nemiver] Support breakpoint ignore counts (Closes: #588251)



commit 710160ccaa070b5c5454a13d879293b5c33ed421
Author: Dodji Seketeli <dodji redhat com>
Date:   Sun Aug 2 23:51:45 2009 +0200

    Support breakpoint ignore counts (Closes: #588251)
    
    	* src/dbgengine/nmv-i-debugger.h:
    	(IDebugger::BreakPoint::ignore_count): New accessor.
    	(IDebugger::set_breakpoint_ignore_count): New entry point.
    	(IDebugger::enable_breakpoint, IDebugger::disable_breakpoint,
    	IDebugger::delete_breakpoint): Move all the breakpoint related
    	functions to group them together.
    	* src/dbgengine/nmv-gdb-engine.h:
    	(GDBEngine::set_breakpoint_ignore_count): New entry point.
    	(GDBEngine::enable_breakpoint, GDBEngine::disable_breakpoint,
    	GDBEngine::delete_breakpoint): Move these functions around to group
    	them together.
    	* src/dbgengine/nmv-gdb-engine.cc:
    	(GDBEngine::enable_breakpoint, GDBEngine::disable_breakpoint,
    	GDBEngine::delete_breakpoint): Move these functions around to group
    	them together.
    	(GDBEngine::set_breakpoint_ignore_count): Implement this new entry
    	point.
    	* src/dbgengine/nmv-gdbmi-parser.cc:
    	(GDBMIParser::parse_result_record): Style cleanup.
    	(GDBMIParser::parse_breakpoint): Take the ignore count into account.
    	* src/persp/dbgperspective/nmv-breakpoints-view.cc:
    	(BPColumns): add ignore_count and is_standard fields.
    	(get_bp_cols): Renamed get_pb_columns into this.
    	(BreakpointsView::Priv::build_tree_view): Adjust.
    	Append an editable "ignore count" column. If the breakpoint is not
    	standard (e.g. if it's a watchpoint), do not let its "ignore count"
    	column  be editable. When the user edits the ignore count, call the
    	debugger engine to really set the ignore count.
    	(BreakpointsView::Priv::update_breakpoint): Update the ignore_count
    	and is_standard columns.
    	(BreakpointsView::Priv::on_breakpoint_ignore_count_edited): New
    	function.
    	(BreakpointsView::Priv::on_breakpoint_enable_toggled):Moved all the
    	signal handlers around to group them together.

 src/dbgengine/nmv-gdb-engine.cc                  |   89 ++++---
 src/dbgengine/nmv-gdb-engine.h                   |   25 +-
 src/dbgengine/nmv-gdbmi-parser.cc                |   10 +-
 src/dbgengine/nmv-i-debugger.h                   |   30 ++-
 src/persp/dbgperspective/nmv-breakpoints-view.cc |  316 +++++++++++++---------
 5 files changed, 283 insertions(+), 187 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index e900a5b..2d6066b 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3300,6 +3300,61 @@ GDBEngine::set_breakpoint (const UString &a_path,
 }
 
 void
+GDBEngine::enable_breakpoint (gint a_break_num,
+                              const UString &a_cookie)
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+    queue_command (Command ("enable-breakpoint",
+                            "-break-enable "
+                             + UString::from_int (a_break_num),
+                            a_cookie));
+    list_breakpoints (a_cookie);
+}
+
+void
+GDBEngine::disable_breakpoint (gint a_break_num,
+                               const UString &a_cookie)
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+    queue_command (Command ("disable-breakpoint",
+                            "-break-disable "
+                                + UString::from_int (a_break_num),
+                            a_cookie));
+    list_breakpoints (a_cookie);
+}
+
+void
+GDBEngine::set_breakpoint_ignore_count (gint a_break_num,
+                                        gint a_ignore_count,
+                                        const UString &a_cookie)
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+    RETURN_IF_FAIL (a_break_num >= 0 && a_ignore_count >= 0);
+
+    Command command ("set-breakpoint-ignore-count",
+                     "ignore " + UString::from_int (a_break_num)
+                     + " " + UString::from_int (a_ignore_count),
+                     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)
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+    queue_command (Command ("delete-breakpoint",
+                            "-break-delete "
+                            + a_path
+                            + ":"
+                            + UString::from_int (a_line_num),
+                            a_cookie));
+}
+
+void
 GDBEngine::set_watchpoint (const UString &a_expression,
                            bool a_write, bool a_read,
                            const UString &a_cookie)
@@ -3383,27 +3438,6 @@ GDBEngine::set_catch (const UString &a_event,
 }
 
 
-void
-GDBEngine::enable_breakpoint (gint a_break_num,
-                              const UString &a_cookie)
-{
-    LOG_FUNCTION_SCOPE_NORMAL_DD;
-    queue_command (Command ("enable-breakpoint",
-                            "-break-enable " + UString::from_int (a_break_num),
-                            a_cookie));
-    list_breakpoints(a_cookie);
-}
-
-void
-GDBEngine::disable_breakpoint (gint a_break_num,
-                               const UString &a_cookie)
-{
-    LOG_FUNCTION_SCOPE_NORMAL_DD;
-    queue_command (Command ("disable-breakpoint",
-                            "-break-disable " + UString::from_int (a_break_num),
-                            a_cookie));
-    list_breakpoints(a_cookie);
-}
 
 void
 GDBEngine::list_threads (const UString &a_cookie)
@@ -3425,19 +3459,6 @@ GDBEngine::select_thread (unsigned int a_thread_id,
                             a_cookie));
 }
 
-void
-GDBEngine::delete_breakpoint (const UString &a_path,
-                              gint a_line_num,
-                              const UString &a_cookie)
-{
-    LOG_FUNCTION_SCOPE_NORMAL_DD;
-    queue_command (Command ("delete-breakpoint",
-                            "-break-delete "
-                            + a_path
-                            + ":"
-                            + UString::from_int (a_line_num),
-                            a_cookie));
-}
 
 void
 GDBEngine::choose_function_overload (int a_overload_number,
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index a5a1c6b..9b813f6 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -76,7 +76,7 @@ public:
                                     got_overloads_choice_signal () const;
 
     sigc::signal<void, const IDebugger::BreakPoint&, int, const UString&>&
-                                            breakpoint_deleted_signal () const ;
+                                        breakpoint_deleted_signal () const ;
 
     sigc::signal<void, const IDebugger::BreakPoint&, int>&
                                         breakpoint_disabled_signal () const ;
@@ -311,6 +311,20 @@ public:
                          const UString &a_condition,
                          const UString &a_cookie)  ;
 
+    void enable_breakpoint (gint a_break_num,
+                            const UString &a_cookie="");
+
+    void disable_breakpoint (gint a_break_num,
+                             const UString &a_cookie="");
+
+    void set_breakpoint_ignore_count (gint a_break_num,
+                                      gint a_ignore_count,
+                                      const UString &a_cookie = "");
+
+    void delete_breakpoint (const UString &a_path,
+                            gint a_line_num,
+                            const UString &a_cookie) ;
+
     void set_watchpoint (const UString &a_expression,
                          bool a_write, bool a_read,
                          const UString &a_cookie);
@@ -322,15 +336,6 @@ public:
     void set_catch (const UString &a_event,
                     const UString &a_cookie)  ;
 
-    void enable_breakpoint (gint a_break_num,
-                            const UString &a_cookie="");
-
-    void disable_breakpoint (gint a_break_num,
-                             const UString &a_cookie="");
-
-    void delete_breakpoint (const UString &a_path,
-                            gint a_line_num,
-                            const UString &a_cookie) ;
 
     void choose_function_overload (int a_overload_number,
                                    const UString &a_cookie) ;
diff --git a/src/dbgengine/nmv-gdbmi-parser.cc b/src/dbgengine/nmv-gdbmi-parser.cc
index e83f0df..37352e0 100644
--- a/src/dbgengine/nmv-gdbmi-parser.cc
+++ b/src/dbgengine/nmv-gdbmi-parser.cc
@@ -1685,7 +1685,7 @@ fetch_gdbmi_result:
             }
 
             if (!m_priv->input.raw ().compare (cur, strlen (PREFIX_BKPT),
-                                                PREFIX_BKPT)) {
+                                                            PREFIX_BKPT)) {
                 IDebugger::BreakPoint breakpoint;
                 if (parse_breakpoint (cur, cur, breakpoint)) {
                     result_record.breakpoints ()[breakpoint.number ()] =
@@ -1744,15 +1744,14 @@ fetch_gdbmi_result:
                            GDBMI_PARSING_DOMAIN);
                 }
             } else if (!m_priv->input.raw ().compare (cur,
-                                                strlen (PREFIX_FRAME),
-                                                        PREFIX_FRAME)) {
+                                                      strlen (PREFIX_FRAME),
+                                                              PREFIX_FRAME)) {
                 IDebugger::Frame frame;
                 if (!parse_frame (cur, cur, frame)) {
                     LOG_PARSING_ERROR2 (cur);
                 } else {
                     LOG_D ("parsed result", GDBMI_PARSING_DOMAIN);
                     result_record.current_frame_in_core_stack_trace (frame);
-                    //current_frame_signal.emit (frame, "");
                 }
             } else if (!m_priv->input.raw ().compare (cur, strlen (PREFIX_DEPTH),
                                                       PREFIX_DEPTH)) {
@@ -2109,6 +2108,9 @@ GDBMIParser::parse_breakpoint (Glib::ustring::size_type a_from,
         a_bkpt.condition (iter->second);
     }
     a_bkpt.nb_times_hit (atoi (attrs["times"].c_str ()));
+    if ((iter = attrs.find ("ignore")) != null_iter) {
+        a_bkpt.ignore_count (atoi (iter->second.c_str ()));
+    }
 
     string type = attrs["type"];
     if (type.find ("breakpoint") != type.npos)
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 8b5f62e..3b453f5 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -98,6 +98,7 @@ public:
         Type m_type;
         int m_line;
         int m_nb_times_hit;
+        int m_ignore_count;
 
     public:
         BreakPoint () {clear ();}
@@ -137,6 +138,9 @@ public:
         int nb_times_hit () const {return m_nb_times_hit;}
         void nb_times_hit (int a_nb) {m_nb_times_hit = a_nb;}
 
+        int ignore_count () const {return m_ignore_count;}
+        void ignore_count (int a) {m_ignore_count = a;}
+
         bool is_pending ()
         {
             if (m_address == "<PENDING>") {
@@ -162,6 +166,7 @@ public:
             m_line = 0;
             m_condition.clear ();
             m_nb_times_hit = 0;
+            m_ignore_count = 0;
         }
     };//end class BreakPoint
 
@@ -1026,6 +1031,21 @@ public:
                                  const UString &a_condition="",
                                  const UString &a_cookie="") = 0;
 
+    virtual void enable_breakpoint (gint a_break_num,
+                                    const UString &a_cookie="") = 0;
+
+    virtual void disable_breakpoint (gint a_break_num,
+                                     const UString &a_cookie="") = 0;
+
+    virtual void set_breakpoint_ignore_count
+                                        (gint a_break_num,
+                                         gint a_ignore_count,
+                                         const UString &a_cookie = "") = 0;
+
+    virtual void delete_breakpoint (const UString &a_path,
+                                    gint a_line_num,
+                                    const UString &a_cookie="") = 0;
+
     virtual void set_watchpoint (const UString &a_expression,
                                  bool a_write = true,
                                  bool a_read = false,
@@ -1038,16 +1058,6 @@ public:
 
     virtual const map<int, BreakPoint>& get_cached_breakpoints () = 0;
 
-    virtual void enable_breakpoint (gint a_break_num,
-                                    const UString &a_cookie="") = 0;
-
-    virtual void disable_breakpoint (gint a_break_num,
-                                     const UString &a_cookie="") = 0;
-
-    virtual void delete_breakpoint (const UString &a_path,
-                                    gint a_line_num,
-                                    const UString &a_cookie="") = 0;
-
     virtual void choose_function_overload (int a_overload_number,
                                            const UString &a_cookie="") = 0;
 
diff --git a/src/persp/dbgperspective/nmv-breakpoints-view.cc b/src/persp/dbgperspective/nmv-breakpoints-view.cc
index ed19ec6..a8e112f 100644
--- a/src/persp/dbgperspective/nmv-breakpoints-view.cc
+++ b/src/persp/dbgperspective/nmv-breakpoints-view.cc
@@ -46,7 +46,9 @@ struct BPColumns : public Gtk::TreeModelColumnRecord {
     Gtk::TreeModelColumn<Glib::ustring> type;
     Gtk::TreeModelColumn<int> hits;
     Gtk::TreeModelColumn<Glib::ustring> expression;
+    Gtk::TreeModelColumn<int> ignore_count;
     Gtk::TreeModelColumn<IDebugger::BreakPoint> breakpoint;
+    Gtk::TreeModelColumn<bool> is_standard;
 
     BPColumns ()
     {
@@ -61,11 +63,13 @@ struct BPColumns : public Gtk::TreeModelColumnRecord {
         add (type);
         add (hits);
         add (expression);
+        add (ignore_count);
+        add (is_standard);
     }
 };//end Cols
 
 static BPColumns&
-get_bp_columns ()
+get_bp_cols ()
 {
     static BPColumns s_cols;
     return s_cols;
@@ -114,29 +118,47 @@ public:
     {
         if (tree_view) {return;}
         //create a default tree store and a tree view
-        list_store = Gtk::ListStore::create (get_bp_columns ());
+        list_store = Gtk::ListStore::create (get_bp_cols ());
         tree_view.reset (new Gtk::TreeView (list_store));
         tree_view->get_selection ()->set_mode (Gtk::SELECTION_MULTIPLE);
 
         //create the columns of the tree view
-        tree_view->append_column_editable ("", get_bp_columns ().enabled);
-        tree_view->append_column (_("ID"), get_bp_columns ().id);
-        tree_view->append_column (_("Filename"), get_bp_columns ().filename);
-        tree_view->append_column (_("Line"), get_bp_columns ().line);
-        tree_view->append_column (_("Function"), get_bp_columns ().function);
-        tree_view->append_column (_("Address"), get_bp_columns ().address);
-        tree_view->append_column (_("Condition"), get_bp_columns ().condition);
-        tree_view->append_column (_("Type"), get_bp_columns ().type);
-        tree_view->append_column (_("Hits"), get_bp_columns ().hits);
-        tree_view->append_column (_("Expression"), get_bp_columns ().expression);
+        tree_view->append_column_editable ("", get_bp_cols ().enabled);
+        tree_view->append_column (_("ID"), get_bp_cols ().id);
+        tree_view->append_column (_("Filename"), get_bp_cols ().filename);
+        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 (_("Type"), get_bp_cols ().type);
+        tree_view->append_column (_("Hits"), get_bp_cols ().hits);
+        tree_view->append_column (_("Expression"),
+                                  get_bp_cols ().expression);
+        tree_view->append_column_editable (_("Ignore count"),
+                                           get_bp_cols ().ignore_count);
+
         Gtk::CellRendererToggle *enabled_toggle =
             dynamic_cast<Gtk::CellRendererToggle*>
-                                    (tree_view->get_column_cell_renderer(0));
+                                    (tree_view->get_column_cell_renderer (0));
         if (enabled_toggle) {
-            enabled_toggle->signal_toggled ().connect (sigc::mem_fun (*this,
-                        &BreakpointsView::Priv::on_breakpoint_enable_toggled));
+            enabled_toggle->signal_toggled ().connect
+                (sigc::mem_fun
+                 (*this,
+                  &BreakpointsView::Priv::on_breakpoint_enable_toggled));
         }
 
+        Gtk::CellRendererText *r =
+            dynamic_cast<Gtk::CellRendererText*>
+                (tree_view->get_column_cell_renderer (10));
+        r->signal_edited ().connect
+            (sigc::mem_fun
+             (*this,
+              &BreakpointsView::Priv::on_breakpoint_ignore_count_edited));
+        Gtk::TreeViewColumn *c = tree_view->get_column (10);
+        THROW_IF_FAIL (c);
+        c->add_attribute (r->property_editable (),
+                          get_bp_cols ().is_standard);
+
         // we must handle the button press event before the default button
         // handler since there are cases when we need to prevent the default
         // handler from running
@@ -162,23 +184,6 @@ public:
         return is_visible;
     }
 
-    void on_breakpoint_enable_toggled (const Glib::ustring& path)
-    {
-        THROW_IF_FAIL (tree_view);
-        Gtk::TreeModel::iterator tree_iter =
-                                    tree_view->get_model ()->get_iter (path);
-        if (tree_iter) {
-            if ((*tree_iter)[get_bp_columns ().enabled]) {
-                debugger->enable_breakpoint
-                                    ((*tree_iter)[get_bp_columns ().id]);
-            } else {
-                debugger->disable_breakpoint
-                                    ((*tree_iter)[get_bp_columns ().id]);
-            }
-        }
-    }
-
-
     void set_breakpoints
         (const std::map<int, IDebugger::BreakPoint> &a_breakpoints)
     {
@@ -247,7 +252,7 @@ public:
         for (iter = list_store->children ().begin ();
              iter != list_store->children ().end ();
              ++iter) {
-            if ((*iter)[get_bp_columns ().id] == a_breakpoint.number ()) {
+            if ((*iter)[get_bp_cols ().id] == a_breakpoint.number ()) {
                 return iter;
             }
         }
@@ -258,26 +263,31 @@ public:
     void update_breakpoint (Gtk::TreeModel::iterator& a_iter,
                             const IDebugger::BreakPoint &a_breakpoint)
     {
-        (*a_iter)[get_bp_columns ().breakpoint] = a_breakpoint;
-        (*a_iter)[get_bp_columns ().enabled] = a_breakpoint.enabled ();
-        (*a_iter)[get_bp_columns ().id] = a_breakpoint.number ();
-        (*a_iter)[get_bp_columns ().function] = a_breakpoint.function ();
-        (*a_iter)[get_bp_columns ().address] = a_breakpoint.address ();
-        (*a_iter)[get_bp_columns ().filename] = a_breakpoint.file_name ();
-        (*a_iter)[get_bp_columns ().line] = a_breakpoint.line ();
-        (*a_iter)[get_bp_columns ().condition] = a_breakpoint.condition ();
-        (*a_iter)[get_bp_columns ().expression] = a_breakpoint.expression ();
+        (*a_iter)[get_bp_cols ().breakpoint] = a_breakpoint;
+        (*a_iter)[get_bp_cols ().enabled] = a_breakpoint.enabled ();
+        (*a_iter)[get_bp_cols ().id] = a_breakpoint.number ();
+        (*a_iter)[get_bp_cols ().function] = a_breakpoint.function ();
+        (*a_iter)[get_bp_cols ().address] = a_breakpoint.address ();
+        (*a_iter)[get_bp_cols ().filename] = a_breakpoint.file_name ();
+        (*a_iter)[get_bp_cols ().line] = a_breakpoint.line ();
+        (*a_iter)[get_bp_cols ().condition] = a_breakpoint.condition ();
+        (*a_iter)[get_bp_cols ().expression] = a_breakpoint.expression ();
+        (*a_iter)[get_bp_cols ().ignore_count] =
+                                        a_breakpoint.ignore_count ();
+
+        (*a_iter)[get_bp_cols ().is_standard] = false;
         switch (a_breakpoint.type ()) {
             case IDebugger::BreakPoint::STANDARD_BREAKPOINT_TYPE:
-                (*a_iter)[get_bp_columns ().type] = _("breakpoint");
+                (*a_iter)[get_bp_cols ().type] = _("breakpoint");
+                (*a_iter)[get_bp_cols ().is_standard] = true;
                 break;
             case IDebugger::BreakPoint::WATCHPOINT_TYPE:
-                (*a_iter)[get_bp_columns ().type] = _("watchtpoint");
+                (*a_iter)[get_bp_cols ().type] = _("watchtpoint");
                 break;
             default:
-                (*a_iter)[get_bp_columns ().type] = _("unknown");
+                (*a_iter)[get_bp_cols ().type] = _("unknown");
         }
-        (*a_iter)[get_bp_columns ().hits] = a_breakpoint.nb_times_hit ();
+        (*a_iter)[get_bp_cols ().hits] = a_breakpoint.nb_times_hit ();
     }
 
     Gtk::TreeModel::iterator append_breakpoint
@@ -295,6 +305,103 @@ public:
         debugger->list_breakpoints ();
     }
 
+    Gtk::Widget* load_menu (UString a_filename, UString a_widget_name)
+    {
+        NEMIVER_TRY
+        string relative_path = Glib::build_filename ("menus", a_filename);
+        string absolute_path;
+        THROW_IF_FAIL (perspective.build_absolute_resource_path
+                (Glib::locale_to_utf8 (relative_path), absolute_path));
+
+        workbench.get_ui_manager ()->add_ui_from_file
+                                        (Glib::locale_to_utf8 (absolute_path));
+        NEMIVER_CATCH
+        return workbench.get_ui_manager ()->get_widget (a_widget_name);
+    }
+
+    Gtk::Widget* get_breakpoints_menu ()
+    {
+        THROW_IF_FAIL (breakpoints_menu);
+        return breakpoints_menu;
+    }
+
+    void popup_breakpoints_view_menu (GdkEventButton *a_event)
+    {
+        THROW_IF_FAIL (a_event);
+        THROW_IF_FAIL (tree_view);
+        Gtk::Menu *menu = dynamic_cast<Gtk::Menu*> (get_breakpoints_menu ());
+        THROW_IF_FAIL (menu);
+        menu->popup (a_event->button, a_event->time);
+    }
+
+    void init_actions()
+    {
+        static ui_utils::ActionEntry s_breakpoints_action_entries [] = {
+            {
+                "DeleteBreakpointMenuItemAction",
+                Gtk::Stock::DELETE,
+                _("_Delete"),
+                _("Remove this breakpoint"),
+                sigc::mem_fun (*this, &Priv::on_breakpoint_delete_action),
+                ui_utils::ActionEntry::DEFAULT,
+                "",
+                false
+            },
+            {
+                "GoToSourceBreakpointMenuItemAction",
+                Gtk::Stock::JUMP_TO,
+                _("_Go to Source"),
+                _("Find this breakpoint in the source editor"),
+                sigc::mem_fun (*this,
+                        &Priv::on_breakpoint_go_to_source_action),
+                ui_utils::ActionEntry::DEFAULT,
+                "",
+                false
+            }
+        };
+
+        breakpoints_action_group =
+            Gtk::ActionGroup::create ("breakpoints-action-group");
+        breakpoints_action_group->set_sensitive (true);
+
+        int num_actions =
+            sizeof (s_breakpoints_action_entries)
+                /
+            sizeof (ui_utils::ActionEntry);
+
+        ui_utils::add_action_entries_to_action_group
+                        (s_breakpoints_action_entries, num_actions,
+                         breakpoints_action_group);
+
+        workbench.get_ui_manager ()->insert_action_group
+                                                (breakpoints_action_group);
+    }
+
+    void re_init ()
+    {
+        debugger->list_breakpoints ();
+    }
+
+    void erase_breakpoint (int a_bp_num)
+    {
+
+        LOG_DD ("asked to erase bp num:" << (int) a_bp_num);
+
+        Gtk::TreeModel::iterator iter;
+        for (iter = list_store->children ().begin ();
+             iter != list_store->children ().end ();
+             ++iter) {
+            if ((*iter)[get_bp_cols ().id] == a_bp_num) {
+                break;
+            }
+        }
+
+        if (iter != list_store->children ().end ()) {
+            LOG_DD ("erased bp");
+            list_store->erase (iter);
+        }
+    }
+
     void on_debugger_breakpoints_set_signal
                             (const map<int, IDebugger::BreakPoint> &a_breaks,
                              const UString &a_cookie)
@@ -345,7 +452,7 @@ public:
         for (Gtk::TreeModel::iterator iter = list_store->children ().begin ();
              iter != list_store->children ().end ();
              ++iter) {
-            if ((*iter)[get_bp_columns ().id] == a_break_number) {
+            if ((*iter)[get_bp_cols ().id] == a_break_number) {
                 iters_to_erase.push_back (iter);
                 break;
             }
@@ -439,7 +546,7 @@ public:
         Gtk::TreeModel::iterator tree_iter = list_store->get_iter (paths[0]);
         if (tree_iter) {
             go_to_breakpoint_signal.emit
-                            ((*tree_iter)[get_bp_columns ().breakpoint]);
+                            ((*tree_iter)[get_bp_cols ().breakpoint]);
         }
     }
 
@@ -457,7 +564,7 @@ public:
             tree_iter = list_store->get_iter (*it);
             if (tree_iter) {
                 debugger->delete_breakpoint
-                                ((*tree_iter)[get_bp_columns ().id]);
+                                ((*tree_iter)[get_bp_cols ().id]);
             }
         }
     }
@@ -482,101 +589,52 @@ public:
         return false;
     }
 
-    Gtk::Widget* load_menu (UString a_filename, UString a_widget_name)
+    void on_breakpoint_enable_toggled (const Glib::ustring& path)
     {
         NEMIVER_TRY
-        string relative_path = Glib::build_filename ("menus", a_filename);
-        string absolute_path;
-        THROW_IF_FAIL (perspective.build_absolute_resource_path
-                (Glib::locale_to_utf8 (relative_path), absolute_path));
 
-        workbench.get_ui_manager ()->add_ui_from_file
-                                        (Glib::locale_to_utf8 (absolute_path));
-        NEMIVER_CATCH
-        return workbench.get_ui_manager ()->get_widget (a_widget_name);
-    }
-
-    Gtk::Widget* get_breakpoints_menu ()
-    {
-        THROW_IF_FAIL (breakpoints_menu);
-        return breakpoints_menu;
-    }
-
-    void popup_breakpoints_view_menu (GdkEventButton *a_event)
-    {
-        THROW_IF_FAIL (a_event);
         THROW_IF_FAIL (tree_view);
-        Gtk::Menu *menu = dynamic_cast<Gtk::Menu*> (get_breakpoints_menu ());
-        THROW_IF_FAIL (menu);
-        menu->popup (a_event->button, a_event->time);
-    }
-
-    void init_actions()
-    {
-        static ui_utils::ActionEntry s_breakpoints_action_entries [] = {
-            {
-                "DeleteBreakpointMenuItemAction",
-                Gtk::Stock::DELETE,
-                _("_Delete"),
-                _("Remove this breakpoint"),
-                sigc::mem_fun (*this, &Priv::on_breakpoint_delete_action),
-                ui_utils::ActionEntry::DEFAULT,
-                "",
-                false
-            },
-            {
-                "GoToSourceBreakpointMenuItemAction",
-                Gtk::Stock::JUMP_TO,
-                _("_Go to Source"),
-                _("Find this breakpoint in the source editor"),
-                sigc::mem_fun (*this,
-                        &Priv::on_breakpoint_go_to_source_action),
-                ui_utils::ActionEntry::DEFAULT,
-                "",
-                false
+        Gtk::TreeModel::iterator tree_iter =
+                                    tree_view->get_model ()->get_iter (path);
+        if (tree_iter) {
+            if ((*tree_iter)[get_bp_cols ().enabled]) {
+                debugger->enable_breakpoint
+                                    ((*tree_iter)[get_bp_cols ().id]);
+            } else {
+                debugger->disable_breakpoint
+                                    ((*tree_iter)[get_bp_cols ().id]);
             }
-        };
-
-        breakpoints_action_group =
-            Gtk::ActionGroup::create ("breakpoints-action-group");
-        breakpoints_action_group->set_sensitive (true);
-
-        int num_actions =
-            sizeof (s_breakpoints_action_entries)
-                /
-            sizeof (ui_utils::ActionEntry);
-
-        ui_utils::add_action_entries_to_action_group
-                        (s_breakpoints_action_entries, num_actions,
-                         breakpoints_action_group);
+        }
 
-        workbench.get_ui_manager ()->insert_action_group
-                                                (breakpoints_action_group);
+        NEMIVER_CATCH
     }
 
-    void re_init ()
+    void on_breakpoint_ignore_count_edited (const Glib::ustring &a_path,
+                                            const Glib::ustring &a_text)
     {
-        debugger->list_breakpoints ();
-    }
+        NEMIVER_TRY
 
-    void erase_breakpoint (int a_bp_num)
-    {
+        THROW_IF_FAIL (tree_view);
 
-        LOG_DD ("asked to erase bp num:" << (int) a_bp_num);
+        Gtk::TreeModel::iterator it =
+                                tree_view->get_model ()->get_iter (a_path);
 
-        Gtk::TreeModel::iterator iter;
-        for (iter = list_store->children ().begin ();
-             iter != list_store->children ().end ();
-             ++iter) {
-            if ((*iter)[get_bp_columns ().id] == a_bp_num) {
-                break;
-            }
+        bool is_standard_bp = false; //true if this is e.g. no watchpoint.
+        if (it
+            && (((IDebugger::BreakPoint)(*it)[get_bp_cols ().breakpoint])).
+                type () == IDebugger::BreakPoint::STANDARD_BREAKPOINT_TYPE) {
+            is_standard_bp = true;
+            LOG_DD ("breakpoint is standard");
+        } else {
+            LOG_DD ("breakpoint is *NOT* standard");
         }
 
-        if (iter != list_store->children ().end ()) {
-            LOG_DD ("erased bp");
-            list_store->erase (iter);
+        if (is_standard_bp) {
+            int count = atoi (a_text.raw ().c_str ());
+            debugger->set_breakpoint_ignore_count ((*it)[get_bp_cols ().id],
+                                                   count);
         }
+        NEMIVER_CATCH
     }
 
 };//end class BreakpointsView::Priv



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