[nemiver/varobjs-support] Initial support to set watchpoints



commit 479fa2d8a0d487bc7933b0452f4e9876c5d6c47f
Author: Dodji Seketeli <dodji redhat com>
Date:   Sun May 17 16:46:17 2009 +0200

    Initial support to set watchpoints
    
    	* src/persp/dbgperspective/glade/watchpointdialog.glade: New glade
    	file.
    	* src/persp/dbgperspective/glade/Makefile.am: Add the glade file to
    	the build system.
    	* src/persp/dbgperspective/nmv-watchpoint-dialog.h: Declare ...
    	* src/persp/dbgperspective/nmv-watchpoint-dialog.cc ... the new
    	type WatchpointDialog.
    	* src/persp/dbgperspective/Makefile.am: Add the new files to the
    	build system.
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc: Bring up the
    	the new watchpoint dialog when the user hits <control>-T.
    	* src/persp/dbgperspective/menus/menus.xml: Add a new menu item for
    	setting watchpoints.
---
 src/persp/dbgperspective/Makefile.am               |    2 +
 src/persp/dbgperspective/glade/Makefile.am         |    3 +-
 .../dbgperspective/glade/watchpointdialog.glade    |  185 ++++++++++++
 src/persp/dbgperspective/menus/menus.xml           |    2 +
 src/persp/dbgperspective/nmv-dbg-perspective.cc    |   58 ++++-
 src/persp/dbgperspective/nmv-watchpoint-dialog.cc  |  308 ++++++++++++++++++++
 src/persp/dbgperspective/nmv-watchpoint-dialog.h   |   83 ++++++
 7 files changed, 639 insertions(+), 2 deletions(-)

diff --git a/src/persp/dbgperspective/Makefile.am b/src/persp/dbgperspective/Makefile.am
index bcd1af0..74d08d5 100644
--- a/src/persp/dbgperspective/Makefile.am
+++ b/src/persp/dbgperspective/Makefile.am
@@ -70,6 +70,8 @@ nmv-open-file-dialog.cc \
 nmv-open-file-dialog.h \
 nmv-set-breakpoint-dialog.cc \
 nmv-set-breakpoint-dialog.h \
+nmv-watchpoint-dialog.h \
+nmv-watchpoint-dialog.cc \
 nmv-choose-overloads-dialog.cc \
 nmv-choose-overloads-dialog.h \
 nmv-remote-target-dialog.cc \
diff --git a/src/persp/dbgperspective/glade/Makefile.am b/src/persp/dbgperspective/glade/Makefile.am
index d86c5b8..a40be1e 100644
--- a/src/persp/dbgperspective/glade/Makefile.am
+++ b/src/persp/dbgperspective/glade/Makefile.am
@@ -13,7 +13,8 @@ setbreakpointdialog.glade \
 chooseoverloadsdialog.glade \
 remotetargetdialog.glade \
 globalvarsinspector.glade \
-callfunctiondialog.glade
+callfunctiondialog.glade \
+watchpointdialog.glade
 
 gladedir = @NEMIVER_PLUGINS_DIR@/$(PLUGIN_NAME)/glade
 glade_DATA = $(gladefiles)
diff --git a/src/persp/dbgperspective/glade/watchpointdialog.glade b/src/persp/dbgperspective/glade/watchpointdialog.glade
new file mode 100644
index 0000000..0cab88d
--- /dev/null
+++ b/src/persp/dbgperspective/glade/watchpointdialog.glade
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.5 on Sun May 17 10:55:43 2009 -->
+<glade-interface>
+  <widget class="GtkDialog" id="watchpointdialog">
+    <property name="can_focus">True</property>
+    <property name="can_default">True</property>
+    <property name="border_width">5</property>
+    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+    <property name="default_width">300</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">&lt;b&gt;Set a watchpoint:&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="xalign">1</property>
+                <child>
+                  <widget class="GtkVBox" id="vbox2">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox1">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <widget class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">expression:</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkEntry" id="expressionentry">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="inspectbutton">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="label" translatable="yes">Inspect</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox2">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <widget class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">triggers on:</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="readcheckbutton">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">read</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="writecheckbutton">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">write</property>
+                            <property name="response_id">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkVBox" id="varinspectorbox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="cancelbutton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="okbutton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-5</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
diff --git a/src/persp/dbgperspective/menus/menus.xml b/src/persp/dbgperspective/menus/menus.xml
index 46f8d0a..75967c5 100644
--- a/src/persp/dbgperspective/menus/menus.xml
+++ b/src/persp/dbgperspective/menus/menus.xml
@@ -74,6 +74,8 @@
                 name="SetBreakMenuItem"/>
             <menuitem action="SetBreakPointUsingDialogMenuItemAction"
                 name="SetBreakUsingDialogMenuItem"/>
