nemiver r883 - in trunk: . src/dbgengine src/persp/dbgperspective src/persp/dbgperspective/glade src/persp/dbgperspective/menus



Author: dodji
Date: Sun Jul  6 18:11:20 2008
New Revision: 883
URL: http://svn.gnome.org/viewvc/nemiver?rev=883&view=rev

Log:
add support for arbitraty function calls

Added:
   trunk/src/persp/dbgperspective/glade/callfunctiondialog.glade
   trunk/src/persp/dbgperspective/nmv-call-function-dialog.cc
   trunk/src/persp/dbgperspective/nmv-call-function-dialog.h
Modified:
   trunk/ChangeLog
   trunk/src/dbgengine/nmv-gdb-engine.cc
   trunk/src/dbgengine/nmv-gdb-engine.h
   trunk/src/dbgengine/nmv-i-debugger.h
   trunk/src/persp/dbgperspective/Makefile.am
   trunk/src/persp/dbgperspective/glade/Makefile.am
   trunk/src/persp/dbgperspective/glade/setbreakpointdialog.glade
   trunk/src/persp/dbgperspective/menus/menus.xml
   trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc

Modified: trunk/src/dbgengine/nmv-gdb-engine.cc
==============================================================================
--- trunk/src/dbgengine/nmv-gdb-engine.cc	(original)
+++ trunk/src/dbgengine/nmv-gdb-engine.cc	Sun Jul  6 18:11:20 2008
@@ -3120,6 +3120,19 @@
 }
 
 void
+GDBEngine::call_function (const UString &a_expr,
+                          const UString &a_cookie)
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+    if (a_expr.empty ()) {return;}
+
+    Command command ("call-function",
+                     "-data-evaluate-expression " + a_expr,
+                     a_cookie);
+    queue_command (command);
+}
+
+void
 GDBEngine::print_variable_value (const UString &a_var_name,
                                  const UString &a_cookie)
 {

Modified: trunk/src/dbgengine/nmv-gdb-engine.h
==============================================================================
--- trunk/src/dbgengine/nmv-gdb-engine.h	(original)
+++ trunk/src/dbgengine/nmv-gdb-engine.h	Sun Jul  6 18:11:20 2008
@@ -332,6 +332,9 @@
     void evaluate_expression (const UString &a_expr,
                               const UString &a_cookie) ;
 
+    void call_function (const UString &a_call_expression,
+                        const UString &a_cookie="");
+
     void print_variable_value (const UString &a_var_name,
                               const UString &a_cookie) ;
 

Modified: trunk/src/dbgengine/nmv-i-debugger.h
==============================================================================
--- trunk/src/dbgengine/nmv-i-debugger.h	(original)
+++ trunk/src/dbgengine/nmv-i-debugger.h	Sun Jul  6 18:11:20 2008
@@ -797,12 +797,15 @@
                                         int a_high_frame=-1,
                                         const UString &a_cookie="") = 0;
 
-    virtual void list_local_variables (const UString &a_cookie="")  = 0;
+    virtual void list_local_variables (const UString &a_cookie="") = 0;
 
-    virtual void list_global_variables (const UString &a_cookie="")  = 0;
+    virtual void list_global_variables (const UString &a_cookie="") = 0;
 
     virtual void evaluate_expression (const UString &a_expr,
-                                      const UString &a_cookie="")  = 0;
+                                      const UString &a_cookie="") = 0;
+
+    virtual void call_function (const UString &a_call_expression,
+                                const UString &a_cookie="") = 0;
 
     virtual void print_variable_value (const UString &a_var_name,
                                        const UString &a_cookie="")  = 0;

Modified: trunk/src/persp/dbgperspective/Makefile.am
==============================================================================
--- trunk/src/persp/dbgperspective/Makefile.am	(original)
+++ trunk/src/persp/dbgperspective/Makefile.am	Sun Jul  6 18:11:20 2008
@@ -73,7 +73,9 @@
 nmv-dbg-perspective.cc \
 nmv-dbg-perspective.h \
 nmv-vars-treeview.h \
