anjuta r4340 - in trunk: . libanjuta/interfaces plugins/debug-manager plugins/gdb



Author: sgranjoux
Date: Tue Oct 14 20:52:45 2008
New Revision: 4340
URL: http://svn.gnome.org/viewvc/anjuta?rev=4340&view=rev

Log:
	* plugins/debug-manager/start.h,
	plugins/debug-manager/anjuta-debug-manager.ui,
	plugins/debug-manager/plugin.c,
	plugins/debug-manager/anjuta-debug-manager.glade,
	plugins/debug-manager/command.c,
	plugins/debug-manager/command.h,
	plugins/debug-manager/start.c,
	plugins/gdb/plugin.c,
	plugins/gdb/debugger.c,
	plugins/gdb/debugger.h,
	libanjuta/interfaces/libanjuta.idl:
	Fix #503764: Implement remote debugging using gdbserver



Modified:
   trunk/ChangeLog
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/plugins/debug-manager/anjuta-debug-manager.glade
   trunk/plugins/debug-manager/anjuta-debug-manager.ui
   trunk/plugins/debug-manager/command.c
   trunk/plugins/debug-manager/command.h
   trunk/plugins/debug-manager/plugin.c
   trunk/plugins/debug-manager/start.c
   trunk/plugins/debug-manager/start.h
   trunk/plugins/gdb/debugger.c
   trunk/plugins/gdb/debugger.h
   trunk/plugins/gdb/plugin.c

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Tue Oct 14 20:52:45 2008
@@ -3098,10 +3098,10 @@
  * SECTION:ianjuta-debugger
  * @title: IAnjutaDebugger
  * @short_description: Debugger interface
- * @see_also: 
+ * @see_also:
  * @stability: Unstable
  * @include: libanjuta/interfaces/ianjuta-debugger.h
- * 
+ *	
  */
 interface IAnjutaDebugger
 {
@@ -3130,6 +3130,7 @@
 		UNABLE_TO_FIND_DEBUGGER,
 		ALREADY_DONE,
 		PROGRAM_NOT_FOUND,
+		UNABLE_TO_CONNECT,
 		UNKNOWN_ERROR,
 		OTHER_ERROR
 	}
@@ -3362,7 +3363,22 @@
 	* Returns: TRUE if sucessful, other FALSE.
 	*/
 	gboolean start (const gchar *args, gboolean terminal, gboolean stop);