+            <menuitem action="SetWatchPointUsingDialogMenuItemAction"
+                name="SetWatchUsingDialogMenuItem"/>
             <separator/>
             <menuitem action="InspectVariableMenuItemAction"
                 name="InspectVariableMenuItem"/>
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 556ffc9..455383e 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -101,6 +101,10 @@
 #include "nmv-memory-view.h"
 #endif // WITH_MEMORYVIEW
 
+#ifdef WITH_VAROBJS
+#include "nmv-watchpoint-dialog.h"
+#endif //WITH_VAROBJS
+
 using namespace std;
 using namespace nemiver::common;
 using namespace nemiver::ui_utils;
@@ -273,6 +277,7 @@ private:
     void on_continue_until_action ();
     void on_set_breakpoint_action ();
     void on_set_breakpoint_using_dialog_action ();
+    void on_set_watchpoint_using_dialog_action ();
     void on_refresh_locals_action ();
     void on_toggle_breakpoint_action ();
     void on_toggle_breakpoint_enabled_action ();
@@ -552,6 +557,7 @@ public:
                                       const int a_line_num);
     void set_breakpoint_using_dialog (const UString &a_function_name);
     void set_breakpoint_from_dialog (SetBreakpointDialog &a_dialog);
+    void set_watchpoint_using_dialog ();
     void refresh_locals ();
 
     void inspect_variable ();
@@ -1408,6 +1414,18 @@ DBGPerspective::on_set_breakpoint_using_dialog_action ()
 }
 
 void
+DBGPerspective::on_set_watchpoint_using_dialog_action ()
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+    NEMIVER_TRY
+
+    set_watchpoint_using_dialog ();
+
+    NEMIVER_CATCH
+}
+
+void
 DBGPerspective::on_refresh_locals_action ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -2864,6 +2882,17 @@ DBGPerspective::init_actions ()
             "<control><shift>B"
         },
         {
+            "SetWatchPointUsingDialogMenuItemAction",
+            nil_stock_id,
+            _("Set Watchpoint with dialog..."),
+            _("Set a watchpoint using a dialog"),
+            sigc::mem_fun
+                (*this,
+                 &DBGPerspective::on_set_watchpoint_using_dialog_action),
+            ActionEntry::DEFAULT,
+            "<control>T"
+        },
+        {
             "InspectVariableMenuItemAction",
             nil_stock_id,
             _("Inspect a Variable"),
@@ -5330,7 +5359,13 @@ DBGPerspective::append_breakpoints
 
     map<int, IDebugger::BreakPoint>::const_iterator iter;
     for (iter = a_breaks.begin (); iter != a_breaks.end (); ++iter) {
-        append_breakpoint (iter->first, iter->second);
+        // If the breakpoint is a standard one (e.g. not a watchpoint), add
+        // its visual representation.
+        // We don't have any visual representation for watchpoints yet.
+        if (iter->second.type ()
+            == IDebugger::BreakPoint::STANDARD_BREAKPOINT_TYPE) {
+            append_breakpoint (iter->first, iter->second);
+        }
     }
 }
 
@@ -5844,6 +5879,27 @@ DBGPerspective::set_breakpoint_using_dialog (const UString &a_function_name)
 }
 
 void