-nmv-vars-treeview.cc
+nmv-vars-treeview.cc \
+nmv-call-function-dialog.h \
+nmv-call-function-dialog.cc
 
 if BUILD_MEMORYVIEW
 memoryview_sources = \

Modified: trunk/src/persp/dbgperspective/glade/Makefile.am
==============================================================================
--- trunk/src/persp/dbgperspective/glade/Makefile.am	(original)
+++ trunk/src/persp/dbgperspective/glade/Makefile.am	Sun Jul  6 18:11:20 2008
@@ -12,7 +12,8 @@
 setbreakpointdialog.glade \
 chooseoverloadsdialog.glade \
 remotetargetdialog.glade \
-globalvarsinspector.glade
+globalvarsinspector.glade \
+callfunctiondialog.glade
 
 gladedir = @NEMIVER_PLUGINS_DIR@/$(PLUGIN_NAME)/glade
 glade_DATA = $(gladefiles)

Added: trunk/src/persp/dbgperspective/glade/callfunctiondialog.glade
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/glade/callfunctiondialog.glade	Sun Jul  6 18:11:20 2008
@@ -0,0 +1,85 @@
+<?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 Jul  6 19:35:44 2008 -->
+<glade-interface>
+  <widget class="GtkDialog" id="callfunctiondialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Call a function</property>
+    <property name="modal">True</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="GtkTable" id="table1">
+            <property name="visible">True</property>
+            <property name="n_rows">1</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <widget class="GtkEntry" id="callexpressionentry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activates_default">True</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">&lt;b&gt;call a function:&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+                <property name="justify">GTK_JUSTIFY_RIGHT</property>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">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_default">True</property>
+                <property name="has_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>

Modified: trunk/src/persp/dbgperspective/glade/setbreakpointdialog.glade
==============================================================================
--- trunk/src/persp/dbgperspective/glade/setbreakpointdialog.glade	(original)
+++ trunk/src/persp/dbgperspective/glade/setbreakpointdialog.glade	Sun Jul  6 18:11:20 2008
@@ -5,6 +5,7 @@
   <widget class="GtkDialog" id="setbreakpointdialog">
     <property name="visible">True</property>
     <property name="title" translatable="yes">Set Breakpoint</property>
+    <property name="modal">True</property>
     <property name="default_width">300</property>
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
     <property name="has_separator">False</property>
@@ -43,54 +44,46 @@
                       <placeholder/>
                     </child>
                     <child>
-                      <widget class="GtkRadioButton" id="functionnameradio">
+                      <widget class="GtkEntry" id="conditionentry">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="label" translatable="yes">F_unction Name:</property>
-                        <property name="use_underline">True</property>
-                        <property name="response_id">0</property>
-                        <property name="draw_indicator">True</property>
                       </widget>
                       <packing>
+                        <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label_function">
+                      <widget class="GtkLabel" id="label1">
                         <property name="visible">True</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Function:</property>
-                        <property name="mnemonic_widget">filenameentry</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Condition:</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
+                        <property name="top_attach">7</property>
+                        <property name="bottom_attach">8</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="functionentry">
+                      <widget class="GtkComboBox" id="combo_event">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">â</property>
-                        <property name="activates_default">True</property>
+                        <property name="items" translatable="yes"></property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="y_options"></property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkRadioButton" id="sourcelocationradio">
+                      <widget class="GtkRadioButton" id="eventradio">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="label" translatable="yes">_Source Location</property>
+                        <property name="label" translatable="yes">_Event:</property>
                         <property name="use_underline">True</property>
                         <property name="response_id">0</property>
                         <property name="draw_indicator">True</property>
@@ -98,38 +91,23 @@
                       </widget>
                       <packing>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkLabel" id="label_filename">
-                        <property name="visible">True</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Filename:</property>
-                        <property name="mnemonic_widget">filenameentry</property>
-                      </widget>
-                      <packing>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
                         <property name="x_options">GTK_FILL</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="filenameentry">
+                      <widget class="GtkEntry" id="lineentry">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="invisible_char">â</property>
                         <property name="activates_default">True</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