-	
+
+	/**
+	* ianjuta_debugger_connect:
+	* @obj: Self
+	* @server: remote server
+	* @args: command line argument of the program
+	* @terminal: TRUE if the program need a terminal
+	* @stop: TRUE if program is stopped at the beginning
+	* @err: Error propagation and reporting
+	*
+	* Connect to a remote debugger and run program
+	*
+	* Returns: TRUE if sucessfull, otherwise FALSE.
+	*/
+	gboolean connect (const gchar *server, const gchar *args, gboolean terminal, gboolean stop);
+
 	/**
 	* ianjuta_debugger_unload:
 	* @obj: Self

Modified: trunk/plugins/debug-manager/anjuta-debug-manager.glade
==============================================================================
--- trunk/plugins/debug-manager/anjuta-debug-manager.glade	(original)
+++ trunk/plugins/debug-manager/anjuta-debug-manager.glade	Tue Oct 14 20:52:45 2008
@@ -144,7 +144,6 @@
                         <child>
                           <widget class="GtkImage" id="image2">
                             <property name="visible">True</property>
-                            <property name="stock">gtk-refresh</property>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -188,7 +187,6 @@
                         <child>
                           <widget class="GtkImage" id="image3">
                             <property name="visible">True</property>
-                            <property name="stock">gnome-stock-attach</property>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -506,10 +504,10 @@
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
     <signal name="close" handler="gtk_widget_hide" object="breakpoint_property_dialog"/>
     <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox3">
+      <widget class="GtkVBox" id="dialog-vbox4">
         <property name="visible">True</property>
         <child>
-          <widget class="GtkTable" id="table1">
+          <widget class="GtkTable" id="table2">
             <property name="visible">True</property>
             <property name="border_width">10</property>
             <property name="n_rows">2</property>
@@ -517,7 +515,7 @@
             <property name="column_spacing">6</property>
             <property name="row_spacing">6</property>
             <child>
-              <widget class="GtkEntry" id="name_entry">
+              <widget class="GtkEntry" id="name_entry1">
                 <property name="visible">True</property>
                 <property name="sensitive">False</property>
                 <property name="can_focus">True</property>
@@ -581,7 +579,7 @@
           </packing>
         </child>
         <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area3">
+          <widget class="GtkHButtonBox" id="dialog-action_area4">
             <property name="visible">True</property>
             <property name="layout_style">GTK_BUTTONBOX_END</property>
             <child>
@@ -624,7 +622,7 @@
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
     <signal name="close" handler="gtk_widget_hide" object="breakpoint_property_dialog"/>
     <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox3">
+      <widget class="GtkVBox" id="dialog-vbox5">
         <property name="visible">True</property>
         <child>
           <widget class="GtkScrolledWindow" id="scrolledwindow31">
@@ -645,11 +643,11 @@
           </packing>
         </child>
         <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area3">
+          <widget class="GtkHButtonBox" id="dialog-action_area5">
             <property name="visible">True</property>
             <property name="layout_style">GTK_BUTTONBOX_END</property>
             <child>
-              <widget class="GtkButton" id="close_button">
+              <widget class="GtkButton" id="close_button1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -659,7 +657,7 @@
               </widget>
             </child>
             <child>
-              <widget class="GtkButton" id="add_button">
+              <widget class="GtkButton" id="add_button1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -686,10 +684,10 @@
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
     <signal name="close" handler="gtk_widget_hide" object="breakpoint_property_dialog"/>
     <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox3">
+      <widget class="GtkVBox" id="dialog-vbox6">
         <property name="visible">True</property>
         <child>
-          <widget class="GtkTable" id="table1">
+          <widget class="GtkTable" id="table3">
             <property name="visible">True</property>
             <property name="border_width">10</property>
             <property name="n_rows">3</property>
@@ -700,7 +698,7 @@
               <placeholder/>
             </child>
             <child>
-              <widget class="GtkLabel" id="value_label">
+              <widget class="GtkLabel" id="value_label1">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">_Value:</property>
@@ -715,14 +713,14 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkScrolledWindow" id="scrolledwindow31">
+              <widget class="GtkScrolledWindow" id="scrolledwindow3">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                 <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                 <property name="shadow_type">GTK_SHADOW_IN</property>
                 <child>
-                  <widget class="GtkTreeView" id="value_treeview">
+                  <widget class="GtkTreeView" id="value_treeview1">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </widget>
@@ -739,7 +737,7 @@
               <widget class="GtkHBox" id="hbox1133">
                 <property name="visible">True</property>
                 <child>
-                  <widget class="GtkEntry" id="name_entry">
+                  <widget class="GtkEntry" id="name_entry2">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="has_focus">True</property>
@@ -755,7 +753,7 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="name_label">
+              <widget class="GtkLabel" id="name_label1">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">_Name:</property>
@@ -772,11 +770,11 @@
           </packing>
         </child>
         <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area3">
+          <widget class="GtkHButtonBox" id="dialog-action_area6">
             <property name="visible">True</property>
             <property name="layout_style">GTK_BUTTONBOX_END</property>
             <child>
-              <widget class="GtkButton" id="close_button">
+              <widget class="GtkButton" id="close_button2">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -801,7 +799,7 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkButton" id="evaluate_button">
+              <widget class="GtkButton" id="evaluate_button1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -814,7 +812,7 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkButton" id="add_button">
+              <widget class="GtkButton" id="add_button2">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -841,10 +839,10 @@
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
     <signal name="close" handler="gtk_widget_hide" object="breakpoint_property_dialog"/>
     <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox3">
+      <widget class="GtkVBox" id="dialog-vbox7">
         <property name="visible">True</property>
         <child>
-          <widget class="GtkTable" id="table1">
+          <widget class="GtkTable" id="table4">
             <property name="visible">True</property>
             <property name="border_width">10</property>
             <property name="n_rows">3</property>
@@ -852,7 +850,7 @@
             <property name="column_spacing">6</property>
             <property name="row_spacing">6</property>
             <child>
-              <widget class="GtkHBox" id="hbox1133">
+              <widget class="GtkHBox" id="hbox1">
                 <property name="visible">True</property>
                 <child>
                   <widget class="GtkEntry" id="breakpoint_location_entry">
@@ -940,7 +938,7 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="label6">
+              <widget class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">_Location:</property>
@@ -957,7 +955,7 @@
           </packing>
         </child>
         <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area3">
+          <widget class="GtkHButtonBox" id="dialog-action_area7">
             <property name="visible">True</property>
             <property name="layout_style">GTK_BUTTONBOX_END</property>
             <child>
@@ -994,301 +992,11 @@
       </widget>
     </child>
   </widget>
-  <widget class="GtkDialog" id="parameter_dialog">
-    <property name="title" translatable="yes">Program parameters</property>
-    <property name="default_width">400</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-    <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox7">
-        <property name="visible">True</property>
-        <child>
-          <widget class="GtkTable" id="table34">
-            <property name="visible">True</property>
-            <property name="border_width">5</property>
-            <property name="n_rows">6</property>
-            <property name="n_columns">3</property>
-            <property name="column_spacing">5</property>
-            <property name="row_spacing">5</property>
-            <child>
-              <widget class="GtkCheckButton" id="stop_at_beginning_check">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="label" translatable="yes">Stop at beginning</property>
-                <property name="use_underline">True</property>
-                <property name="response_id">0</property>
-                <property name="draw_indicator">True</property>
-              </widget>
-              <packing>
-                <property name="right_attach">3</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="GtkCheckButton" id="parameter_run_in_term_check">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="label" translatable="yes">Run In Terminal</property>
-                <property name="use_underline">True</property>
-                <property name="response_id">0</property>
-                <property name="draw_indicator">True</property>
-              </widget>
-              <packing>
-                <property name="right_attach">3</property>
-                <property name="top_attach">4</property>
-                <property name="bottom_attach">5</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkComboBoxEntry" id="parameter_combo">
-                <property name="visible">True</property>
-                <child internal-child="entry">
-                  <widget class="GtkEntry" id="comboboxentry-entry2">
-                  </widget>
-                </child>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">3</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="GtkLabel" id="label12354">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Command Line Parameters:</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>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkComboBoxEntry" id="target_combo">
-                <property name="visible">True</property>
-                <child internal-child="entry">
-                  <widget class="GtkEntry" id="comboboxentry-entry1">
-                  </widget>
-                </child>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="y_options"></property>
-                <property name="y_padding">3</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="button39">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="label">gtk-open</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">0</property>
-                <signal name="clicked" handler="on_select_target_clicked"/>
-              </widget>
-              <packing>
-                <property name="left_attach">2</property>
-                <property name="right_attach">3</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label12353">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Debugger Target:</property>
-              </widget>
-              <packing>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkLabel" id="label2">
-                <property name="visible">True</property>
-                <property name="events"></property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">Working Directory:</property>
-              </widget>
-              <packing>
-                <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="GtkFileChooserButton" id="working_dir_chooser">
-                <property name="visible">True</property>
-                <property name="events"></property>
-                <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
-                <property name="title" translatable="yes">Choose a working directory</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">3</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
-                <property name="y_options"></property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkExpander" id="expander1">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <child>
-                  <widget class="GtkHBox" id="hbox6">
-                    <property name="visible">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="spacing">5</property>
-                    <child>
-                      <widget class="GtkScrolledWindow" id="scrolledwindow3">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="shadow_type">GTK_SHADOW_OUT</property>
-                        <child>
-                          <widget class="GtkTreeView" id="environment_treeview">
-                            <property name="visible">True</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                          </widget>
-                        </child>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkVButtonBox" id="vbuttonbox2">
-                        <property name="visible">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="spacing">5</property>
-                        <property name="layout_style">GTK_BUTTONBOX_START</property>
-                        <child>
-                          <widget class="GtkButton" id="add_button">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                          </widget>
-                        </child>
-                        <child>
-                          <widget class="GtkButton" id="remove_button">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="label">gtk-remove</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                          </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>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label5">
-                    <property name="visible">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">Environment Variables:</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="right_attach">3</property>
-                <property name="top_attach">3</property>
-                <property name="bottom_attach">4</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="padding">5</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area7">
-            <property name="visible">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <widget class="GtkButton" id="cancelbutton4">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-close</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-6</property>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkButton" id="okbutton3">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-apply</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-10</property>
-              </widget>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkButton" id="runbutton">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-execute</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-5</property>
-              </widget>
-              <packing>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">GTK_PACK_END</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
   <widget class="GtkWindow" id="dialog_memory">
     <property name="title" translatable="yes">Memory</property>
     <property name="resizable">False</property>
     <child>
-      <widget class="GtkVBox" id="vbox1">
+      <widget class="GtkVBox" id="vbox4">
         <property name="visible">True</property>
         <property name="can_default">True</property>
         <property name="border_width">5</property>
@@ -1296,7 +1004,7 @@
           <widget class="GtkHBox" id="hbox2">
             <property name="visible">True</property>
             <child>
-              <widget class="GtkVBox" id="vbox2">
+              <widget class="GtkVBox" id="vbox5">
                 <property name="visible">True</property>
                 <child>
                   <widget class="GtkEventBox" id="eventbox_up">
@@ -1405,7 +1113,7 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkHBox" id="hbox1">
+          <widget class="GtkHBox" id="hbox7">
             <property name="visible">True</property>
             <child>
               <widget class="GtkButton" id="button_inspect">
@@ -1896,7 +1604,7 @@
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
     <child internal-child="vbox">
-      <widget class="GtkVBox" id="dialog-vbox25">
+      <widget class="GtkVBox" id="dialog-vbox14">
         <property name="visible">True</property>
         <child>
           <widget class="GtkHBox" id="hbox1134">
@@ -1904,7 +1612,7 @@
             <property name="border_width">10</property>
             <property name="spacing">5</property>
             <child>
-              <widget class="GtkLabel" id="label12350">
+              <widget class="GtkLabel" id="label8">
                 <property name="visible">True</property>
                 <property name="label" translatable="yes">Debugger command:</property>
               </widget>
@@ -1930,7 +1638,7 @@
           </packing>
         </child>
         <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="dialog-action_area25">
+          <widget class="GtkHButtonBox" id="dialog-action_area14">
             <property name="visible">True</property>
             <property name="layout_style">GTK_BUTTONBOX_END</property>
             <child>
@@ -2008,7 +1716,7 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkButton" id="add_button">
+              <widget class="GtkButton" id="add_button4">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -2025,12 +1733,12 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkVBox" id="vbox4">
+              <widget class="GtkVBox" id="vbox6">
                 <property name="visible">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="spacing">5</property>
                 <child>
-                  <widget class="GtkButton" id="remove_button">
+                  <widget class="GtkButton" id="remove_button1">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
@@ -2129,4 +1837,332 @@
       </widget>
     </child>
   </widget>
+  <widget class="GtkDialog" id="remote_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Connect to remote target</property>
+    <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox17">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkVBox" id="vbox9">
+            <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <widget class="GtkRadioButton" id="tcpip_radio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">TCP/IP Connection</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkAlignment" id="tcpip_container">
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox10">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkLabel" id="label11">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Address :</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="tcpip_address_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">â</property>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label13">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Port :</property>
+                      </widget>
+                      <packing>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="tcpip_port_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">â</property>
+                      </widget>
+                      <packing>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkRadioButton" id="serial_radio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">Serial Line Connection</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">tcpip_radio</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkAlignment" id="serial_container">
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <child>
+                  <widget class="GtkEntry" id="serial_port_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">â</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area17">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="button2">
+                <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="button5">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-apply</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-10</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="button1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="label" translatable="yes">gtk-connect</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-3</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkWindow" id="debug_manager_preferences">
+    <property name="title" translatable="yes">window1</property>
+    <child>
+      <widget class="GtkVBox" id="preferences_container">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <child>
+          <widget class="GtkFrame" id="frame6">
+            <property name="visible">True</property>
+            <property name="border_width">10</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">GTK_SHADOW_NONE</property>
+            <child>
+              <widget class="GtkAlignment" id="alignment6">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <widget class="GtkVBox" id="vbox8">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="local_radio">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Disable</property>
+                        <property name="response_id">0</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:debug.manager.tcp.connection">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">TCP/IP Connection</property>
+                        <property name="use_underline">True</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">local_radio</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkAlignment" id="tcp_container">
+                        <property name="visible">True</property>
+                        <property name="border_width">6</property>
+                        <child>
+                          <widget class="GtkHBox" id="hbox6">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkLabel" id="label12">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Address :</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkEntry" id="preferences_entry:text::0:debug.manager.tcp.address">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">â</property>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label14">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Port :</property>
+                              </widget>
+                              <packing>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkEntry" id="preferences_entry:text::0:debug.manager.tcp.port">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">â</property>
+                              </widget>
+                              <packing>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="preferences_toggle:bool:0:0:debug.manager.serial.connection">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Serial Line Connection</property>
+                        <property name="use_underline">True</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">local_radio</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkAlignment" id="serial_container">
+                        <property name="visible">True</property>
+                        <property name="border_width">6</property>
+                        <child>
+                          <widget class="GtkEntry" id="preferences_entry:text::0:debug.manager.serial.port">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">â</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label10">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
+                <property name="label" translatable="yes">&lt;b&gt;Remote debugging&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </widget>
+              <packing>
+                <property name="type">label_item</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Modified: trunk/plugins/debug-manager/anjuta-debug-manager.ui
==============================================================================
--- trunk/plugins/debug-manager/anjuta-debug-manager.ui	(original)
+++ trunk/plugins/debug-manager/anjuta-debug-manager.ui	Tue Oct 14 20:52:45 2008
@@ -42,6 +42,7 @@
 				<placeholder name="PlaceHolderRunCommands">
 					<menuitem name="RunTarget" action="ActionDebuggerRunTarget" />
 					<menuitem name="AttachProcess" action="ActionDebuggerAttachProcess" />
+					<menuitem name="DebugRemote" action="ActionDebuggerDebugRemote"/>
 				</placeholder>
 				<placeholder name="PlaceHolderStopCommands">
 					<menuitem name="Stop" action="ActionDebuggerStop" />

Modified: trunk/plugins/debug-manager/command.c
==============================================================================
--- trunk/plugins/debug-manager/command.c	(original)
+++ trunk/plugins/debug-manager/command.c	Tue Oct 14 20:52:45 2008
@@ -62,9 +62,10 @@
 	SET_ENVIRONMENT_COMMAND,
 	UNLOAD_COMMAND,         /* Program loaded */
 	START_COMMAND,         