+DBGPerspective::set_watchpoint_using_dialog ()
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+    WatchpointDialog dialog (plugin_path (), debugger ());
+    int result = dialog.run ();
+    if (result != Gtk::RESPONSE_OK) {
+        return;
+    }
+
+    UString expression = dialog.expression ();
+    if (expression.empty ())
+        return;
+
+    WatchpointDialog::Mode mode = dialog.mode ();
+    debugger ()->set_watchpoint (expression,
+                                 mode & WatchpointDialog::WRITE_MODE,
+                                 mode & WatchpointDialog::READ_MODE);
+}
+
+void
 DBGPerspective::refresh_locals ()
 {
 
diff --git a/src/persp/dbgperspective/nmv-watchpoint-dialog.cc b/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
new file mode 100644
index 0000000..bae809c
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
@@ -0,0 +1,308 @@
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#include <glib/gi18n.h>
+#include "nmv-watchpoint-dialog.h"
+#ifdef WITH_VAROBJS
+#include <libglademm.h>
+#include <gtkmm/dialog.h>
+#include "common/nmv-exception.h"
+#include "common/nmv-env.h"
+#include "common/nmv-ustring.h"
+#include "nmv-ui-utils.h"
+#include "nmv-var-inspector2.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+struct WatchpointDialog::Priv {
+
+    Gtk::Dialog &dialog;
+    Glib::RefPtr<Gnome::Glade::Xml> glade;
+    Gtk::Entry *expression_entry;
+    Gtk::Button *inspect_button;
+    Gtk::CheckButton *read_check_button;
+    Gtk::CheckButton *write_check_button;
+    Gtk::Button *ok_button;
+    Gtk::Button *cancel_button;
+    SafePtr<VarInspector2> var_inspector;
+    IDebuggerSafePtr debugger;
+
+    Priv (Gtk::Dialog &a_dialog,
+          const Glib::RefPtr<Gnome::Glade::Xml> &a_glade,
+          IDebuggerSafePtr a_debugger) :
+        dialog (a_dialog),
+        glade (a_glade),
+        expression_entry (0),
+        inspect_button (0),
+        read_check_button (0),
+        write_check_button (0),
+        debugger (a_debugger)
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+        build_dialog ();
+        connect_to_widget_signals ();
+        connect_to_debugger_signals ();
+    }
+
+    void
+    build_dialog ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+        dialog.set_default_response (Gtk::RESPONSE_OK);
+
+        expression_entry =
+            ui_utils::get_widget_from_glade<Gtk::Entry>
+                                            (glade, "expressionentry");
+        THROW_IF_FAIL (expression_entry);
+        expression_entry->set_activates_default ();
+
+        inspect_button =
+           ui_utils::get_widget_from_glade<Gtk::Button> (glade, "inspectbutton");
+        THROW_IF_FAIL (inspect_button);
+        inspect_button->set_sensitive (false);
+
+        read_check_button =
+            ui_utils::get_widget_from_glade<Gtk::CheckButton>
+                                            (glade, "readcheckbutton");
+        THROW_IF_FAIL (read_check_button);
+
+        write_check_button =
+            ui_utils::get_widget_from_glade<Gtk::CheckButton>
+                                            (glade, "writecheckbutton");
+        THROW_IF_FAIL (write_check_button);
+
+        ok_button =
+            ui_utils::get_widget_from_glade<Gtk::Button>
+                                            (glade, "okbutton");
+        THROW_IF_FAIL (ok_button);
+        ok_button->set_sensitive (false);
+
+        cancel_button =
+            ui_utils::get_widget_from_glade<Gtk::Button>
+                                            (glade, "cancelbutton");
+        THROW_IF_FAIL (cancel_button);
+        cancel_button->set_sensitive (true);
+
+        Gtk::Box *box =
+            ui_utils::get_widget_from_glade<Gtk::Box> (glade,
+                                                       "varinspectorbox");
+        THROW_IF_FAIL (box);
+
+        var_inspector.reset (new VarInspector2 (debugger));
+        THROW_IF_FAIL (var_inspector);
+
+        Gtk::ScrolledWindow *scr = Gtk::manage (new Gtk::ScrolledWindow);
+        scr->set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+        scr->set_shadow_type (Gtk::SHADOW_IN);
+        scr->add (var_inspector->widget ());
+
+        box->pack_start (*scr, true, true);
+
+        ensure_either_read_or_write_mode ();
+        dialog.show_all ();
+    }
+
+    void
+    connect_to_widget_signals ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+        THROW_IF_FAIL (inspect_button);
+        THROW_IF_FAIL (expression_entry);
+
+        inspect_button->signal_clicked ().connect (sigc::mem_fun
+               (*this, &Priv::on_inspect_button_clicked));
+        expression_entry->signal_changed ().connect (sigc::mem_fun
+               (*this, &Priv::on_expression_entry_changed_signal));
+    }
+
+    void
+    connect_to_debugger_signals ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD;
+    }
+
+    void
+    ensure_either_read_or_write_mode ()
+    {
+        THROW_IF_FAIL (read_check_button);
+        THROW_IF_FAIL (write_check_button);
+
+        if (!read_check_button->get_active ()
+            && !read_check_button->get_active ())
+            write_check_button->set_active (true);
+    }
+
+    void
+    on_inspect_button_clicked ()
+    {
+        NEMIVER_TRY
+
+        THROW_IF_FAIL (expression_entry);
+        THROW_IF_FAIL (var_inspector);
+
+        UString expression = expression_entry->get_text ();
+        if (expression == "")
+            return;
+        var_inspector->inspect_variable (expression);
+
+        NEMIVER_CATCH
+    }
+
+    void
+    on_expression_entry_changed_signal ()
+    {
+        LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+        NEMIVER_TRY
+
+        THROW_IF_FAIL (expression_entry);
+        THROW_IF_FAIL (inspect_button);
+
+        UString expression = expression_entry->get_text ();
+        if (expression == "") {
+            inspect_button->set_sensitive (false);
+            ok_button->set_sensitive (false);
+        } else {
+            inspect_button->set_sensitive (true);
+            ok_button->set_sensitive (true);
+        }
+
+        NEMIVER_CATCH
+    }
+
+}; // end struct WatchpointDialog
+
+WatchpointDialog::WatchpointDialog (const UString &a_root_path,
+                                    IDebuggerSafePtr a_debugger) :
+    Dialog (a_root_path,
+            "watchpointdialog.glade",
+            "watchpointdialog")
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+    m_priv.reset (new WatchpointDialog::Priv (widget (),
+                                              glade (),
+                                              a_debugger));
+}
+
+WatchpointDialog::~WatchpointDialog ()
+{
+}
+
+const UString
+WatchpointDialog::expression () const
+{
+    THROW_IF_FAIL (m_priv);
+    THROW_IF_FAIL (m_priv->expression_entry);
+    return m_priv->expression_entry->get_text ();
+}
+
+void
+WatchpointDialog::expression (const UString &a_text)
+{
+    THROW_IF_FAIL (m_priv);
+    THROW_IF_FAIL (m_priv->expression_entry);
+    return m_priv->expression_entry->set_text (a_text);
+}
+
+WatchpointDialog::Mode
+WatchpointDialog::mode () const
+{
+    THROW_IF_FAIL (m_priv);
+    THROW_IF_FAIL (m_priv->read_check_button);
+    THROW_IF_FAIL (m_priv->write_check_button);
+
+    Mode mode = UNDEFINED_MODE;
+
+    if (m_priv->write_check_button->get_active ())
+        mode |= WRITE_MODE;
+
+    if (m_priv->read_check_button->get_active ())
+        mode |= READ_MODE;
+
+    return mode;
+}
+
+void
+WatchpointDialog::mode (Mode a_mode)
+{
+    THROW_IF_FAIL (m_priv);
+    THROW_IF_FAIL (m_priv->read_check_button);
+    THROW_IF_FAIL (m_priv->write_check_button);
+
+    if ((a_mode & WRITE_MODE) == WRITE_MODE)
+        m_priv->write_check_button->set_active (true);
+    else
+        m_priv->write_check_button->set_active (false);
+
+    if ((a_mode & READ_MODE) == READ_MODE)
+        m_priv->read_check_button->set_active (true);
+    else
+        m_priv->read_check_button->set_active (false);
+
+    m_priv->ensure_either_read_or_write_mode ();
+}
+
+WatchpointDialog::Mode
+operator| (WatchpointDialog::Mode a_l,
+           WatchpointDialog::Mode a_r)
+{
+    return (a_l |= a_r);
+}
+
+WatchpointDialog::Mode
+operator& (WatchpointDialog::Mode a_l,
+           WatchpointDialog::Mode a_r)
+{
+    return (a_l &= a_r);
+}
+
+WatchpointDialog::Mode
+operator~ (WatchpointDialog::Mode a_m)
+{
+    return static_cast<WatchpointDialog::Mode> (~a_m);
+}
+
+WatchpointDialog::Mode&
+operator|= (WatchpointDialog::Mode &a_l,
+            WatchpointDialog::Mode a_r)
+{
+    a_l = static_cast<WatchpointDialog::Mode>
+        (static_cast<unsigned> (a_l) | static_cast<unsigned> (a_r));
+    return a_l;
+}
+
+WatchpointDialog::Mode&
+operator&= (WatchpointDialog::Mode &a_l,
+            WatchpointDialog::Mode a_r)
+{
+    a_l = static_cast<WatchpointDialog::Mode>
+            (static_cast<unsigned> (a_l) & static_cast<unsigned> (a_r));
+    return a_l;
+}
+
+#endif // WITH_VAROBJS
+NEMIVER_END_NAMESPACE (nemiver)
+
diff --git a/src/persp/dbgperspective/nmv-watchpoint-dialog.h b/src/persp/dbgperspective/nmv-watchpoint-dialog.h
new file mode 100644
index 0000000..93cbae1
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-watchpoint-dialog.h
@@ -0,0 +1,83 @@
+// Author: Dodji Seketeli
+
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#ifndef NMV_WATCHPOINT_DIALOG_H__
+#define NMV_WATCHPOINT_DIALOG_H__
+
+#include "common/nmv-safe-ptr-utils.h"
+#include "nmv-dialog.h"
+#include "nmv-i-debugger.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+namespace common {
+class UString;
+}
+
+class WatchpointDialog : public Dialog
+{
+    struct Priv;
+    SafePtr<Priv> m_priv;
+    WatchpointDialog ();
+    WatchpointDialog (WatchpointDialog &);
+    WatchpointDialog& operator= (WatchpointDialog &);
+
+public:
+
+    // The mode of the Watchpoint.
+    // a WRITE_MODE means the watchpoint triggers when the watched location
+    // is read, and READ_MODE means the watchpoint trigger when the
+    // watches location is written to. A watchpoint mode can be READ and WRITE;
+    // in that case, it's called an access watchpoint.
+    enum Mode
+    {
+        UNDEFINED_MODE = 0,
+        WRITE_MODE = 1,
+        READ_MODE = 1 << 1
+    };
+
+    WatchpointDialog (const UString &a_resource_root_path,
+                      IDebuggerSafePtr a_debugger);
+    virtual ~WatchpointDialog ();
+
+    const UString expression () const;
+    void expression (const UString &);
+
+    Mode mode () const;
+    void mode (Mode);
+};// end class WatchpointDialog
+
+WatchpointDialog::Mode operator| (WatchpointDialog::Mode,
+                                  WatchpointDialog::Mode);
+WatchpointDialog::Mode operator& (WatchpointDialog::Mode,
+                                  WatchpointDialog::Mode);
+WatchpointDialog::Mode operator~ (WatchpointDialog::Mode);
+WatchpointDialog::Mode& operator|= (WatchpointDialog::Mode&,
+                                   WatchpointDialog::Mode);
+WatchpointDialog::Mode& operator&= (WatchpointDialog::Mode&,
+                                    WatchpointDialog::Mode);
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif // NMV_WATCHPOINT_DIALOG_H__



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