@@ -148,25 +126,38 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="lineentry">
+                      <widget class="GtkEntry" id="filenameentry">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="invisible_char">â</property>
                         <property name="activates_default">True</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkRadioButton" id="eventradio">
+                      <widget class="GtkLabel" id="label_filename">
+                        <property name="visible">True</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Filename:</property>
+                        <property name="mnemonic_widget">filenameentry</property>
+                      </widget>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="sourcelocationradio">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="label" translatable="yes">_Event:</property>
+                        <property name="label" translatable="yes">_Source Location</property>
                         <property name="use_underline">True</property>
                         <property name="response_id">0</property>
                         <property name="draw_indicator">True</property>
@@ -174,46 +165,53 @@
                       </widget>
                       <packing>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">5</property>
-                        <property name="bottom_attach">6</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
                         <property name="x_options">GTK_FILL</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkComboBox" id="combo_event">
+                      <widget class="GtkEntry" id="functionentry">
                         <property name="visible">True</property>
-                        <property name="items" translatable="yes"></property>
+                        <property name="can_focus">True</property>
+                        <property name="activates_default">True</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
-                        <property name="x_options">GTK_FILL</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="y_options"></property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label1">
+                      <widget class="GtkLabel" id="label_function">
                         <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Condition:</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">Function:</property>
+                        <property name="mnemonic_widget">filenameentry</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">7</property>
-                        <property name="bottom_attach">8</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="conditionentry">
+                      <widget class="GtkRadioButton" id="functionnameradio">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">F_unction Name:</property>
+                        <property name="use_underline">True</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">7</property>
-                        <property name="bottom_attach">8</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
                       </packing>
                     </child>
                   </widget>

Modified: trunk/src/persp/dbgperspective/menus/menus.xml
==============================================================================
--- trunk/src/persp/dbgperspective/menus/menus.xml	(original)
+++ trunk/src/persp/dbgperspective/menus/menus.xml	Sun Jul  6 18:11:20 2008
@@ -77,6 +77,8 @@
             <separator/>
             <menuitem action="InspectVariableMenuItemAction"
                 name="InspectVariableMenuItem"/>
+            <menuitem action="CallFunctionMenuItemAction"
+                name="CallFunctionMenuItem"/>
             <menuitem action="ActivateGlobalVariablesDialogMenuAction"
                 name="ActivateGlobalVariablesDialogMenuItem"/>
             <menuitem action="RefreshLocalVariablesMenuItemAction"

Added: trunk/src/persp/dbgperspective/nmv-call-function-dialog.cc
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/nmv-call-function-dialog.cc	Sun Jul  6 18:11:20 2008
@@ -0,0 +1,107 @@
+// 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.
+ */
+#include "nmv-call-function-dialog.h"
+#include <glib/gi18n.h>
+#include <libglademm.h>
+#include "common/nmv-exception.h"
+#include "common/nmv-env.h"
+#include "common/nmv-ustring.h"
+#include "nmv-ui-utils.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+struct CallFunctionDialog::Priv {
+    Gtk::Entry *call_expr_entry;
+    Gtk::Button *ok_button;
+    Priv (Gtk::Dialog &a_dialog,
+          const Glib::RefPtr<Gnome::Glade::Xml> &a_glade) :
+        call_expr_entry (0),
+        ok_button (0)
+    {
+        a_dialog.set_default_response (Gtk::RESPONSE_OK);
+        ok_button =
+            ui_utils::get_widget_from_glade<Gtk::Button> (a_glade, "okbutton");
+        THROW_IF_FAIL (ok_button);
+        ok_button->set_sensitive (false);
+
+        call_expr_entry =
+            ui_utils::get_widget_from_glade<Gtk::Entry> (a_glade,
+                                                         "callexpressionentry");
+        THROW_IF_FAIL (call_expr_entry);
+        call_expr_entry->signal_changed ().connect
+            (sigc::mem_fun (*this, &Priv::on_call_expr_entry_changed_signal));
+        call_expr_entry->set_activates_default ();
+    }
+
+    void on_call_expr_entry_changed_signal ()
+    {
+        NEMIVER_TRY
+        update_ok_button_sensitivity ();
+        NEMIVER_CATCH
+    }
+
+    void update_ok_button_sensitivity ()
+    {
+        THROW_IF_FAIL (call_expr_entry);
+        THROW_IF_FAIL (ok_button);
+
+        if (call_expr_entry->get_text ().empty ()) {
+            ok_button->set_sensitive (false);
+        } else {
+            ok_button->set_sensitive (true);
+        }
+    }
+};//end struct CallFunctionDialog::Priv
+
+CallFunctionDialog::CallFunctionDialog (const UString &a_root_path):
+    Dialog (a_root_path, "callfunctiondialog.glade", "callfunctiondialog")
+{
+    m_priv.reset (new Priv (widget (), glade ()));
+}
+
+CallFunctionDialog::~CallFunctionDialog ()
+{
+}
+
+UString
+CallFunctionDialog::call_expression () const
+{
+    THROW_IF_FAIL (m_priv);
+    THROW_IF_FAIL (m_priv->call_expr_entry);
+
+    return m_priv->call_expr_entry->get_text ();
+}
+
+void
+CallFunctionDialog::call_expressoin (const UString &a_expr)
+{
+    THROW_IF_FAIL (m_priv);
+    THROW_IF_FAIL (m_priv->call_expr_entry);
+
+    m_priv->call_expr_entry->set_text (a_expr);
+}
+
+NEMIVER_END_NAMESPACE (nemiver)
+