+	CONNECT_COMMAND,         
 	BREAK_LINE_COMMAND,		  /* Program loaded - Program stopped */
-	BREAK_FUNCTION_COMMAND,
-	BREAK_ADDRESS_COMMAND,	/* 0x10 */
+	BREAK_FUNCTION_COMMAND,  /* 0x10 */
+	BREAK_ADDRESS_COMMAND,
 	ENABLE_BREAK_COMMAND,
 	IGNORE_BREAK_COMMAND,
 	CONDITION_BREAK_COMMAND,
@@ -79,8 +80,8 @@
 	STEP_OUT_COMMAND,
 	RUN_COMMAND,		
 	RUN_TO_COMMAND,
-	STEPI_IN_COMMAND,
-	STEPI_OVER_COMMAND,			/* 0x20 */
+	STEPI_IN_COMMAND,			/* 0x20 */
+	STEPI_OVER_COMMAND,
 	RUN_TO_ADDRESS_COMMAND,
 	EXIT_COMMAND,
 	HANDLE_SIGNAL_COMMAND,
@@ -95,8 +96,8 @@
 	INFO_VARIABLES_COMMAND,
 	SET_FRAME_COMMAND,
 	LIST_FRAME_COMMAND,
-	UPDATE_REGISTER_COMMAND,
-	WRITE_REGISTER_COMMAND,		/* 0x30 */
+	UPDATE_REGISTER_COMMAND,	/* 0x30 */
+	WRITE_REGISTER_COMMAND,
 	EVALUATE_COMMAND,
 	INSPECT_COMMAND,
 	PRINT_COMMAND,
