1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 Copyright (C) Naba Kumar <naba@gnome.org>
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 is 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
20 #ifndef __DEBUGGER_H__
21 #define __DEBUGGER_H__
23 #include <sys/types.h>
24 #include <glib-object.h>
28 #include "preferences.h"
30 #include <libanjuta/interfaces/ianjuta-message-view.h>
31 #include <libanjuta/interfaces/ianjuta-debugger.h>
32 #include <libanjuta/interfaces/ianjuta-debugger-breakpoint.h>
33 #include <libanjuta/interfaces/ianjuta-debugger-memory.h>
34 #include <libanjuta/interfaces/ianjuta-debugger-instruction.h>
35 #include <libanjuta/interfaces/ianjuta-debugger-variable.h>
39 typedef struct _Debugger Debugger
;
40 typedef struct _DebuggerClass DebuggerClass
;
41 typedef struct _DebuggerPriv DebuggerPriv
;
42 typedef struct _DebuggerCommand DebuggerCommand
;
44 #define DEBUGGER_TYPE (debugger_get_type ())
45 #define DEBUGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEBUGGER_TYPE, Debugger))
46 #define DEBUGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEBUGGER_TYPE, DebuggerClass))
47 #define IS_DEBUGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEBUGGER_TYPE))
48 #define IS_DEBUGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEBUGGER_TYPE))
53 } DebuggerBreakpointType
;
55 typedef void (*DebuggerParserFunc
) (Debugger
*debugger
,
56 const GDBMIValue
*mi_result
,
57 const GList
*cli_result
,
62 DEBUGGER_COMMAND_NO_ERROR
= 1 << 0,
63 DEBUGGER_COMMAND_KEEP_RESULT
= 1 << 1,
64 DEBUGGER_COMMAND_PREPEND
= 1 << 2,
65 } DebuggerCommandFlags
;
68 struct _DebuggerCommand
71 DebuggerCommandFlags flags
;
72 DebuggerParserFunc parser
;
73 IAnjutaDebuggerCallback callback
;
85 GObjectClass parent_class
;
88 GType
debugger_get_type (void);
90 Debugger
* debugger_new (GtkWindow
*parent_win
, GObject
* instance
);
91 void debugger_free (Debugger
*debugger
);
93 gboolean
debugger_set_pretty_printers (Debugger
*debugger
,
94 const GList
*pretty_printers
);
96 gboolean
debugger_start (Debugger
*debugger
,
97 const GList
*search_dirs
,
99 gboolean is_libtool_prog
);
101 gboolean
debugger_stop (Debugger
*debugger
);
102 gboolean
debugger_abort (Debugger
*debugger
);
104 void debugger_set_output_callback (Debugger
*debugger
, IAnjutaDebuggerOutputCallback callback
, gpointer user_data
);
107 gboolean
debugger_is_ready (Debugger
*debugger
);
108 gboolean
debugger_program_is_running (Debugger
*debugger
);
109 gboolean
debugger_program_is_attached (Debugger
*debugger
);
110 gboolean
debugger_program_is_loaded (Debugger
*debugger
);
111 IAnjutaDebuggerState
debugger_get_state (Debugger
*debugger
);
113 /* Send standard gdb MI2 or CLI commands */
114 void debugger_command (Debugger
*debugger
, const gchar
*command
,
115 gboolean suppress_error
, DebuggerParserFunc parser
,
118 void debugger_program_moved (Debugger
*debugger
, const gchar
*file
,
119 gint line
, gulong address
);
120 gchar
* debugger_get_source_path (Debugger
*debugger
, const gchar
*file
);
122 /* Program loading */
123 void debugger_load_executable (Debugger
*debugger
, const gchar
*prog
);
124 void debugger_load_core (Debugger
*debugger
, const gchar
*core
);
125 void debugger_attach_process (Debugger
*debugger
, pid_t pid
);
126 void debugger_detach_process (Debugger
*debugger
);
129 gboolean
debugger_set_working_directory (Debugger
*debugger
, const gchar
*directory
);
130 gboolean
debugger_set_environment (Debugger
*debugger
, gchar
**variables
);
133 void debugger_start_program (Debugger
*debugger
, const gchar
*server
, const gchar
* args
, const gchar
* tty
, gboolean stop
);
134 void debugger_stop_program (Debugger
*debugger
);
135 void debugger_restart_program (Debugger
*debugger
);
136 void debugger_interrupt (Debugger
*debugger
);
137 void debugger_run (Debugger
*debugger
);
138 void debugger_step_in (Debugger
*debugger
);
139 void debugger_step_over (Debugger
*debugger
);
140 void debugger_step_out (Debugger
*debugger
);
141 void debugger_stepi_in (Debugger
*debugger
);
142 void debugger_stepi_over (Debugger
*debugger
);
143 void debugger_run_to_location (Debugger
*debugger
, const gchar
*loc
);
144 void debugger_run_to_position (Debugger
*debugger
, const gchar
*file
, guint line
);
145 void debugger_run_from_position (Debugger
*debugger
, const gchar
*file
, guint line
);
146 void debugger_run_to_address (Debugger
*debugger
, gulong address
);
147 void debugger_run_from_address (Debugger
*debugger
, gulong address
);
150 void debugger_add_breakpoint_at_line (Debugger
*debugger
, const gchar
* file
, guint line
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
151 void debugger_add_breakpoint_at_function (Debugger
*debugger
, const gchar
* file
, const gchar
* function
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
152 void debugger_add_breakpoint_at_address (Debugger
*debugger
, gulong address
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
153 void debugger_remove_breakpoint (Debugger
*debugger
, guint id
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
154 void debugger_list_breakpoint (Debugger
*debugger
, IAnjutaDebuggerGListCallback callback
, gpointer user_data
);
155 void debugger_enable_breakpoint (Debugger
*debugger
, guint id
, gboolean enable
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
156 void debugger_ignore_breakpoint (Debugger
*debugger
, guint id
, guint ignore
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
157 void debugger_condition_breakpoint (Debugger
*debugger
, guint id
, const gchar
* condition
, IAnjutaDebuggerBreakpointCallback callback
, gpointer user_data
);
160 void debugger_print (Debugger
*debugger
, const gchar
* variable
, IAnjutaDebuggerGCharCallback callback
, gpointer user_data
);
161 void debugger_evaluate (Debugger
*debugger
, const gchar
* name
, IAnjutaDebuggerGCharCallback callback
, gpointer user_data
);
164 void debugger_list_local (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
165 void debugger_list_argument (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
166 void debugger_info_signal (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
167 void debugger_info_sharedlib (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
168 void debugger_inspect_memory (Debugger
*debugger
, gulong address
, guint length
, IAnjutaDebuggerMemoryCallback func
, gpointer user_data
);
169 void debugger_disassemble (Debugger
*debugger
, gulong address
, guint length
, IAnjutaDebuggerInstructionCallback func
, gpointer user_data
);
173 void debugger_list_register (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
174 void debugger_update_register (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
175 void debugger_write_register (Debugger
*debugger
, const gchar
*name
, const gchar
*value
);
178 void debugger_list_argument (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
179 void debugger_list_frame (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
180 void debugger_set_frame (Debugger
*debugger
, gsize frame
);
181 void debugger_dump_stack_trace (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
184 void debugger_list_thread (Debugger
*debugger
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
185 void debugger_set_thread (Debugger
*debugger
, gint thread
);
186 void debugger_info_thread (Debugger
*debugger
, gint thread
, IAnjutaDebuggerGListCallback func
, gpointer user_data
);
189 void debugger_set_log (Debugger
*debugger
, IAnjutaMessageView
*view
);
191 /* Variable object */
192 void debugger_delete_variable (Debugger
*debugger
, const gchar
*name
);
193 void debugger_evaluate_variable (Debugger
*debugger
, const gchar
*name
, IAnjutaDebuggerGCharCallback callback
, gpointer user_data
);
194 void debugger_assign_variable (Debugger
*debugger
, const gchar
*name
, const gchar
*value
);
195 void debugger_list_variable_children (Debugger
*debugger
, const gchar
* name
, guint from
, IAnjutaDebuggerGListCallback callback
, gpointer user_data
);
196 void debugger_create_variable (Debugger
*debugger
, const gchar
*name
, IAnjutaDebuggerVariableCallback callback
, gpointer user_data
);
197 void debugger_update_variable (Debugger
*debugger
, IAnjutaDebuggerGListCallback callback
, gpointer user_data
);
202 void debugger_query_execute (void);
203 void debugger_query_evaluate_expr_tip (const gchar
*expr
,
206 void debugger_query_evaluate_expr (const gchar
*expr
,