Added: trunk/src/persp/dbgperspective/nmv-call-function-dialog.h
==============================================================================
--- (empty file)
+++ trunk/src/persp/dbgperspective/nmv-call-function-dialog.h	Sun Jul  6 18:11:20 2008
@@ -0,0 +1,58 @@
+//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 __NEMIVER_CALL_FUNCTION_DIALOG_H__
+#define __NEMIVER_CALL_FUNCTION_DIALOG_H__
+
+#include "common/nmv-safe-ptr-utils.h"
+#include "nmv-dialog.h"
+
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+namespace common {
+class UString;
+}
+
+using nemiver::common::UString;
+using nemiver::common::SafePtr;
+
+class CallFunctionDialog : public Dialog {
+    class Priv;
+    SafePtr<Priv> m_priv;
+
+public:
+
+    CallFunctionDialog (const UString &a_resource_root_path);
+    virtual ~CallFunctionDialog ();
+
+    UString call_expression () const;
+    void call_expressoin (const UString &a_expr);
+
+};//end class CallFunctionDialog
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif /*__NEMIVER_CALL_FUNCTION_DIALOG_H__*/
+

Modified: trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc
==============================================================================
--- trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc	(original)
+++ trunk/src/persp/dbgperspective/nmv-dbg-perspective.cc	Sun Jul  6 18:11:20 2008
@@ -85,6 +85,7 @@
 #include "nmv-choose-overloads-dialog.h"
 #include "nmv-remote-target-dialog.h"
 #include "nmv-registers-view.h"
+#include "nmv-call-function-dialog.h"
 
 #ifdef WITH_MEMORYVIEW
 #include "nmv-memory-view.h"
@@ -229,6 +230,7 @@
     void on_toggle_breakpoint_action () ;
     void on_toggle_breakpoint_enabled_action () ;
     void on_inspect_variable_action () ;
+    void on_call_function_action () ;
     void on_show_commands_action () ;
     void on_show_errors_action () ;
     void on_show_target_output_action () ;
@@ -501,6 +503,8 @@
 
     void inspect_variable () ;
     void inspect_variable (const UString &a_variable_name) ;
+    void call_function ();
+    void call_function (const UString &a_call_expr);
     void toggle_breakpoint () ;
     void toggle_breakpoint_enabled (const UString &a_file_path,
                                     int a_linenum) ;
@@ -1357,6 +1361,15 @@
 }
 
 void
+DBGPerspective::on_call_function_action ()
+{
+    LOG_FUNCTION_SCOPE_NORMAL_DD;
+    NEMIVER_TRY
+    call_function ();
+    NEMIVER_CATCH
+}
+
+void
 DBGPerspective::on_show_commands_action ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD ;