@@ -150,6 +151,9 @@
 	DMA_START_COMMAND =
 		START_COMMAND | RUN_PROGRAM |
 		NEED_PROGRAM_LOADED | NEED_PROGRAM_STOPPED,
+	DMA_CONNECT_COMMAND =
+		CONNECT_COMMAND | RUN_PROGRAM |
+		NEED_PROGRAM_LOADED | NEED_PROGRAM_STOPPED,
 	DMA_BREAK_LINE_COMMAND =
 		BREAK_LINE_COMMAND |
 		NEED_PROGRAM_LOADED | NEED_PROGRAM_STOPPED,
@@ -299,6 +303,7 @@
 			GList *dirs;
 		} load;
 		struct {
+			gchar *server;
 			gchar *args;
 			gboolean terminal;
 			gboolean stop;
@@ -417,6 +422,12 @@
 		cmd->data.start.terminal = va_arg (args, gboolean);
 		cmd->data.start.stop = va_arg (args, gboolean);
 	    break;
+	case CONNECT_COMMAND:
+		cmd->data.start.server = g_strdup (va_arg (args, gchar *));
+		cmd->data.start.args = g_strdup (va_arg (args, gchar *));
+		cmd->data.start.terminal = va_arg (args, gboolean);
+		cmd->data.start.stop = va_arg (args, gboolean);
+	    break;
 	case RUN_COMMAND:
 		break;
 	case RUN_TO_COMMAND:
@@ -667,6 +678,12 @@
 }
 
 gboolean
+dma_queue_connect (DmaDebuggerQueue *self, const gchar *server, const gchar *args, gboolean terminal, gboolean stop)
+{
+	return dma_debugger_queue_append (self, dma_command_new (DMA_CONNECT_COMMAND, server, args, terminal, stop));
+}
+
+gboolean
 dma_queue_unload (DmaDebuggerQueue *self)
 {
 	return dma_debugger_queue_append (self, dma_command_new (DMA_UNLOAD_COMMAND));
@@ -1038,6 +1055,8 @@
 		if (cmd->data.watch.value != NULL) g_free (cmd->data.watch.value);
 		break;
 	case START_COMMAND:
+	case CONNECT_COMMAND:
+		if (cmd->data.start.server) g_free (cmd->data.start.server);
 		if (cmd->data.start.args) g_free (cmd->data.start.args);
 		break;
 	case LOAD_COMMAND:
@@ -1169,6 +1188,9 @@
 	case START_COMMAND:
 		ret = ianjuta_debugger_start (debugger, cmd->data.start.args, cmd->data.start.terminal, cmd->data.start.stop, err);
 	    break;
+	case CONNECT_COMMAND:
+		ret = ianjuta_debugger_connect (debugger, cmd->data.start.server, cmd->data.start.args, cmd->data.start.terminal, cmd->data.start.stop, err);
+	    break;
 	case RUN_COMMAND:
 		ret = ianjuta_debugger_run (debugger, err);	
 		break;
@@ -1359,6 +1381,7 @@
 	case QUIT_COMMAND:
 	case ABORT_COMMAND:
 	case START_COMMAND:
+	case CONNECT_COMMAND:
 	case SET_WORKING_DIRECTORY_COMMAND:
 	case SET_ENVIRONMENT_COMMAND:	
 	case RUN_COMMAND:

Modified: trunk/plugins/debug-manager/command.h
==============================================================================
--- trunk/plugins/debug-manager/command.h	(original)
+++ trunk/plugins/debug-manager/command.h	Tue Oct 14 20:52:45 2008
@@ -63,6 +63,7 @@
 gboolean dma_queue_set_environment (DmaDebuggerQueue *self, gchar **variables);
 gboolean dma_queue_attach (DmaDebuggerQueue *self, pid_t pid, const GList *search_dirs);
 gboolean dma_queue_start (DmaDebuggerQueue *self, const gchar *args, gboolean terminal, gboolean stop);
+gboolean dma_queue_connect (DmaDebuggerQueue *self, const gchar *server, const gchar *args, gboolean terminal, gboolean stop);
 gboolean dma_queue_unload (DmaDebuggerQueue *self);
 gboolean dma_queue_quit (DmaDebuggerQueue *self);
 gboolean dma_queue_abort (DmaDebuggerQueue *self);

Modified: trunk/plugins/debug-manager/plugin.c
==============================================================================
--- trunk/plugins/debug-manager/plugin.c	(original)
+++ trunk/plugins/debug-manager/plugin.c	Tue Oct 14 20:52:45 2008
@@ -583,7 +583,7 @@
 on_start_debug_activate (GtkAction* action, DebugManagerPlugin* this)
 {
 	enable_log_view (this, TRUE);
-	dma_run_target (this->start);
+	dma_run_target (this->start, NULL);
 }
 
 static void
@@ -594,6 +594,14 @@
 }
 
 static void
