[nemiver/count-point: 3/14] Support countpoint/breakpoint toggling
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/count-point: 3/14] Support countpoint/breakpoint toggling
- Date: Sun, 10 Oct 2010 16:36:23 +0000 (UTC)
commit a5c9a9f77edb3d6fee70252fbbd6adc5e6863817
Author: Dodji Seketeli <dodji seketeli org>
Date: Wed Sep 29 00:09:52 2010 +0200
Support countpoint/breakpoint toggling
* src/dbgengine/nmv-i-debugger.h (enable_countpoint): New
interface.
* src/dbgengine/nmv-gdb-engine.h (GDBEngine::enable_countpoint):
Likewise.
* src/dbgengine/nmv-gdb-engine.cc (GDBEngine::enable_countpoint):
Implement it.
* src/persp/dbgperspective/nmv-breakpoints-view.cc
(BPColumns::is_countpoint): New member.
(BPColumns::INDEXES): New enum to index the different columns of
the breakpoint treeview.
(BPColumns::BPColumns): Add the is_countpoint column's definition.
(BreakpointsView::Priv::build_tree_view): Use BPClumns::INDEXES
enum fields to index the columns now. Add a "Toggle countpoint"
column with a toggle button. When the user clicks on it, it
makes the breakpoint become a countpoint or the other way around.
(BreakpointsView::Priv::on_countpoint_toggled): New slot.
src/dbgengine/nmv-gdb-engine.cc | 24 +++++++++
src/dbgengine/nmv-gdb-engine.h | 4 ++
src/dbgengine/nmv-i-debugger.h | 4 ++
src/persp/dbgperspective/nmv-breakpoints-view.cc | 59 ++++++++++++++++++++--
4 files changed, 87 insertions(+), 4 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 10fad81..5711fe3 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3757,6 +3757,30 @@ GDBEngine::set_breakpoint_condition (gint a_break_num,
}
void
+GDBEngine::enable_countpoint (gint a_break_num,
+ bool a_yes,
+ const UString &a_cookie)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ typedef map<int, IDebugger::Breakpoint> BPMap;
+ BPMap &bp_cache = get_cached_breakpoints ();
+ BPMap::const_iterator nil = bp_cache.end ();
+
+ BPMap::iterator it = bp_cache.find (a_break_num);
+ if (it == nil)
+ return;
+
+ if (a_yes && it->second.type ()
+ == IDebugger::Breakpoint::STANDARD_BREAKPOINT_TYPE)
+ it->second.type (IDebugger::Breakpoint::COUNTPOINT_TYPE);
+ else
+ it->second.type (IDebugger::Breakpoint::STANDARD_BREAKPOINT_TYPE);
+
+ breakpoints_set_signal ().emit (get_cached_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 fbc6582..6202d2e 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -354,6 +354,10 @@ public:
const UString &a_condition,
const UString &a_cookie);
+ void enable_countpoint (gint a_break_num,
+ bool a_flag,
+ 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 f408942..9f49101 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -1114,6 +1114,10 @@ public:
const UString &a_condition,
const UString &a_cookie = "") = 0;
+ virtual void enable_countpoint (gint a_break_num,
+ bool a_flag,
+ 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 0f1651d..8452fe9 100644
--- a/src/persp/dbgperspective/nmv-breakpoints-view.cc
+++ b/src/persp/dbgperspective/nmv-breakpoints-view.cc
@@ -32,6 +32,7 @@
#include "nmv-ui-utils.h"
#include "nmv-i-workbench.h"
#include "nmv-i-perspective.h"
+#include "nmv-debugger-utils.h"
namespace nemiver {
@@ -43,6 +44,7 @@ struct BPColumns : public Gtk::TreeModelColumnRecord {
Gtk::TreeModelColumn<Glib::ustring> function;
Gtk::TreeModelColumn<int> line;
Gtk::TreeModelColumn<Glib::ustring> condition;
+ Gtk::TreeModelColumn<bool> is_countpoint;
Gtk::TreeModelColumn<Glib::ustring> type;
Gtk::TreeModelColumn<int> hits;
Gtk::TreeModelColumn<Glib::ustring> expression;
@@ -50,6 +52,21 @@ struct BPColumns : public Gtk::TreeModelColumnRecord {
Gtk::TreeModelColumn<IDebugger::Breakpoint> breakpoint;
Gtk::TreeModelColumn<bool> is_standard;
+ enum INDEXES {
+ ENABLE_INDEX = 0,
+ ID_INDEX,
+ FILENAME_INDEX,
+ LINE_INDEX,
+ FUNCTION_INDEX,
+ ADDRESS_INDEX,
+ CONDITION_INDEX,
+ IS_COUNTPOINT_INDEX,
+ TYPE_INDEX,
+ HITS_INDEX,
+ EXPRESSION_INDEX,
+ IGNORE_COUNT_INDEX
+ };
+
BPColumns ()
{
add (id);
@@ -60,6 +77,7 @@ struct BPColumns : public Gtk::TreeModelColumnRecord {
add (line);
add (breakpoint);
add (condition);
+ add (is_countpoint);
add (type);
add (hits);
add (expression);
@@ -132,6 +150,8 @@ public:
tree_view->append_column (_("Address"), get_bp_cols ().address);
tree_view->append_column_editable (_("Condition"),
get_bp_cols ().condition);
+ tree_view->append_column_editable (_("Toggle countpoint"),
+ get_bp_cols ().is_countpoint);
tree_view->append_column (_("Type"), get_bp_cols ().type);
tree_view->append_column (_("Hits"), get_bp_cols ().hits);
tree_view->append_column (_("Expression"),
@@ -148,24 +168,33 @@ public:
Gtk::CellRendererToggle *enabled_toggle =
dynamic_cast<Gtk::CellRendererToggle*>
- (tree_view->get_column_cell_renderer (0));
+ (tree_view->get_column_cell_renderer (BPColumns::ENABLE_INDEX));
if (enabled_toggle) {
enabled_toggle->signal_toggled ().connect
(sigc::mem_fun
(*this,
&BreakpointsView::Priv::on_breakpoint_enable_toggled));
}
+ Gtk::CellRendererToggle *countpoint_toggle =
+ dynamic_cast<Gtk::CellRendererToggle*>
+ (tree_view->get_column_cell_renderer (BPColumns::IS_COUNTPOINT_INDEX));
+ if (countpoint_toggle) {
+ countpoint_toggle->signal_toggled ().connect
+ (sigc::mem_fun (*this,
+ &BreakpointsView::Priv::on_countpoint_toggled));
+
+ }
Gtk::CellRendererText *r =
dynamic_cast<Gtk::CellRendererText*>
- (tree_view->get_column_cell_renderer (10));
+ (tree_view->get_column_cell_renderer (BPColumns::IGNORE_COUNT_INDEX));
r->signal_edited ().connect
(sigc::mem_fun
(*this,
&BreakpointsView::Priv::on_breakpoint_ignore_count_edited));
r = dynamic_cast<Gtk::CellRendererText*>
- (tree_view->get_column_cell_renderer (6));
+ (tree_view->get_column_cell_renderer (BPColumns::CONDITION_INDEX));
r->signal_edited ().connect
(sigc::mem_fun
(*this, &BreakpointsView::Priv::on_breakpoint_condition_edited));
@@ -289,8 +318,10 @@ public:
(*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;
+ (*a_iter)[get_bp_cols ().is_countpoint] =
+ debugger_utils::is_countpoint (a_breakpoint);
+
switch (a_breakpoint.type ()) {
case IDebugger::Breakpoint::STANDARD_BREAKPOINT_TYPE:
(*a_iter)[get_bp_cols ().type] = _("breakpoint");
@@ -627,6 +658,26 @@ public:
NEMIVER_CATCH
}
+ void on_countpoint_toggled (const Glib::ustring& path)
+ {
+ NEMIVER_TRY;
+
+ 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_cols ().enabled]) {
+ debugger->enable_countpoint
+ ((*tree_iter)[get_bp_cols ().id], true);
+ } else {
+ debugger->enable_countpoint
+ ((*tree_iter)[get_bp_cols ().id], false);
+ }
+ }
+ NEMIVER_CATCH;
+ }
+
void on_breakpoint_ignore_count_edited (const Glib::ustring &a_path,
const Glib::ustring &a_text)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]