@@ -2585,8 +2598,7 @@
             sigc::mem_fun (*this, &DBGPerspective::on_next_action),
             ActionEntry::DEFAULT,
             "F6"
-        }
-        ,
+        },
         {
             "StepMenuItemAction",
             nemiver::STOCK_STEP_INTO,
@@ -2595,8 +2607,7 @@
             sigc::mem_fun (*this, &DBGPerspective::on_step_into_action),
             ActionEntry::DEFAULT,
             "F7"
-        }
-        ,
+        },
         {
             "StepOutMenuItemAction",
             nemiver::STOCK_STEP_OUT,
@@ -2605,8 +2616,7 @@
             sigc::mem_fun (*this, &DBGPerspective::on_step_out_action),
             ActionEntry::DEFAULT,
             "<shift>F7"
-        }
-        ,
+        },
         {
             "ContinueMenuItemAction",
             Gtk::Stock::EXECUTE,
@@ -2615,8 +2625,7 @@
             sigc::mem_fun (*this, &DBGPerspective::on_continue_action),
             ActionEntry::DEFAULT,
             "F5"
-        }
-        ,
+        },
         {
             "ContinueUntilMenuItemAction",
             nil_stock_id,
@@ -2626,8 +2635,7 @@
             sigc::mem_fun (*this, &DBGPerspective::on_continue_until_action),
             ActionEntry::DEFAULT,
             "F11"
-        }
-        ,
+        },
         {
             "ToggleBreakPointMenuItemAction",
             nil_stock_id,
@@ -2638,20 +2646,19 @@
             ActionEntry::DEFAULT,
             "F8"
         },
-
         {
             "ToggleEnableBreakPointMenuItemAction",
             nil_stock_id,
             //don't translate, name will be overwritten based on context
             "Enable/Disable Breakpoint",
-            _("Enable or disable the breakpoint that is set at the current cursor location"),
+            _("Enable or disable the breakpoint that is set at "
+              "the current cursor location"),
             sigc::mem_fun
                         (*this,
                          &DBGPerspective::on_toggle_breakpoint_enabled_action),
             ActionEntry::DEFAULT,
             "<shift>F8"
         },
-
         {
             "SetBreakPointMenuItemAction",
             nil_stock_id,
@@ -2661,7 +2668,6 @@
             ActionEntry::DEFAULT,
             "<control>B"
         },
-
         {
             "SetBreakPointUsingDialogMenuItemAction",
             nil_stock_id,
@@ -2672,7 +2678,6 @@
             ActionEntry::DEFAULT,
             "<control><shift>B"
         },
-
         {
             "InspectVariableMenuItemAction",
             nil_stock_id,
@@ -2683,6 +2688,15 @@
             "F12"
         },
         {
+            "CallFunctionMenuItemAction",
+            nil_stock_id,
+            _("Call a function"),
+            _("Call a function in the program being debugged"),
+            sigc::mem_fun (*this, &DBGPerspective::on_call_function_action),
+            ActionEntry::DEFAULT,
+            "<control>E"
+        },
+        {
             "ActivateGlobalVariablesDialogMenuAction",
             nil_stock_id,
             _("Show Global Variables"),
@@ -2913,7 +2927,7 @@
             _("Find a text string in file"),
             sigc::mem_fun (*this, &DBGPerspective::on_find_action),
             ActionEntry::DEFAULT,
-            "<Control>f"
+            "<Control>F"
         }
     };
 
@@ -5498,6 +5512,29 @@
     dialog.run () ;
 }
 
+void
+DBGPerspective::call_function ()
+{
+    CallFunctionDialog dialog (plugin_path ());
+
+    int result = dialog.run ();
+    if (result != Gtk::RESPONSE_OK)
+        return;
+    UString call_expr = dialog.call_expression ();
+    if (call_expr.empty ())
+        return;
+    call_function (call_expr);
+}
+
+void
+DBGPerspective::call_function (const UString &a_call_expr)
+{
+    THROW_IF_FAIL (debugger ()) ;
+
+    debugger ()->call_function (a_call_expr);
+}
+
+
 IDebuggerSafePtr&
 DBGPerspective::debugger ()
 {



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