+on_start_remote_debug_action_activate (GtkAction* action, DebugManagerPlugin* this)
+{
+	/* Returns true if user clicked "Connect" */
+	enable_log_view (this, TRUE);
+	dma_run_remote_target (this->start, NULL, NULL);
+}
+
+static void
 on_debugger_stop_activate (GtkAction* action, DebugManagerPlugin* plugin)
 {
 	if (plugin->start)
@@ -848,6 +856,14 @@
 		G_CALLBACK (on_attach_to_project_action_activate)
 	},
 	{
+		"ActionDebuggerDebugRemote",
+		"debugger-remote-target",
+		N_("Debug _Remote Target..."),
+		NULL,
+		N_("Connect to a remote debugging target"),
+		G_CALLBACK (on_start_remote_debug_action_activate),
+	},
+	{
 		"ActionDebuggerStop",
 		GTK_STOCK_STOP,
 		N_("Stop Debugger"), 
@@ -1054,6 +1070,7 @@
 	DebugManagerPlugin *this;
     static gboolean initialized = FALSE;
 	AnjutaUI *ui;
+	GtkAction *action;
 	
 	DEBUG_PRINT ("DebugManagerPlugin: Activating Debug Manager plugin...");
 	this = ANJUTA_PLUGIN_DEBUG_MANAGER (plugin);
@@ -1207,7 +1224,7 @@
 		g_object_remove_weak_pointer (G_OBJECT (this->view), (gpointer*)(gpointer)&this->view);
         this->view = NULL;
 	}
-	
+
 	return TRUE;
 }
 

Modified: trunk/plugins/debug-manager/start.c
==============================================================================
--- trunk/plugins/debug-manager/start.c	(original)
+++ trunk/plugins/debug-manager/start.c	Tue Oct 14 20:52:45 2008
@@ -125,6 +125,8 @@
 
 	gboolean stop_at_beginning;
 	GList *source_dirs;
+
+	gchar *remote_debugger;
 	
 	gchar *build_target;
 	IAnjutaBuilderHandle build_handle;
@@ -141,6 +143,15 @@
 #define UP_BUTTON "up_button"
 #define DOWN_BUTTON "down_button"
 
+#define REMOTE_DEBUG_DIALOG "remote_dialog"
+#define TCPIP_ADDRESS_ENTRY "tcpip_address_entry"
+#define TCPIP_PORT_ENTRY "tcpip_port_entry"
+#define TCPIP_RADIO "tcpip_radio"
+#define TCPIP_CONTAINER "tcpip_container"
+#define SERIAL_PORT_ENTRY "serial_port_entry"
+#define SERIAL_RADIO "serial_radio"
+#define SERIAL_CONTAINER "serial_container"
+
 /* Constants
  *---------------------------------------------------------------------------*/
 
@@ -244,6 +255,7 @@
 
 	anjuta_session_set_string_list (session, "Debugger", "Source directories", self->source_dirs);
 	anjuta_session_set_int (session, "Debugger", "Stop at beginning", self->stop_at_beginning + 1);
+	anjuta_session_set_string (session, "Debugger", "Remote target", self->remote_debugger);
 }
 
 static void on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *session, DmaStart *self)
@@ -266,6 +278,9 @@
 		self->stop_at_beginning = TRUE;	/* Default value */
 	else
 		self->stop_at_beginning = stop_at_beginning - 1;
+	
+	g_free (self->remote_debugger);
+	self->remote_debugger = anjuta_session_get_string (session, "Debugger", "Remote target");
 }
 
 /* Attach to process private functions
@@ -822,7 +837,7 @@
 }
 
 static gboolean
-start_target (DmaStart *this)
+start_remote_target (DmaStart *this, const gchar *target)
 {
 	gchar *dir_uri;
 	gchar *dir;
@@ -853,7 +868,14 @@
 	dma_queue_set_environment (this->debugger, env);
 	g_strfreev (env);
 	
-	dma_queue_start (this->debugger, args, run_in_terminal, FALSE);
+	if (target == NULL)
+	{
+		dma_queue_start (this->debugger, args, run_in_terminal, FALSE);
+	}
+	else
+	{
+		dma_queue_connect (this->debugger, target, args, run_in_terminal, FALSE);
+	}
 	g_free (args);
 	
 	return TRUE;
@@ -861,6 +883,12 @@
 }
 
 static gboolean
+start_target (DmaStart *this)
+{
+	return start_remote_target (this, NULL);
+}
+
+static gboolean
 load_target (DmaStart *this, const gchar *target)
 {
 	gchar *mime_type;
@@ -880,7 +908,7 @@
 	g_free (filename);
 	g_free (mime_type);
 
-	return start_target (this);
+	return TRUE;
 }
 
 static void
@@ -892,6 +920,7 @@
 	{
 		/* Up to date, start debugger */
 		load_target (this, this->build_target);
+		start_target (this);
 	}
 	
 	g_free (this->build_target);
@@ -907,6 +936,7 @@
 	{
 		/* Up to date, start debugger */
 		load_target (this, this->build_target);
+		start_target (this);
 	}
 	else if (err->code == IANJUTA_BUILDER_FAILED)
 	{
@@ -951,7 +981,7 @@
 	else
 	{
 		/* Unable to build target, just launch debugger */
-		return load_target (this, target);
+		return load_target (this, target) && start_target (this);
 	}	
 }
 
