1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 Copyright (C) 2005 Sebastien Granjoux
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program as distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 * Implement the IAnjutaDebugger interface.
33 #include <libanjuta/interfaces/ianjuta-debugger.h>
34 #include <libanjuta/interfaces/ianjuta-breakpoint-debugger.h>
35 #include <libanjuta/interfaces/ianjuta-cpu-debugger.h>
36 #include <libanjuta/interfaces/ianjuta-variable-debugger.h>
37 #include <libanjuta/anjuta-debug.h>
38 #include <libanjuta/anjuta-plugin.h>
41 *---------------------------------------------------------------------------*/
50 /* Output callback data */
51 IAnjutaDebuggerOutputCallback output_callback
;
52 gpointer output_user_data
;
54 /* Log message window */
55 IAnjutaMessageView
*view
;
58 struct _GdbPluginClass
60 AnjutaPluginClass parent_class
;
64 *---------------------------------------------------------------------------*/
67 gdb_plugin_initialize (GdbPlugin
*this)
69 if (this->debugger
== NULL
)
73 parent
= GTK_WINDOW (ANJUTA_PLUGIN (this)->shell
);
74 this->debugger
= debugger_new (parent
, G_OBJECT (this));
75 debugger_set_output_callback (this->debugger
, this->output_callback
, this->output_user_data
);
76 if (this->view
) debugger_set_log (this->debugger
, this->view
);
80 /* AnjutaPlugin functions
81 *---------------------------------------------------------------------------*/
84 gdb_plugin_activate_plugin (AnjutaPlugin
* plugin
)
86 /* GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin); */
88 DEBUG_PRINT ("GDB: Activating Gdb plugin...");
94 gdb_plugin_deactivate_plugin (AnjutaPlugin
* plugin
)
96 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
98 DEBUG_PRINT ("GDB: Deactivating Gdb plugin...");
100 if (this->debugger
!= NULL
)
102 debugger_free (this->debugger
);
103 this->debugger
= NULL
;
110 *---------------------------------------------------------------------------*/
112 /* Used in dispose and finalize */
113 static gpointer parent_class
;
115 /* instance_init is the constructor. All functions should work after this
119 gdb_plugin_instance_init (GObject
* obj
)
121 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (obj
);
123 this->debugger
= NULL
;
124 this->output_callback
= NULL
;
127 /* dispose is the first destruction step. It is used to unref object created
128 * with instance_init in order to break reference counting cycles. This
129 * function could be called several times. All function should still work
130 * after this call. It has to called its parents.*/
133 gdb_plugin_dispose (GObject
* obj
)
135 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (obj
);
137 if (this->debugger
!= NULL
)
139 debugger_free (this->debugger
);
140 this->debugger
= NULL
;
142 GNOME_CALL_PARENT (G_OBJECT_CLASS
, dispose
, (G_OBJECT (obj
)));
145 /* finalize is the last destruction step. It must free all memory allocated
146 * with instance_init. It is called only one time just before releasing all
150 gdb_plugin_finalize (GObject
* obj
)
152 GNOME_CALL_PARENT (G_OBJECT_CLASS
, finalize
, (G_OBJECT (obj
)));
155 /* class_init intialize the class itself not the instance */
158 gdb_plugin_class_init (GObjectClass
* klass
)
160 AnjutaPluginClass
*plugin_class
= ANJUTA_PLUGIN_CLASS (klass
);
162 parent_class
= g_type_class_peek_parent (klass
);
164 plugin_class
->activate
= gdb_plugin_activate_plugin
;
165 plugin_class
->deactivate
= gdb_plugin_deactivate_plugin
;
166 klass
->dispose
= gdb_plugin_dispose
;
167 klass
->finalize
= gdb_plugin_finalize
;
170 /* Implementation of IAnjutaDebugger interface
171 *---------------------------------------------------------------------------*/
173 static IAnjutaDebuggerStatus
174 idebugger_get_status (IAnjutaDebugger
*plugin
, GError
**err
)
176 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
178 if (this->debugger
== NULL
)
180 return IANJUTA_DEBUGGER_STOPPED
;
184 return debugger_get_status (this->debugger
);
190 idebugger_initialize (IAnjutaDebugger
*plugin
, IAnjutaDebuggerOutputCallback callback
, gpointer user_data
, GError
**err
)
192 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
194 this->output_callback
= callback
;
195 this->output_user_data
= user_data
;
196 g_signal_emit_by_name (G_OBJECT (plugin
), "debugger-ready", IANJUTA_DEBUGGER_STOPPED
);
202 idebugger_load (IAnjutaDebugger
*plugin
, const gchar
*file
, const gchar
* mime_type
,
203 const GList
*search_dirs
, gboolean terminal
, GError
**err
)
205 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
206 gboolean is_libtool
= FALSE
;
208 /* Check allowed mime type */
209 if (strcmp (mime_type
, "application/x-executable") == 0)
212 else if (strcmp (mime_type
, "application/x-shellscript") == 0)
214 /* FIXME: We should really do more checks to confirm that
215 * this target is indeed libtool target
219 else if (strcmp (mime_type
, "application/x-core") == 0)
224 //return IANJUTA_DEBUGGER_NOT_IMPLEMENTED;
228 // a NULL filename could be used to check supported mime type
229 if (file
== NULL
) return TRUE
;
232 gdb_plugin_initialize (this);
234 return debugger_start (this->debugger
, search_dirs
, file
, is_libtool
, terminal
);
238 idebugger_unload (IAnjutaDebugger
*plugin
, GError
**err
)
240 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
242 debugger_stop (this->debugger
);
248 idebugger_attach (IAnjutaDebugger
*plugin
, pid_t pid
, const GList
*search_dirs
, GError
**err
)
250 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
253 gdb_plugin_initialize (this);
254 debugger_start (this->debugger
, search_dirs
, NULL
, FALSE
, FALSE
);
255 debugger_attach_process (this->debugger
, pid
);
261 idebugger_start (IAnjutaDebugger
*plugin
, const gchar
*argument
, GError
**err
)
263 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
265 debugger_start_program (this->debugger
, argument
);
271 idebugger_quit (IAnjutaDebugger
*plugin
, GError
**err
)
273 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
275 if (!debugger_stop (this->debugger
))
277 DEBUG_PRINT ("set error");
278 g_set_error (err
, IANJUTA_DEBUGGER_ERROR
, IANJUTA_DEBUGGER_CANCEL
, "Command cancelled by user");
289 idebugger_abort (IAnjutaDebugger
*plugin
, GError
**err
)
291 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
293 DEBUG_PRINT ("idebugger abort\n");
294 if (!debugger_abort (this->debugger
))
296 g_set_error (err
, IANJUTA_DEBUGGER_ERROR
, IANJUTA_DEBUGGER_CANCEL
, "Command cancelled by user");
307 idebugger_run (IAnjutaDebugger
*plugin
, GError
**err
)
309 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
311 debugger_run (this->debugger
);
317 idebugger_step_in (IAnjutaDebugger
*plugin
, GError
**err
)
319 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
321 debugger_step_in (this->debugger
);
327 idebugger_step_over (IAnjutaDebugger
*plugin
, GError
**err
)
329 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
331 debugger_step_over (this->debugger
);
337 idebugger_run_to (IAnjutaDebugger
*plugin
, const gchar
*file
,
338 gint line
, GError
**err
)
340 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
342 debugger_run_to_position (this->debugger
, file
, line
);
348 idebugger_step_out (IAnjutaDebugger
*plugin
, GError
**err
)
350 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
352 debugger_step_out (this->debugger
);
358 idebugger_exit (IAnjutaDebugger
*plugin
, GError
**err
)
360 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
362 debugger_stop_program (this->debugger
);
368 idebugger_interrupt (IAnjutaDebugger
*plugin
, GError
**err
)
370 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
372 debugger_interrupt (this->debugger
);
378 idebugger_inspect (IAnjutaDebugger
*plugin
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
380 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
382 debugger_evaluate (this->debugger
, name
, callback
, user_data
);
388 idebugger_evaluate (IAnjutaDebugger
*plugin
, const gchar
*name
, const gchar
*value
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
390 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
393 buf
= g_strconcat ("\"", name
, " = ", value
, "\"", NULL
);
394 debugger_evaluate (this->debugger
, buf
, callback
, user_data
);
401 idebugger_send_command (IAnjutaDebugger
*plugin
, const gchar
* command
, GError
**err
)
403 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
405 debugger_command (this->debugger
, command
, FALSE
, NULL
, NULL
);
411 idebugger_print (IAnjutaDebugger
*plugin
, const gchar
* variable
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
413 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
415 debugger_print (this->debugger
, variable
, callback
, user_data
);
421 idebugger_list_local (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
423 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
425 debugger_list_local (this->debugger
, callback
, user_data
);
431 idebugger_list_argument (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
433 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
435 debugger_list_argument (this->debugger
, callback
, user_data
);
441 idebugger_info_signal (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
443 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
445 debugger_info_signal (this->debugger
, callback
, user_data
);
451 idebugger_info_sharedlib (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
453 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
455 debugger_info_sharedlib (this->debugger
, callback
, user_data
);
461 idebugger_handle_signal (IAnjutaDebugger
*plugin
, const gchar
* name
, gboolean stop
, gboolean print
, gboolean ignore
, GError
**err
)
464 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
466 cmd
= g_strdup_printf("handle %s %sstop %sprint %spass", name
, stop
? "" : "no", print
? "" : "no", ignore
? "" : "no");
467 debugger_command (this->debugger
, cmd
, FALSE
, NULL
, NULL
);
474 idebugger_info_frame (IAnjutaDebugger
*plugin
, guint frame
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
476 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
478 debugger_info_frame (this->debugger
, frame
, callback
, user_data
);
484 idebugger_info_args (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
486 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
488 debugger_info_args (this->debugger
, callback
, user_data
);
494 idebugger_info_target (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
496 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
498 debugger_info_target (this->debugger
, callback
, user_data
);
504 idebugger_info_program (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
506 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
508 debugger_info_program (this->debugger
, callback
, user_data
);
514 idebugger_info_udot (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
516 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
518 debugger_info_udot (this->debugger
, callback
, user_data
);
524 idebugger_info_variables (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
526 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
528 debugger_info_variables (this->debugger
, callback
, user_data
);
534 idebugger_set_frame (IAnjutaDebugger
*plugin
, guint frame
, GError
**err
)
536 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
538 debugger_set_frame (this->debugger
, frame
);
544 idebugger_list_frame (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
546 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
548 debugger_list_frame (this->debugger
, callback
, user_data
);
554 idebugger_set_thread (IAnjutaDebugger
*plugin
, gint thread
, GError
**err
)
556 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
558 debugger_set_thread (this->debugger
, thread
);
564 idebugger_list_thread (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
566 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
568 debugger_list_thread (this->debugger
, callback
, user_data
);
574 idebugger_info_thread (IAnjutaDebugger
*plugin
, gint thread
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
576 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
578 debugger_info_thread (this->debugger
, thread
, callback
, user_data
);
584 idebugger_list_register (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
586 //GdbPlugin *this = ANJUTA_PLUGIN_GDB (plugin);
588 //debugger_list_register (this->debugger, callback, user_data);
594 idebugger_callback (IAnjutaDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
597 callback (NULL
, user_data
, NULL
);
603 idebugger_enable_log (IAnjutaDebugger
*plugin
, IAnjutaMessageView
*log
, GError
**err
)
605 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
609 debugger_set_log (this->debugger
, log
);
613 idebugger_disable_log (IAnjutaDebugger
*plugin
, GError
**err
)
615 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
619 debugger_set_log (this->debugger
, NULL
);
623 idebugger_iface_init (IAnjutaDebuggerIface
*iface
)
625 iface
->get_status
= idebugger_get_status
;
626 iface
->initialize
= idebugger_initialize
;
627 iface
->attach
= idebugger_attach
;
628 iface
->load
= idebugger_load
;
629 iface
->start
= idebugger_start
;
630 iface
->unload
= idebugger_unload
;
631 iface
->quit
= idebugger_quit
;
632 iface
->abort
= idebugger_abort
;
633 iface
->run
= idebugger_run
;
634 iface
->step_in
= idebugger_step_in
;
635 iface
->step_over
= idebugger_step_over
;
636 iface
->step_out
= idebugger_step_out
;
637 iface
->run_to
= idebugger_run_to
;
638 iface
->exit
= idebugger_exit
;
639 iface
->interrupt
= idebugger_interrupt
;
641 iface
->inspect
= idebugger_inspect
;
642 iface
->evaluate
= idebugger_evaluate
;
644 iface
->print
= idebugger_print
;
645 iface
->list_local
= idebugger_list_local
;
646 iface
->list_argument
= idebugger_list_argument
;
647 iface
->info_frame
= idebugger_info_frame
;
648 iface
->info_signal
= idebugger_info_signal
;
649 iface
->info_sharedlib
= idebugger_info_sharedlib
;
650 iface
->info_args
= idebugger_info_args
;
651 iface
->info_target
= idebugger_info_target
;
652 iface
->info_program
= idebugger_info_program
;
653 iface
->info_udot
= idebugger_info_udot
;
654 iface
->info_variables
= idebugger_info_variables
;
655 iface
->handle_signal
= idebugger_handle_signal
;
656 iface
->list_frame
= idebugger_list_frame
;
657 iface
->set_frame
= idebugger_set_frame
;
658 iface
->list_thread
= idebugger_list_thread
;
659 iface
->set_thread
= idebugger_set_thread
;
660 iface
->info_thread
= idebugger_info_thread
;
661 iface
->list_register
= idebugger_list_register
;
663 iface
->send_command
= idebugger_send_command
;
665 iface
->callback
= idebugger_callback
;
667 iface
->enable_log
= idebugger_enable_log
;
668 iface
->disable_log
= idebugger_disable_log
;
672 /* Implementation of IAnjutaBreakpointDebugger interface
673 *---------------------------------------------------------------------------*/
676 ibreakpoint_debugger_add_breakpoint_at_line (IAnjutaBreakpointDebugger
*plugin
, const gchar
* file
, guint line
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
678 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
680 /* NULL breakpoint is used to detect available feature */
681 if (file
== NULL
) return TRUE
;
683 debugger_add_breakpoint_at_line (this->debugger
, file
, line
, callback
, user_data
);
689 ibreakpoint_debugger_add_breakpoint_at_function (IAnjutaBreakpointDebugger
*plugin
, const gchar
* file
, const gchar
* function
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
691 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
693 /* NULL breakpoint is used to detect available feature */
694 if (function
== NULL
) return TRUE
;
696 debugger_add_breakpoint_at_function (this->debugger
, *file
== '\0' ? NULL
: file
, function
, callback
, user_data
);
702 ibreakpoint_debugger_add_breakpoint_at_address (IAnjutaBreakpointDebugger
*plugin
, guint address
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
704 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
706 /* NULL breakpoint is used to detect available feature */
707 if (address
== 0) return TRUE
;
709 debugger_add_breakpoint_at_address (this->debugger
, address
, callback
, user_data
);
715 ibreakpoint_debugger_enable_breakpoint (IAnjutaBreakpointDebugger
*plugin
, guint id
, gboolean enable
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
717 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
719 /* NULL breakpoint is used to detect available feature */
720 if (id
== 0) return TRUE
;
722 debugger_enable_breakpoint (this->debugger
, id
, enable
, callback
, user_data
);
728 ibreakpoint_debugger_ignore_breakpoint (IAnjutaBreakpointDebugger
*plugin
, guint id
, guint ignore
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
730 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
732 /* NULL breakpoint is used to detect available feature */
733 if (id
== 0) return TRUE
;
735 debugger_ignore_breakpoint (this->debugger
, id
, ignore
, callback
, user_data
);
741 ibreakpoint_debugger_condition_breakpoint (IAnjutaBreakpointDebugger
*plugin
, guint id
, const gchar
*condition
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
743 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
745 /* NULL breakpoint is used to detect available feature */
746 if (id
== 0) return TRUE
;
748 debugger_condition_breakpoint (this->debugger
, id
, condition
, callback
, user_data
);
754 ibreakpoint_debugger_remove_breakpoint (IAnjutaBreakpointDebugger
*plugin
, guint id
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
756 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
758 /* NULL breakpoint is used to detect available feature */
759 if (id
== 0) return TRUE
;
761 debugger_remove_breakpoint (this->debugger
, id
, callback
, user_data
);
767 ibreakpoint_debugger_iface_init (IAnjutaBreakpointDebuggerIface
*iface
)
769 iface
->set_breakpoint_at_line
= ibreakpoint_debugger_add_breakpoint_at_line
;
770 iface
->clear_breakpoint
= ibreakpoint_debugger_remove_breakpoint
;
771 iface
->set_breakpoint_at_address
= ibreakpoint_debugger_add_breakpoint_at_address
;
772 iface
->set_breakpoint_at_function
= ibreakpoint_debugger_add_breakpoint_at_function
;
773 iface
->enable_breakpoint
= ibreakpoint_debugger_enable_breakpoint
;
774 iface
->ignore_breakpoint
= ibreakpoint_debugger_ignore_breakpoint
;
775 iface
->condition_breakpoint
= ibreakpoint_debugger_condition_breakpoint
;
778 /* Implementation of IAnjutaCpuDebugger interface
779 *---------------------------------------------------------------------------*/
782 icpu_debugger_list_register (IAnjutaCpuDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
784 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
786 debugger_list_register (this->debugger
, callback
, user_data
);
792 icpu_debugger_update_register (IAnjutaCpuDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
794 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
796 debugger_update_register (this->debugger
, callback
, user_data
);
802 icpu_debugger_write_register (IAnjutaCpuDebugger
*plugin
, IAnjutaDebuggerRegister
*value
, GError
**err
)
804 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
806 debugger_write_register (this->debugger
, value
->name
, value
->value
);
812 icpu_debugger_inspect_memory (IAnjutaCpuDebugger
*plugin
, guint address
, guint length
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
814 GdbPlugin
*this = ANJUTA_PLUGIN_GDB (plugin
);
816 debugger_inspect_memory (this->debugger
, address
, length
, callback
, user_data
);
822 icpu_debugger_disassemble (IAnjutaCpuDebugger
*plugin
, guint address
, guint length
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**err
)
824 GdbPlugin
*this = (GdbPlugin
*)plugin
;
826 debugger_disassemble (this->debugger
, address
, length
, callback
, user_data
);
832 icpu_debugger_iface_init (IAnjutaCpuDebuggerIface
*iface
)
834 iface
->list_register
= icpu_debugger_list_register
;
835 iface
->update_register
= icpu_debugger_update_register
;
836 iface
->write_register
= icpu_debugger_write_register
;
837 iface
->inspect_memory
= icpu_debugger_inspect_memory
;
838 iface
->disassemble
= icpu_debugger_disassemble
;
841 /* Implementation of IAnjutaVariableDebugger interface
842 *---------------------------------------------------------------------------*/
845 ivariable_debugger_delete (IAnjutaVariableDebugger
*plugin
, const gchar
*name
, GError
**error
)
847 GdbPlugin
*gdb
= ANJUTA_PLUGIN_GDB (plugin
);
849 debugger_delete_variable (gdb
->debugger
, name
);
855 ivariable_debugger_evaluate (IAnjutaVariableDebugger
*plugin
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**error
)
857 GdbPlugin
*gdb
= ANJUTA_PLUGIN_GDB (plugin
);
859 debugger_evaluate_variable (gdb
->debugger
, name
, callback
, user_data
);
865 ivariable_debugger_assign (IAnjutaVariableDebugger
*plugin
, const gchar
*name
, const gchar
*value
, GError
**error
)
867 GdbPlugin
*gdb
= ANJUTA_PLUGIN_GDB (plugin
);
869 debugger_assign_variable (gdb
->debugger
, name
, value
);
875 ivariable_debugger_list_children (IAnjutaVariableDebugger
*plugin
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**error
)
877 GdbPlugin
*gdb
= ANJUTA_PLUGIN_GDB (plugin
);
879 debugger_list_variable_children (gdb
->debugger
, name
, callback
, user_data
);
885 ivariable_debugger_create (IAnjutaVariableDebugger
*plugin
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**error
)
887 GdbPlugin
*gdb
= ANJUTA_PLUGIN_GDB (plugin
);
889 debugger_create_variable (gdb
->debugger
, name
, callback
, user_data
);
895 ivariable_debugger_update (IAnjutaVariableDebugger
*plugin
, IAnjutaDebuggerCallback callback
, gpointer user_data
, GError
**error
)
897 GdbPlugin
*gdb
= ANJUTA_PLUGIN_GDB (plugin
);
899 debugger_update_variable (gdb
->debugger
, callback
, user_data
);
905 ivariable_debugger_iface_init (IAnjutaVariableDebuggerIface
*iface
)
907 iface
->delete_var
= ivariable_debugger_delete
;
908 iface
->evaluate
= ivariable_debugger_evaluate
;
909 iface
->assign
= ivariable_debugger_assign
;
910 iface
->list_children
= ivariable_debugger_list_children
;
911 iface
->create
= ivariable_debugger_create
;
912 iface
->update
= ivariable_debugger_update
;
915 ANJUTA_PLUGIN_BEGIN (GdbPlugin
, gdb_plugin
);
916 ANJUTA_PLUGIN_ADD_INTERFACE(idebugger
, IANJUTA_TYPE_DEBUGGER
);
917 ANJUTA_PLUGIN_ADD_INTERFACE(ibreakpoint_debugger
, IANJUTA_TYPE_BREAKPOINT_DEBUGGER
);
918 ANJUTA_PLUGIN_ADD_INTERFACE(icpu_debugger
, IANJUTA_TYPE_CPU_DEBUGGER
);
919 ANJUTA_PLUGIN_ADD_INTERFACE(ivariable_debugger
, IANJUTA_TYPE_VARIABLE_DEBUGGER
);
922 ANJUTA_SIMPLE_PLUGIN (GdbPlugin
, gdb_plugin
);