@@ -970,6 +1000,109 @@
 	return check_target (this, target);
 }
 
+/* Remote target dialog
+ *---------------------------------------------------------------------------*/
+
+static void on_radio_toggled(GtkWidget* toggle_button, GtkWidget* container)
+{
+	gtk_widget_set_sensitive(container, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
+}
+
+static gboolean
+show_remote_dialog (DmaStart *this)
+{
+	GladeXML *gxml;
+	GtkWindow *parent;
+	GtkWidget *dialog;
+	GtkEntry *tcpip_address_entry;
+	GtkEntry *tcpip_port_entry;
+	GtkEntry *serial_port_entry;
+	GtkToggleButton *serial_radio;
+	GtkToggleButton *tcpip_radio;
+	GtkWidget *container;
+	
+	gint res;
+
+	parent = GTK_WINDOW (this->plugin->shell);
+	gxml = glade_xml_new (GLADE_FILE, REMOTE_DEBUG_DIALOG, NULL);
+	if (gxml == NULL)
+	{
+		anjuta_util_dialog_error(parent, _("Missing file %s"), GLADE_FILE);
+		return FALSE;
+	}
+
+	/* Fetch out the widget we care about for now */
+	dialog = glade_xml_get_widget (gxml, REMOTE_DEBUG_DIALOG);
+	tcpip_address_entry = GTK_ENTRY (glade_xml_get_widget (gxml, TCPIP_ADDRESS_ENTRY));
+	tcpip_port_entry = GTK_ENTRY (glade_xml_get_widget (gxml, TCPIP_PORT_ENTRY));
+	serial_port_entry = GTK_ENTRY (glade_xml_get_widget (gxml, SERIAL_PORT_ENTRY));
+	tcpip_radio = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gxml, TCPIP_RADIO));
+	serial_radio = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gxml, SERIAL_RADIO));
+	
+	/* Connect signals */	
+	container = glade_xml_get_widget (gxml, TCPIP_CONTAINER);
+	g_signal_connect (G_OBJECT (tcpip_radio), "toggled", G_CALLBACK (on_radio_toggled), container);
+	container = glade_xml_get_widget (gxml, SERIAL_CONTAINER);
+	g_signal_connect (G_OBJECT (serial_radio), "toggled", G_CALLBACK (on_radio_toggled), container);	
+	g_object_unref (gxml);
+
+	/* Populate the remote target */
+	if (this->remote_debugger)
+	{
+		if (strncmp(this->remote_debugger, "tcp:", 4) == 0)
+		{
+			gchar *port = strrchr (this->remote_debugger, ':');
+			
+			if (port != NULL)
+			{
+				gtk_entry_set_text (GTK_ENTRY (tcpip_port_entry), port + 1);
+				*port = '\0';
+			}
+			gtk_entry_set_text (GTK_ENTRY (tcpip_address_entry), this->remote_debugger + 4);
+			if (port != NULL) *port = ':';
+			gtk_toggle_button_set_active (tcpip_radio, TRUE);
+			gtk_toggle_button_set_active (serial_radio, FALSE);
+		}
+		else if (strncmp(this->remote_debugger,"serial:", 7) == 0)
+		{
+			gtk_entry_set_text (GTK_ENTRY (serial_port_entry), this->remote_debugger + 7);
+			gtk_toggle_button_set_active (serial_radio, TRUE);
+			gtk_toggle_button_set_active (tcpip_radio, FALSE);
+		}
+	}
+
+	res = gtk_dialog_run (GTK_DIALOG (dialog));
+	
+	if (res == GTK_RESPONSE_APPLY || res == GTK_RESPONSE_ACCEPT)
+	{
+		/* Save these settings */
+		g_free (this->remote_debugger);
+		if (gtk_toggle_button_get_active (serial_radio))
+		{
+			this->remote_debugger = g_strconcat ("serial:",
+				gtk_entry_get_text (serial_port_entry),
+				NULL);
+		}
+		else
+		{
+			this->remote_debugger = g_strconcat ("tcp:",
+				gtk_entry_get_text (tcpip_address_entry),
+				":",
+				gtk_entry_get_text (tcpip_port_entry),
+				NULL);
+		}
+	}
+	gtk_widget_destroy (dialog);
+
+	if (res == GTK_RESPONSE_ACCEPT)
+	{
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+
 /* Add source dialog
  *---------------------------------------------------------------------------*/
 
@@ -1197,29 +1330,70 @@
 }
 
 gboolean
-dma_run_target (DmaStart *this)
+dma_run_target (DmaStart *this, const gchar *target)
 {
-	gchar *target;
+	gchar *target_uri = NULL;
 
-	anjuta_shell_get (ANJUTA_PLUGIN (this->plugin)->shell,
-	 				  RUN_PROGRAM_URI, G_TYPE_STRING, &target, NULL);	
+	if (target == NULL)
+	{
+		anjuta_shell_get (ANJUTA_PLUGIN (this->plugin)->shell,
+	 				  RUN_PROGRAM_URI, G_TYPE_STRING, &target_uri, NULL);	
+		target = target_uri;
+	}
 	
 	if (target == NULL)
 	{
 		/* Launch parameter dialog to get a target name */
 		show_parameters_dialog (this);
 		anjuta_shell_get (ANJUTA_PLUGIN (this->plugin)->shell,
-	 				  RUN_PROGRAM_URI, G_TYPE_STRING, &target, NULL);
+	 				  RUN_PROGRAM_URI, G_TYPE_STRING, &target_uri, NULL);
 		/* No target set by user */
-		if (target == NULL) return FALSE;
+		if (target_uri == NULL) return FALSE;
+		target = target_uri;
 	}
 	
 	if (!dma_start_load_and_start_uri (this, target)) return FALSE;
-	g_free (target);
+	g_free (target_uri);
 	
 	return TRUE;
 }
 
+gboolean
+dma_run_remote_target (DmaStart *this, const gchar *remote, const gchar *target)
+{
+	gchar *target_uri;
+
+	if (target == NULL)
+	{
+		anjuta_shell_get (ANJUTA_PLUGIN (this->plugin)->shell,
+		 				  RUN_PROGRAM_URI, G_TYPE_STRING, &target_uri, NULL);	
+		target = target_uri;
+	}
+	
+	if (target == NULL)
+	{
+		/* Launch parameter dialog to get a target name */
+		show_parameters_dialog (this);
+		anjuta_shell_get (ANJUTA_PLUGIN (this->plugin)->shell,
+	 				  RUN_PROGRAM_URI, G_TYPE_STRING, &target_uri, NULL);
+		/* No target set by user */
+		if (target_uri == NULL) return FALSE;
+		target = target_uri;
+	}
+	
+	if (remote == NULL)
+	{
+		if (!show_remote_dialog (this)) return FALSE;
+		remote = this->remote_debugger;		
+		if (remote == NULL) return FALSE;
+	}
+
+	if (!load_target (this, target)) return FALSE;
+	g_free (target_uri);
+	
+	return start_remote_target (this, remote);
+}
+
 /* Constructor & Destructor
  *---------------------------------------------------------------------------*/
 

Modified: trunk/plugins/debug-manager/start.h
==============================================================================
--- trunk/plugins/debug-manager/start.h	(original)
+++ trunk/plugins/debug-manager/start.h	Tue Oct 14 20:52:45 2008
@@ -32,7 +32,8 @@
 
 void dma_add_source_path (DmaStart *self);
 void dma_attach_to_process (DmaStart *this);
-gboolean dma_run_target (DmaStart *this);
+gboolean dma_run_target (DmaStart *this, const gchar* target);
+gboolean dma_run_remote_target (DmaStart *this, const gchar *remote, const gchar *target);
 gboolean dma_rerun_target (DmaStart *this);
 gboolean dma_quit_debugger (DmaStart *this);
 

Modified: trunk/plugins/gdb/debugger.c
==============================================================================
--- trunk/plugins/gdb/debugger.c	(original)
+++ trunk/plugins/gdb/debugger.c	Tue Oct 14 20:52:45 2008
@@ -88,6 +88,7 @@
 	gboolean prog_is_running;
 	gboolean prog_is_attached;
 	gboolean prog_is_loaded;
+	gboolean prog_is_remote; /* Whether we are debugging a remote target */
 	gboolean debugger_is_started;
 	guint debugger_is_busy;
 	gint post_execution_flag;
@@ -106,6 +107,7 @@
 	gboolean starting;
 	gboolean terminating;
 	gboolean loading;
+	gchar *remote_server;
 	
 	/* GDB command queue */
 	GList *cmd_queqe;
@@ -204,6 +206,8 @@
 	IANJUTA_DEBUGGER_UNABLE_TO_OPEN_FILE},
 	{"No executable file specified.",
 	IANJUTA_DEBUGGER_PROGRAM_NOT_FOUND},
+	{"*: Connection refused.",
+	IANJUTA_DEBUGGER_UNABLE_TO_CONNECT},
 	{NULL, 0}};
 
 static guint
@@ -213,9 +217,7 @@
 
 	for (msg = GdbErrorMessage; msg->msg != NULL; msg++)
 	{
-		gsize len = strlen (msg->msg);
-		
-		if (memcmp (msg->msg, message, len) == 0)
+		if (g_pattern_match_simple(msg->msg, message))
 		{
 			return msg->code;
 		}
@@ -266,6 +268,8 @@
 	debugger->priv->terminating = FALSE;
 	debugger->priv->skip_next_prompt = FALSE;
 	debugger->priv->command_output_sent = FALSE;
+	debugger->priv->prog_is_remote = FALSE;
+	debugger->priv->remote_server = NULL;
 
 	debugger->priv->current_cmd.cmd = NULL;
 	debugger->priv->current_cmd.parser = NULL;
@@ -749,7 +753,6 @@
 debugger_set_environment (Debugger *debugger, gchar **variables)
 {
 	gchar *buff;
-	GList *node;
 
 	DEBUG_PRINT ("In function: set_environment()");
 
@@ -760,7 +763,7 @@
 		for (; *variables != NULL; variables++)
 		{
 			buff = g_strdup_printf("set environment %s", *variables);
-			debugger_queue_command (debugger, buff, FALSE, FALSE, NULL, NULL, NULL);
+			debugger_queue_command (debugger, buff, FALSE, FALSE, NULL, NULL, NULL); 
 			g_free (buff);
 		}
 	}
@@ -1498,10 +1501,12 @@
 		error = gdb_parse_error (debugger, val);
 
 		/* Trap state error */
-		if ((error != NULL) && (error->code == IANJUTA_DEBUGGER_PROGRAM_NOT_FOUND))
+		if ((error != NULL) && ((error->code == IANJUTA_DEBUGGER_PROGRAM_NOT_FOUND) ||
+								(error->code == IANJUTA_DEBUGGER_UNABLE_TO_CONNECT)))
 		{
 			debugger->priv->prog_is_running = FALSE;
 			debugger->priv->prog_is_attached = FALSE;
+			debugger->priv->prog_is_remote = FALSE;
 			debugger->priv->prog_is_loaded = FALSE;
 		}
 
@@ -1635,8 +1640,10 @@
 	debugger->priv->prog_is_running = FALSE;
 	debugger->priv->prog_is_attached = FALSE;
 	debugger->priv->prog_is_loaded = FALSE;
+	debugger->priv->prog_is_remote = FALSE;
 	debugger->priv->debugger_is_busy = 0;
 	debugger->priv->skip_next_prompt = FALSE;
+
 	if (!debugger->priv->terminating)
 	{
 		err = g_error_new  (IANJUTA_DEBUGGER_ERROR,
@@ -1735,8 +1742,10 @@
 	debugger->priv->prog_is_attached = FALSE;
 	debugger->priv->inferior_pid = 0;
 	debugger->priv->prog_is_loaded = FALSE;
+	debugger->priv->prog_is_remote = FALSE;
 	debugger->priv->debugger_is_busy = 0;
 	debugger->priv->debugger_is_started = FALSE;
+
 	if (debugger->priv->instance != NULL)
 	{
 		g_signal_emit_by_name (debugger->priv->instance, "debugger-stopped", NULL);
@@ -1823,8 +1832,50 @@
 	}		
 }
 
+static void
+debugger_is_connected (Debugger *debugger, const GDBMIValue *mi_results,
+								const GList *cli_results, GError *error)
+{
+	g_return_if_fail (debugger->priv->remote_server != NULL);
+	
+	if (error != NULL)
+	{
+		gchar *msg;
+		gboolean retry;
+		
+		msg = g_strdup_printf(_("Unable to connect to remote target, %s.\n Do you want to try again ?"),
+							  error->message);
+		retry = anjuta_util_dialog_boolean_question (debugger->priv->parent_win, msg);
+		g_free (msg);
+		if (retry)
+		{
+			gchar *cmd;
+			
+			cmd = g_strconcat ("-target-select remote ", debugger->priv->remote_server, NULL);
+			debugger_queue_command (debugger, cmd, FALSE, FALSE, debugger_is_connected, NULL, NULL);
+			g_free (cmd);
+		}
+	}
+	else
+	{
+		if (debugger->priv->output_callback)
+		{
+			debugger->priv->output_callback (IANJUTA_DEBUGGER_OUTPUT,
+										 _("Debugger connected\n"),
+										 debugger->priv->output_user_data);
+		}
+		debugger->priv->prog_is_remote = TRUE;
+		debugger->priv->prog_is_running = TRUE;
+		/* It is not really a shared lib event, but it allows to restart
+	 	* the program after setting breakpoints. It is better to restart
+	 	* it because we don't have the normal stop frame that tell where
+	 	* the program is stopped */
+		debugger->priv->solib_event = TRUE;
+	}
+}
+
 void
-debugger_start_program (Debugger *debugger, const gchar* args, const gchar* tty, gboolean stop)
+debugger_start_program (Debugger *debugger, const gchar *remote, const gchar* args, const gchar* tty, gboolean stop)
 {
 	gchar *cmd;
 
@@ -1833,6 +1884,7 @@
 	g_return_if_fail (IS_DEBUGGER (debugger));
 	g_return_if_fail (debugger->priv->prog_is_running == FALSE);
 
+	
 	/* Without a terminal, the output of the debugged program
 	 * are lost */
 	if (tty)
@@ -1854,11 +1906,25 @@
 		g_free (cmd);
 	}
 
-	debugger_queue_command (debugger, "-exec-run", FALSE, FALSE, NULL, NULL, NULL);
-	
-	/* Get pid of program on next stop */
-	debugger_queue_command (debugger, "info program", FALSE, FALSE, debugger_info_program_finish, NULL, NULL);
-	debugger->priv->post_execution_flag = DEBUGGER_NONE;
+	/* If we are remote then we have to just continue here since we always
+	 * get stopped as part of the remote target setup.
+	 */
+	g_free (debugger->priv->remote_server);
+	if (remote != NULL)
+	{
+		debugger->priv->remote_server = g_strdup (remote);
+		cmd = g_strconcat ("-target-select remote ", remote, NULL);
+		debugger_queue_command (debugger, cmd, FALSE, FALSE, debugger_is_connected, NULL, NULL);
+		g_free (cmd);
+	}
+	else
+	{
+		debugger_queue_command (debugger, "-exec-run", FALSE, FALSE, NULL, NULL, NULL);
+		
+		/* Get pid of program on next stop */
+		debugger_queue_command (debugger, "info program", FALSE, FALSE, debugger_info_program_finish, NULL, NULL);
+		debugger->priv->post_execution_flag = DEBUGGER_NONE;
+	}
 }
 
 static void
@@ -3780,6 +3846,7 @@
 	g_string_free (debugger->priv->stdo_line, TRUE);
 	g_string_free (debugger->priv->stdo_acc, TRUE);
 	g_string_free (debugger->priv->stde_line, TRUE);
+	g_free (debugger->priv->remote_server);
 	g_free (debugger->priv);
 	G_OBJECT_CLASS (parent_class)->finalize (obj);
 }

Modified: trunk/plugins/gdb/debugger.h
==============================================================================
--- trunk/plugins/gdb/debugger.h	(original)
+++ trunk/plugins/gdb/debugger.h	Tue Oct 14 20:52:45 2008
@@ -112,7 +112,7 @@
 gboolean debugger_set_environment (Debugger *debugger, gchar **variables);
 
 /* Execution */
-void debugger_start_program (Debugger *debugger, const gchar* args, const gchar* tty, gboolean stop);
+void debugger_start_program (Debugger *debugger, const gchar *server, const gchar* args, const gchar* tty, gboolean stop);
 void debugger_stop_program (Debugger *debugger);
 void debugger_restart_program (Debugger *debugger);
 void debugger_interrupt (Debugger *debugger);

Modified: trunk/plugins/gdb/plugin.c
==============================================================================
--- trunk/plugins/gdb/plugin.c	(original)
+++ trunk/plugins/gdb/plugin.c	Tue Oct 14 20:52:45 2008
@@ -432,7 +432,20 @@
 	gchar *tty;
 
 	tty = terminal ? gdb_plugin_start_terminal (this) : NULL;
-	debugger_start_program (this->debugger, argument, tty, stop);
+	debugger_start_program (this->debugger, NULL, argument, tty, stop);
+	g_free (tty);
+
+	return TRUE;
+}
+
+static gboolean
+idebugger_connect (IAnjutaDebugger *plugin, const gchar *server, const gchar *argument, gboolean terminal, gboolean stop, GError **err)
+{
+	GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin);
+	gchar *tty;
+
+	tty = terminal ? gdb_plugin_start_terminal (this) : NULL;
+	debugger_start_program (this->debugger, server, argument, tty, stop);
 	g_free (tty);
 
 	return TRUE;
@@ -799,6 +812,7 @@
 	iface->set_working_directory = idebugger_set_working_directory;
 	iface->set_environment = idebugger_set_environment;
 	iface->start = idebugger_start;
+	iface->connect = idebugger_connect;
 	iface->unload = idebugger_unload;
 	iface->quit = idebugger_quit;
 	iface->abort = idebugger_abort;



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