1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 Copyright (C) 2007 Sébastien 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 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
22 * Wrap each debugger commands in a command object put in a FIFO queue
23 *---------------------------------------------------------------------------*/
32 #include <libanjuta/anjuta-debug.h>
33 #include <libanjuta/interfaces/ianjuta-debugger-breakpoint.h>
34 #include <libanjuta/interfaces/ianjuta-debugger-register.h>
35 #include <libanjuta/interfaces/ianjuta-debugger-memory.h>
36 #include <libanjuta/interfaces/ianjuta-debugger-instruction.h>
37 #include <libanjuta/interfaces/ianjuta-debugger-variable.h>
42 *---------------------------------------------------------------------------*/
45 *---------------------------------------------------------------------------*/
51 LOAD_COMMAND
, /* Debugger started */
53 QUIT_COMMAND
, /* Debugger started - Program stopped */
56 INSPECT_MEMORY_COMMAND
,
58 LIST_REGISTER_COMMAND
,
59 UNLOAD_COMMAND
, /* Program loaded */
61 BREAK_LINE_COMMAND
, /* Program loaded - Program stopped */
62 BREAK_FUNCTION_COMMAND
,
63 BREAK_ADDRESS_COMMAND
,
65 IGNORE_BREAK_COMMAND
, /* 0x10 */
66 CONDITION_BREAK_COMMAND
,
69 INFO_SHAREDLIB_COMMAND
,
73 STEP_IN_COMMAND
, /* Program stopped */
80 RUN_TO_ADDRESS_COMMAND
,
81 EXIT_COMMAND
, /* 0x20 */
82 HANDLE_SIGNAL_COMMAND
,
91 INFO_VARIABLES_COMMAND
,
94 UPDATE_REGISTER_COMMAND
,
95 WRITE_REGISTER_COMMAND
,
97 INSPECT_COMMAND
, /* 0x30 */
101 LIST_VARIABLE_CHILDREN
,
105 INTERRUPT_COMMAND
/* Program running */
106 } DmaDebuggerCommandType
;
110 DMA_CALLBACK_COMMAND
=
112 NEED_DEBUGGER_STOPPED
| NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
114 LOAD_COMMAND
| LOAD_PROGRAM
|
115 NEED_DEBUGGER_STOPPED
| NEED_DEBUGGER_STARTED
,
117 ATTACH_COMMAND
| RUN_PROGRAM
|
118 NEED_DEBUGGER_STOPPED
| NEED_DEBUGGER_STARTED
,
120 QUIT_COMMAND
| CANCEL_ALL_COMMAND
| STOP_DEBUGGER
|
121 HIGH_PRIORITY
| NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
123 ABORT_COMMAND
| CANCEL_ALL_COMMAND
| STOP_DEBUGGER
|
124 ASYNCHRONOUS
| NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
127 NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
128 DMA_INSPECT_MEMORY_COMMAND
=
129 INSPECT_MEMORY_COMMAND
|
130 NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
131 DMA_DISASSEMBLE_COMMAND
=
132 DISASSEMBLE_COMMAND
|
133 NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
134 DMA_LIST_REGISTER_COMMAND
=
135 LIST_REGISTER_COMMAND
|
136 NEED_DEBUGGER_STARTED
| NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
138 UNLOAD_COMMAND
| START_DEBUGGER
|
139 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
141 START_COMMAND
| RUN_PROGRAM
|
142 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
143 DMA_BREAK_LINE_COMMAND
=
145 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
146 DMA_BREAK_FUNCTION_COMMAND
=
147 BREAK_FUNCTION_COMMAND
|
148 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
149 DMA_BREAK_ADDRESS_COMMAND
=
150 BREAK_ADDRESS_COMMAND
|
151 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
152 DMA_ENABLE_BREAK_COMMAND
=
153 ENABLE_BREAK_COMMAND
|
154 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
155 DMA_IGNORE_BREAK_COMMAND
=
156 IGNORE_BREAK_COMMAND
|
157 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
158 DMA_CONDITION_BREAK_COMMAND
=
159 CONDITION_BREAK_COMMAND
|
160 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
161 DMA_REMOVE_BREAK_COMMAND
=
162 REMOVE_BREAK_COMMAND
|
163 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
164 DMA_LIST_BREAK_COMMAND
=
166 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
167 DMA_INFO_SHAREDLIB_COMMAND
=
168 INFO_SHAREDLIB_COMMAND
|
169 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
170 DMA_INFO_TARGET_COMMAND
=
171 INFO_TARGET_COMMAND
|
172 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
173 DMA_INFO_PROGRAM_COMMAND
=
174 INFO_PROGRAM_COMMAND
|
175 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
176 DMA_INFO_UDOT_COMMAND
=
178 NEED_PROGRAM_LOADED
| NEED_PROGRAM_STOPPED
,
179 DMA_STEP_IN_COMMAND
=
180 STEP_IN_COMMAND
| RUN_PROGRAM
|
181 NEED_PROGRAM_STOPPED
,
182 DMA_STEP_OVER_COMMAND
=
183 STEP_OVER_COMMAND
| RUN_PROGRAM
|
184 NEED_PROGRAM_STOPPED
,
185 DMA_STEP_OUT_COMMAND
=
186 STEP_OUT_COMMAND
| RUN_PROGRAM
|
187 NEED_PROGRAM_STOPPED
,
189 RUN_COMMAND
| RUN_PROGRAM
|
190 NEED_PROGRAM_STOPPED
,
192 RUN_TO_COMMAND
| RUN_PROGRAM
|
193 NEED_PROGRAM_STOPPED
,
194 DMA_STEPI_IN_COMMAND
=
195 STEPI_IN_COMMAND
| RUN_PROGRAM
|
196 NEED_PROGRAM_STOPPED
,
197 DMA_STEPI_OVER_COMMAND
=
198 STEPI_OVER_COMMAND
| RUN_PROGRAM
|
199 NEED_PROGRAM_STOPPED
,
200 DMA_RUN_TO_ADDRESS_COMMAND
=
201 RUN_TO_ADDRESS_COMMAND
| RUN_PROGRAM
|
202 NEED_PROGRAM_STOPPED
,
204 EXIT_COMMAND
| LOAD_PROGRAM
|
205 NEED_PROGRAM_STOPPED
,
206 DMA_HANDLE_SIGNAL_COMMAND
=
207 HANDLE_SIGNAL_COMMAND
|
208 NEED_PROGRAM_STOPPED
,
209 DMA_LIST_LOCAL_COMMAND
=
211 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
212 DMA_LIST_ARG_COMMAND
=
214 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
215 DMA_LIST_THREAD_COMMAND
=
216 LIST_THREAD_COMMAND
|
217 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
218 DMA_SET_THREAD_COMMAND
=
220 NEED_PROGRAM_STOPPED
,
221 DMA_INFO_THREAD_COMMAND
=
222 INFO_THREAD_COMMAND
|
223 NEED_PROGRAM_STOPPED
,
224 DMA_INFO_SIGNAL_COMMAND
=
225 INFO_SIGNAL_COMMAND
|
226 NEED_PROGRAM_STOPPED
,
227 DMA_INFO_FRAME_COMMAND
=
229 NEED_PROGRAM_STOPPED
,
230 DMA_INFO_ARGS_COMMAND
=
232 NEED_PROGRAM_STOPPED
,
233 DMA_INFO_VARIABLES_COMMAND
=
234 INFO_VARIABLES_COMMAND
|
235 NEED_PROGRAM_STOPPED
,
236 DMA_SET_FRAME_COMMAND
=
238 NEED_PROGRAM_STOPPED
,
239 DMA_LIST_FRAME_COMMAND
=
241 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
242 DMA_UPDATE_REGISTER_COMMAND
=
243 UPDATE_REGISTER_COMMAND
|
244 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
245 DMA_WRITE_REGISTER_COMMAND
=
246 WRITE_REGISTER_COMMAND
|
247 NEED_PROGRAM_STOPPED
,
248 DMA_EVALUATE_COMMAND
=
250 NEED_PROGRAM_STOPPED
,
251 DMA_INSPECT_COMMAND
=
253 NEED_PROGRAM_STOPPED
,
256 NEED_PROGRAM_STOPPED
,
257 DMA_CREATE_VARIABLE_COMMAND
=
259 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
260 DMA_EVALUATE_VARIABLE_COMMAND
=
261 EVALUATE_VARIABLE
| CANCEL_IF_PROGRAM_RUNNING
|
262 NEED_PROGRAM_STOPPED
,
263 DMA_LIST_VARIABLE_CHILDREN_COMMAND
=
264 LIST_VARIABLE_CHILDREN
|
265 NEED_PROGRAM_STOPPED
,
266 DMA_DELETE_VARIABLE_COMMAND
=
268 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
269 DMA_ASSIGN_VARIABLE_COMMAND
=
271 NEED_PROGRAM_STOPPED
,
272 DMA_UPDATE_VARIABLE_COMMAND
=
273 UPDATE_VARIABLE
| CANCEL_IF_PROGRAM_RUNNING
|
274 NEED_PROGRAM_STOPPED
| NEED_PROGRAM_RUNNING
,
275 DMA_INTERRUPT_COMMAND
=
276 INTERRUPT_COMMAND
| STOP_PROGRAM
|
277 ASYNCHRONOUS
| NEED_PROGRAM_RUNNING
,
278 } DmaDebuggerCommand
;
280 struct _DmaQueueCommand
282 DmaDebuggerCommandType type
;
283 IAnjutaDebuggerCallback callback
;
345 struct _DmaQueueCommand
*next
;
349 *---------------------------------------------------------------------------*/
351 static DmaQueueCommand
*
352 dma_command_new (DmaDebuggerCommand cmd_type
,...)
354 DmaQueueCommand
* cmd
;
355 DmaDebuggerCommandType type
= cmd_type
& COMMAND_MASK
;
356 IAnjutaDebuggerRegisterData
* reg
;
360 cmd
= g_new0 (DmaQueueCommand
, 1);
361 cmd
->type
= cmd_type
;
363 va_start (args
, cmd_type
);
368 case CALLBACK_COMMAND
:
369 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
370 cmd
->user_data
= va_arg (args
, gpointer
);
373 cmd
->data
.load
.file
= g_strdup (va_arg (args
, gchar
*));
374 cmd
->data
.load
.type
= g_strdup (va_arg (args
, gchar
*));
375 cmd
->data
.load
.dirs
= NULL
;
376 for (list
= va_arg (args
, GList
*); list
!= NULL
; list
= g_list_next (list
))
378 cmd
->data
.load
.dirs
= g_list_prepend (cmd
->data
.load
.dirs
, g_strdup (list
->data
));
380 cmd
->data
.load
.dirs
= g_list_reverse (cmd
->data
.load
.dirs
);
383 cmd
->data
.attach
.pid
= va_arg (args
,pid_t
);
384 cmd
->data
.load
.dirs
= NULL
;
385 for (list
= va_arg (args
, GList
*); list
!= NULL
; list
= g_list_next (list
))
387 cmd
->data
.load
.dirs
= g_list_prepend (cmd
->data
.load
.dirs
, g_strdup (list
->data
));
389 cmd
->data
.load
.dirs
= g_list_reverse (cmd
->data
.load
.dirs
);
398 cmd
->data
.start
.args
= g_strdup (va_arg (args
, gchar
*));
399 cmd
->data
.start
.terminal
= va_arg (args
, gboolean
);
400 cmd
->data
.start
.stop
= va_arg (args
, gboolean
);
405 cmd
->data
.pos
.file
= g_strdup (va_arg (args
, gchar
*));
406 cmd
->data
.pos
.line
= va_arg (args
, guint
);
408 case STEP_IN_COMMAND
:
410 case STEP_OVER_COMMAND
:
412 case STEP_OUT_COMMAND
:
414 case RUN_TO_ADDRESS_COMMAND
:
415 cmd
->data
.pos
.address
= va_arg (args
, guint
);
417 case STEPI_IN_COMMAND
:
419 case STEPI_OVER_COMMAND
:
423 case INTERRUPT_COMMAND
:
425 case ENABLE_BREAK_COMMAND
:
426 cmd
->data
.brk
.id
= va_arg (args
, gint
);
427 cmd
->data
.brk
.enable
= va_arg (args
, gboolean
);
428 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
429 cmd
->user_data
= va_arg (args
, gpointer
);
431 case IGNORE_BREAK_COMMAND
:
432 cmd
->data
.brk
.id
= va_arg (args
, gint
);
433 cmd
->data
.brk
.ignore
= va_arg (args
, guint
);
434 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
435 cmd
->user_data
= va_arg (args
, gpointer
);
437 case REMOVE_BREAK_COMMAND
:
438 cmd
->data
.brk
.id
= va_arg (args
, gint
);
439 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
440 cmd
->user_data
= va_arg (args
, gpointer
);
442 case BREAK_LINE_COMMAND
:
443 cmd
->data
.pos
.id
= va_arg (args
, guint
*);
444 cmd
->data
.pos
.file
= g_strdup (va_arg (args
, gchar
*));
445 cmd
->data
.pos
.line
= va_arg (args
, guint
);
446 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
447 cmd
->user_data
= va_arg (args
, gpointer
);
449 case BREAK_FUNCTION_COMMAND
:
450 cmd
->data
.pos
.id
= va_arg (args
, guint
*);
451 cmd
->data
.pos
.file
= g_strdup (va_arg (args
, gchar
*));
452 cmd
->data
.pos
.function
= g_strdup (va_arg (args
, gchar
*));
453 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
454 cmd
->user_data
= va_arg (args
, gpointer
);
456 case BREAK_ADDRESS_COMMAND
:
457 cmd
->data
.pos
.id
= va_arg (args
, guint
*);
458 cmd
->data
.pos
.address
= va_arg (args
, gulong
);
459 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
460 cmd
->user_data
= va_arg (args
, gpointer
);
462 case CONDITION_BREAK_COMMAND
:
463 cmd
->data
.brk
.id
= va_arg (args
, gint
);
464 cmd
->data
.brk
.condition
= g_strdup (va_arg (args
, gchar
*));
465 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
466 cmd
->user_data
= va_arg (args
, gpointer
);
468 case LIST_BREAK_COMMAND
:
469 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
470 cmd
->user_data
= va_arg (args
, gpointer
);
472 case INSPECT_COMMAND
:
473 cmd
->data
.watch
.name
= g_strdup (va_arg (args
, gchar
*));
474 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
475 cmd
->user_data
= va_arg (args
, gpointer
);
477 case EVALUATE_COMMAND
:
478 cmd
->data
.watch
.name
= g_strdup (va_arg (args
, gchar
*));
479 cmd
->data
.watch
.value
= g_strdup (va_arg (args
, gchar
*));
480 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
481 cmd
->user_data
= va_arg (args
, gpointer
);
483 case LIST_LOCAL_COMMAND
:
484 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
485 cmd
->user_data
= va_arg (args
, gpointer
);
487 case LIST_ARG_COMMAND
:
488 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
489 cmd
->user_data
= va_arg (args
, gpointer
);
491 case LIST_THREAD_COMMAND
:
492 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
493 cmd
->user_data
= va_arg (args
, gpointer
);
495 case SET_THREAD_COMMAND
:
496 cmd
->data
.frame
.frame
= va_arg (args
, guint
);
498 case INFO_THREAD_COMMAND
:
499 cmd
->data
.info
.id
= va_arg (args
, guint
);
500 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
501 cmd
->user_data
= va_arg (args
, gpointer
);
503 case INFO_SIGNAL_COMMAND
:
504 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
505 cmd
->user_data
= va_arg (args
, gpointer
);
507 case INFO_SHAREDLIB_COMMAND
:
508 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
509 cmd
->user_data
= va_arg (args
, gpointer
);
511 case INFO_FRAME_COMMAND
:
512 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
513 cmd
->user_data
= va_arg (args
, gpointer
);
515 case INFO_ARGS_COMMAND
:
516 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
517 cmd
->user_data
= va_arg (args
, gpointer
);
519 case INFO_TARGET_COMMAND
:
520 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
521 cmd
->user_data
= va_arg (args
, gpointer
);
523 case INFO_PROGRAM_COMMAND
:
524 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
525 cmd
->user_data
= va_arg (args
, gpointer
);
527 case INFO_UDOT_COMMAND
:
528 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
529 cmd
->user_data
= va_arg (args
, gpointer
);
531 case INFO_VARIABLES_COMMAND
:
532 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
533 cmd
->user_data
= va_arg (args
, gpointer
);
535 case SET_FRAME_COMMAND
:
536 cmd
->data
.frame
.frame
= va_arg (args
, guint
);
538 case LIST_FRAME_COMMAND
:
539 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
540 cmd
->user_data
= va_arg (args
, gpointer
);
542 case LIST_REGISTER_COMMAND
:
543 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
544 cmd
->user_data
= va_arg (args
, gpointer
);
546 case UPDATE_REGISTER_COMMAND
:
547 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
548 cmd
->user_data
= va_arg (args
, gpointer
);
550 case WRITE_REGISTER_COMMAND
:
551 reg
= va_arg (args
, IAnjutaDebuggerRegisterData
*);
552 cmd
->data
.watch
.id
= reg
->num
;
553 cmd
->data
.watch
.name
= g_strdup (reg
->name
);
554 cmd
->data
.watch
.value
= g_strdup (reg
->value
);
556 case INSPECT_MEMORY_COMMAND
:
557 cmd
->data
.mem
.address
= va_arg (args
, gulong
);
558 cmd
->data
.mem
.length
= va_arg (args
, guint
);
559 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
560 cmd
->user_data
= va_arg (args
, gpointer
);
562 case DISASSEMBLE_COMMAND
:
563 cmd
->data
.mem
.address
= va_arg (args
, gulong
);
564 cmd
->data
.mem
.length
= va_arg (args
, guint
);
565 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
566 cmd
->user_data
= va_arg (args
, gpointer
);
569 cmd
->data
.user
.cmd
= g_strdup (va_arg (args
, gchar
*));
572 cmd
->data
.print
.var
= g_strdup (va_arg (args
, gchar
*));
573 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
574 cmd
->user_data
= va_arg (args
, gpointer
);
576 case HANDLE_SIGNAL_COMMAND
:
577 cmd
->data
.signal
.name
= g_strdup (va_arg (args
, gchar
*));
578 cmd
->data
.signal
.stop
= va_arg (args
, gboolean
);
579 cmd
->data
.signal
.print
= va_arg (args
, gboolean
);
580 cmd
->data
.signal
.ignore
= va_arg (args
, gboolean
);
582 case DELETE_VARIABLE
:
583 cmd
->data
.var
.name
= g_strdup (va_arg (args
, gchar
*));
585 case ASSIGN_VARIABLE
:
586 cmd
->data
.var
.name
= g_strdup (va_arg (args
, gchar
*));
587 cmd
->data
.var
.value
= g_strdup (va_arg (args
, gchar
*));
589 case EVALUATE_VARIABLE
:
590 cmd
->data
.var
.name
= g_strdup (va_arg (args
, gchar
*));
591 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
592 cmd
->user_data
= va_arg (args
, gpointer
);
594 case LIST_VARIABLE_CHILDREN
:
595 cmd
->data
.var
.name
= g_strdup (va_arg (args
, gchar
*));
596 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
597 cmd
->user_data
= va_arg (args
, gpointer
);
599 case CREATE_VARIABLE
:
600 cmd
->data
.var
.name
= g_strdup (va_arg (args
, gchar
*));
601 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
602 cmd
->user_data
= va_arg (args
, gpointer
);
604 case UPDATE_VARIABLE
:
605 cmd
->callback
= va_arg (args
, IAnjutaDebuggerCallback
);
606 cmd
->user_data
= va_arg (args
, gpointer
);
614 *---------------------------------------------------------------------------*/
617 dma_queue_load (DmaDebuggerQueue
*self
, const gchar
*file
, const gchar
* mime_type
, const GList
*search_dirs
)
619 if (!dma_debugger_queue_start (self
, mime_type
)) return FALSE
;
621 return dma_debugger_queue_append (self
, dma_command_new (DMA_LOAD_COMMAND
, file
, mime_type
, search_dirs
));
625 dma_queue_attach (DmaDebuggerQueue
*self
, pid_t pid
, const GList
*search_dirs
)
627 if (!dma_debugger_queue_start (self
, NULL
)) return FALSE
;
629 return dma_debugger_queue_append (self
, dma_command_new (DMA_ATTACH_COMMAND
, pid
, search_dirs
));
633 dma_queue_start (DmaDebuggerQueue
*self
, const gchar
*args
, gboolean terminal
, gboolean stop
)
635 return dma_debugger_queue_append (self
, dma_command_new (DMA_START_COMMAND
, args
, terminal
, stop
));
639 dma_queue_unload (DmaDebuggerQueue
*self
)
641 return dma_debugger_queue_append (self
, dma_command_new (DMA_UNLOAD_COMMAND
));
645 dma_queue_quit (DmaDebuggerQueue
*self
)
647 return dma_debugger_queue_append (self
, dma_command_new (DMA_QUIT_COMMAND
));
651 dma_queue_abort (DmaDebuggerQueue
*self
)
653 return dma_debugger_queue_append (self
, dma_command_new (DMA_ABORT_COMMAND
));
657 dma_queue_run (DmaDebuggerQueue
*self
)
659 return dma_debugger_queue_append (self
, dma_command_new (DMA_RUN_COMMAND
));
663 dma_queue_step_in (DmaDebuggerQueue
*self
)
665 return dma_debugger_queue_append (self
, dma_command_new (DMA_STEP_IN_COMMAND
));
669 dma_queue_step_over (DmaDebuggerQueue
*self
)
671 return dma_debugger_queue_append (self
, dma_command_new (DMA_STEP_OVER_COMMAND
));
675 dma_queue_run_to (DmaDebuggerQueue
*self
, const gchar
*file
, gint line
)
677 return dma_debugger_queue_append (self
, dma_command_new (DMA_RUN_TO_COMMAND
, file
, line
));
681 dma_queue_step_out (DmaDebuggerQueue
*self
)
683 return dma_debugger_queue_append (self
, dma_command_new (DMA_STEP_OUT_COMMAND
));
687 dma_queue_stepi_in (DmaDebuggerQueue
*self
)
689 return dma_debugger_queue_append (self
, dma_command_new (DMA_STEPI_IN_COMMAND
));
693 dma_queue_stepi_over (DmaDebuggerQueue
*self
)
695 return dma_debugger_queue_append (self
, dma_command_new (DMA_STEPI_OVER_COMMAND
));
699 dma_queue_run_to_address (DmaDebuggerQueue
*self
, gulong address
)
701 return dma_debugger_queue_append (self
, dma_command_new (DMA_RUN_TO_ADDRESS_COMMAND
, address
));
705 dma_queue_exit (DmaDebuggerQueue
*self
)
707 return dma_debugger_queue_append (self
, dma_command_new (DMA_EXIT_COMMAND
));
711 dma_queue_interrupt (DmaDebuggerQueue
*self
)
713 return dma_debugger_queue_append (self
, dma_command_new (DMA_INTERRUPT_COMMAND
));
717 dma_queue_inspect (DmaDebuggerQueue
*self
, const gchar
*expression
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
719 return dma_debugger_queue_append (self
, dma_command_new (DMA_INSPECT_COMMAND
, expression
, callback
, user_data
));
723 dma_queue_evaluate (DmaDebuggerQueue
*self
, const gchar
*name
, const gchar
* value
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
725 return dma_debugger_queue_append (self
, dma_command_new (DMA_EVALUATE_COMMAND
, name
, value
, callback
, user_data
));
729 dma_queue_send_command (DmaDebuggerQueue
*self
, const gchar
* command
)
731 return dma_debugger_queue_append (self
, dma_command_new (DMA_USER_COMMAND
, command
));
735 dma_queue_print (DmaDebuggerQueue
*self
, const gchar
* variable
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
737 return dma_debugger_queue_append (self
, dma_command_new (DMA_PRINT_COMMAND
, variable
, callback
, user_data
));
741 dma_queue_list_local (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
743 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_LOCAL_COMMAND
, callback
, user_data
));
747 dma_queue_list_argument (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
749 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_ARG_COMMAND
, callback
, user_data
));
753 dma_queue_list_thread (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
755 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_THREAD_COMMAND
, callback
, user_data
));
759 dma_queue_set_thread (DmaDebuggerQueue
*self
, gint thread
)
761 return dma_debugger_queue_append (self
, dma_command_new (DMA_SET_THREAD_COMMAND
, thread
));
765 dma_queue_info_thread (DmaDebuggerQueue
*self
, gint thread
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
767 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_THREAD_COMMAND
, thread
, callback
, user_data
));
771 dma_queue_info_signal (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
773 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_SIGNAL_COMMAND
, callback
, user_data
));
777 dma_queue_info_sharedlib (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
779 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_SHAREDLIB_COMMAND
, callback
, user_data
));
783 dma_queue_handle_signal (DmaDebuggerQueue
*self
, const gchar
* name
, gboolean stop
, gboolean print
, gboolean ignore
)
785 return dma_debugger_queue_append (self
, dma_command_new (DMA_HANDLE_SIGNAL_COMMAND
, name
, stop
, print
, ignore
));
789 dma_queue_info_frame (DmaDebuggerQueue
*self
, guint frame
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
791 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_FRAME_COMMAND
, frame
, callback
, user_data
));
795 dma_queue_info_args (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
797 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_ARGS_COMMAND
, callback
, user_data
));
801 dma_queue_info_target (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
803 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_TARGET_COMMAND
, callback
, user_data
));
807 dma_queue_info_program (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
809 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_PROGRAM_COMMAND
, callback
, user_data
));
813 dma_queue_info_udot (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
815 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_UDOT_COMMAND
, callback
, user_data
));
819 dma_queue_info_variables (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
821 return dma_debugger_queue_append (self
, dma_command_new (DMA_INFO_VARIABLES_COMMAND
, callback
, user_data
));
825 dma_queue_set_frame (DmaDebuggerQueue
*self
, guint frame
)
827 return dma_debugger_queue_append (self
, dma_command_new (DMA_SET_FRAME_COMMAND
, frame
));
831 dma_queue_list_frame (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
833 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_FRAME_COMMAND
, callback
, user_data
));
837 dma_queue_callback (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
839 return dma_debugger_queue_append (self
, dma_command_new (DMA_CALLBACK_COMMAND
, callback
, user_data
));
843 dma_queue_add_breakpoint_at_line (DmaDebuggerQueue
*self
, guint
*id
, const gchar
* file
, guint line
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
845 return dma_debugger_queue_append (self
, dma_command_new (DMA_BREAK_LINE_COMMAND
, id
, file
, line
, callback
, user_data
));
849 dma_queue_add_breakpoint_at_function (DmaDebuggerQueue
*self
, guint
*id
, const gchar
* file
, const gchar
* function
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
851 return dma_debugger_queue_append (self
, dma_command_new (DMA_BREAK_FUNCTION_COMMAND
, id
, file
, function
, callback
, user_data
));
855 dma_queue_add_breakpoint_at_address (DmaDebuggerQueue
*self
, guint
*id
, gulong address
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
857 return dma_debugger_queue_append (self
, dma_command_new (DMA_BREAK_ADDRESS_COMMAND
, id
, address
, callback
, user_data
));
861 dma_queue_enable_breakpoint (DmaDebuggerQueue
*self
, guint id
, gboolean enable
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
863 return dma_debugger_queue_append (self
, dma_command_new (DMA_ENABLE_BREAK_COMMAND
, id
, enable
, callback
, user_data
));
867 dma_queue_ignore_breakpoint (DmaDebuggerQueue
*self
, guint id
, guint ignore
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
869 return dma_debugger_queue_append (self
, dma_command_new (DMA_IGNORE_BREAK_COMMAND
, id
, ignore
, callback
, user_data
));
873 dma_queue_condition_breakpoint (DmaDebuggerQueue
*self
, guint id
, const gchar
*condition
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
875 return dma_debugger_queue_append (self
, dma_command_new (DMA_CONDITION_BREAK_COMMAND
, id
, condition
, callback
, user_data
));
879 dma_queue_remove_breakpoint (DmaDebuggerQueue
*self
, guint id
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
881 return dma_debugger_queue_append (self
, dma_command_new (DMA_REMOVE_BREAK_COMMAND
, id
, callback
, user_data
));
885 dma_queue_list_breakpoint (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
887 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_BREAK_COMMAND
, callback
, user_data
));
891 dma_queue_list_register (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
893 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_REGISTER_COMMAND
, callback
, user_data
));
897 dma_queue_update_register (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
899 return dma_debugger_queue_append (self
, dma_command_new (DMA_UPDATE_REGISTER_COMMAND
, callback
, user_data
));
903 dma_queue_write_register (DmaDebuggerQueue
*self
, IAnjutaDebuggerRegisterData
*value
)
905 return dma_debugger_queue_append (self
, dma_command_new (DMA_WRITE_REGISTER_COMMAND
, value
));
909 dma_queue_inspect_memory (DmaDebuggerQueue
*self
, gulong address
, guint length
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
911 return dma_debugger_queue_append (self
, dma_command_new (DMA_INSPECT_MEMORY_COMMAND
, address
, length
, callback
, user_data
));
915 dma_queue_disassemble (DmaDebuggerQueue
*self
, gulong address
, guint length
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
917 return dma_debugger_queue_append (self
, dma_command_new (DMA_DISASSEMBLE_COMMAND
, address
, length
, callback
, user_data
));
921 dma_queue_delete_variable (DmaDebuggerQueue
*self
, const gchar
*name
)
923 return dma_debugger_queue_append (self
, dma_command_new (DMA_DELETE_VARIABLE_COMMAND
, name
));
927 dma_queue_evaluate_variable (DmaDebuggerQueue
*self
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
929 return dma_debugger_queue_append (self
, dma_command_new (DMA_EVALUATE_VARIABLE_COMMAND
, name
, callback
, user_data
));
933 dma_queue_assign_variable (DmaDebuggerQueue
*self
, const gchar
*name
, const gchar
*value
)
935 return dma_debugger_queue_append (self
, dma_command_new (DMA_ASSIGN_VARIABLE_COMMAND
, name
, value
));
939 dma_queue_list_children (DmaDebuggerQueue
*self
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
941 return dma_debugger_queue_append (self
, dma_command_new (DMA_LIST_VARIABLE_CHILDREN_COMMAND
, name
, callback
, user_data
));
945 dma_queue_create_variable (DmaDebuggerQueue
*self
, const gchar
*name
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
947 return dma_debugger_queue_append (self
, dma_command_new (DMA_CREATE_VARIABLE_COMMAND
, name
, callback
, user_data
));
951 dma_queue_update_variable (DmaDebuggerQueue
*self
, IAnjutaDebuggerCallback callback
, gpointer user_data
)
953 return dma_debugger_queue_append (self
, dma_command_new (DMA_UPDATE_VARIABLE_COMMAND
, callback
, user_data
));
957 dma_command_free (DmaQueueCommand
*cmd
)
959 DmaDebuggerCommandType type
= cmd
->type
& COMMAND_MASK
;
964 case CALLBACK_COMMAND
:
969 case STEP_IN_COMMAND
:
970 case STEP_OVER_COMMAND
:
971 case STEP_OUT_COMMAND
:
972 case STEPI_IN_COMMAND
:
973 case STEPI_OVER_COMMAND
:
974 case RUN_TO_ADDRESS_COMMAND
:
976 case INTERRUPT_COMMAND
:
977 case ENABLE_BREAK_COMMAND
:
978 case IGNORE_BREAK_COMMAND
:
979 case REMOVE_BREAK_COMMAND
:
980 case LIST_BREAK_COMMAND
:
982 case LIST_LOCAL_COMMAND
:
983 case LIST_ARG_COMMAND
:
984 case INFO_THREAD_COMMAND
:
985 case LIST_THREAD_COMMAND
:
986 case SET_THREAD_COMMAND
:
987 case INFO_SIGNAL_COMMAND
:
988 case INFO_SHAREDLIB_COMMAND
:
989 case INFO_FRAME_COMMAND
:
990 case INFO_ARGS_COMMAND
:
991 case INFO_TARGET_COMMAND
:
992 case INFO_PROGRAM_COMMAND
:
993 case INFO_UDOT_COMMAND
:
994 case INFO_VARIABLES_COMMAND
:
995 case LIST_REGISTER_COMMAND
:
996 case UPDATE_REGISTER_COMMAND
:
998 case SET_FRAME_COMMAND
:
999 case LIST_FRAME_COMMAND
:
1000 case INSPECT_MEMORY_COMMAND
:
1001 case DISASSEMBLE_COMMAND
:
1003 case INSPECT_COMMAND
:
1004 case EVALUATE_COMMAND
:
1005 case WRITE_REGISTER_COMMAND
:
1006 if (cmd
->data
.watch
.name
!= NULL
) g_free (cmd
->data
.watch
.name
);
1007 if (cmd
->data
.watch
.value
!= NULL
) g_free (cmd
->data
.watch
.value
);
1010 if (cmd
->data
.start
.args
) g_free (cmd
->data
.start
.args
);
1013 if (cmd
->data
.load
.file
) g_free (cmd
->data
.load
.file
);
1014 if (cmd
->data
.load
.type
) g_free (cmd
->data
.load
.type
);
1015 g_list_foreach (cmd
->data
.load
.dirs
, (GFunc
)g_free
, NULL
);
1016 g_list_free (cmd
->data
.load
.dirs
);
1018 case ATTACH_COMMAND
:
1019 g_list_foreach (cmd
->data
.attach
.dirs
, (GFunc
)g_free
, NULL
);
1020 g_list_free (cmd
->data
.attach
.dirs
);
1022 case RUN_TO_COMMAND
:
1023 case BREAK_LINE_COMMAND
:
1024 case BREAK_FUNCTION_COMMAND
:
1025 case BREAK_ADDRESS_COMMAND
:
1026 if (cmd
->data
.pos
.file
) g_free (cmd
->data
.pos
.file
);
1027 if (cmd
->data
.pos
.function
) g_free (cmd
->data
.pos
.function
);
1029 case CONDITION_BREAK_COMMAND
:
1030 if (cmd
->data
.brk
.condition
) g_free (cmd
->data
.brk
.condition
);
1033 if (cmd
->data
.user
.cmd
) g_free (cmd
->data
.user
.cmd
);
1036 if (cmd
->data
.print
.var
) g_free (cmd
->data
.print
.var
);
1038 case HANDLE_SIGNAL_COMMAND
:
1039 if (cmd
->data
.signal
.name
) g_free (cmd
->data
.signal
.name
);
1041 case DELETE_VARIABLE
:
1042 case ASSIGN_VARIABLE
:
1043 case CREATE_VARIABLE
:
1044 case EVALUATE_VARIABLE
:
1045 case LIST_VARIABLE_CHILDREN
:
1046 case UPDATE_VARIABLE
:
1047 if (cmd
->data
.var
.name
) g_free (cmd
->data
.var
.name
);
1056 dma_command_cancel (DmaQueueCommand
*cmd
)
1058 GError
*err
= g_error_new_literal (IANJUTA_DEBUGGER_ERROR
, IANJUTA_DEBUGGER_CANCEL
, "Command cancel");
1060 if (cmd
->callback
!= NULL
)
1062 cmd
->callback (NULL
, cmd
->user_data
, err
);
1067 g_warning ("Cancel command %x\n", cmd
->type
);
1069 dma_command_free (cmd
);
1072 /* It is possible that the queue contains several add breakpoint command
1073 * for the same one. Just before sending the command to the debugger check
1074 * that the breakpoint is still not set */
1077 dma_command_is_breakpoint_pending (DmaQueueCommand
*cmd
)
1081 if (*cmd
->data
.pos
.id
== 0) return TRUE
; /* Breakpoint is not set, can add it */
1083 err
= g_error_new (IANJUTA_DEBUGGER_ERROR
, IANJUTA_DEBUGGER_ALREADY_DONE
, "Breakpoint is already set with id %d", *cmd
->data
.pos
.id
);
1085 if (cmd
->callback
!= NULL
)
1087 cmd
->callback (NULL
, cmd
->user_data
, err
);
1095 dma_command_run (DmaQueueCommand
*cmd
, IAnjutaDebugger
*debugger
,
1096 DmaDebuggerQueue
*queue
, GError
**err
)
1098 IAnjutaDebuggerRegisterData reg
;
1099 gboolean ret
= FALSE
;
1100 DmaDebuggerCommandType type
= cmd
->type
& COMMAND_MASK
;
1101 IAnjutaDebuggerCallback callback
= cmd
->callback
== NULL
? NULL
: dma_debugger_queue_command_callback
;
1108 case CALLBACK_COMMAND
:
1109 ret
= ianjuta_debugger_callback (debugger
, callback
, queue
, err
);
1112 ret
= ianjuta_debugger_load (debugger
, cmd
->data
.load
.file
, cmd
->data
.load
.type
, cmd
->data
.load
.dirs
, err
);
1114 case ATTACH_COMMAND
:
1115 ret
= ianjuta_debugger_attach (debugger
, cmd
->data
.attach
.pid
, cmd
->data
.load
.dirs
, err
);
1117 case UNLOAD_COMMAND
:
1118 ret
= ianjuta_debugger_unload (debugger
, err
);
1121 ret
= ianjuta_debugger_quit (debugger
, err
);
1124 ret
= ianjuta_debugger_abort (debugger
, err
);
1127 ret
= ianjuta_debugger_start (debugger
, cmd
->data
.start
.args
, cmd
->data
.start
.terminal
, cmd
->data
.start
.stop
, err
);
1130 ret
= ianjuta_debugger_run (debugger
, err
);
1132 case RUN_TO_COMMAND
:
1133 ret
= ianjuta_debugger_run_to (debugger
, cmd
->data
.pos
.file
, cmd
->data
.pos
.line
, err
);
1135 case STEP_IN_COMMAND
:
1136 ret
= ianjuta_debugger_step_in (debugger
, err
);
1138 case STEP_OVER_COMMAND
:
1139 ret
= ianjuta_debugger_step_over (debugger
, err
);
1141 case STEP_OUT_COMMAND
:
1142 ret
= ianjuta_debugger_step_out (debugger
, err
);
1144 case RUN_TO_ADDRESS_COMMAND
:
1145 ret
= ianjuta_debugger_instruction_run_to_address (IANJUTA_DEBUGGER_INSTRUCTION (debugger
), cmd
->data
.pos
.address
, err
);
1147 case STEPI_IN_COMMAND
:
1148 ret
= ianjuta_debugger_instruction_step_in (IANJUTA_DEBUGGER_INSTRUCTION (debugger
), err
);
1150 case STEPI_OVER_COMMAND
:
1151 ret
= ianjuta_debugger_instruction_step_over (IANJUTA_DEBUGGER_INSTRUCTION (debugger
), err
);
1154 ret
= ianjuta_debugger_exit (debugger
, err
);
1156 case INTERRUPT_COMMAND
:
1157 ret
= ianjuta_debugger_interrupt (debugger
, err
);
1159 case ENABLE_BREAK_COMMAND
:
1160 ret
= ianjuta_debugger_breakpoint_enable (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.brk
.id
, cmd
->data
.brk
.enable
, callback
, queue
, err
);
1162 case IGNORE_BREAK_COMMAND
:
1163 ret
= ianjuta_debugger_breakpoint_ignore (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.brk
.id
, cmd
->data
.brk
.ignore
, callback
, queue
, err
);
1165 case REMOVE_BREAK_COMMAND
:
1166 ret
= ianjuta_debugger_breakpoint_clear (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.brk
.id
, callback
, queue
, err
);
1168 case BREAK_LINE_COMMAND
:
1169 if (dma_command_is_breakpoint_pending (cmd
))
1171 ret
= ianjuta_debugger_breakpoint_set_at_line (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.pos
.file
, cmd
->data
.pos
.line
, callback
, queue
, err
);
1178 case BREAK_FUNCTION_COMMAND
:
1179 if (dma_command_is_breakpoint_pending (cmd
))
1181 ret
= ianjuta_debugger_breakpoint_set_at_function (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.pos
.file
, cmd
->data
.pos
.function
, callback
, queue
, err
);
1188 case BREAK_ADDRESS_COMMAND
:
1189 if (dma_command_is_breakpoint_pending (cmd
))
1191 ret
= ianjuta_debugger_breakpoint_set_at_address (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.pos
.address
, callback
, queue
, err
);
1198 case CONDITION_BREAK_COMMAND
:
1199 ret
= ianjuta_debugger_breakpoint_condition (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), cmd
->data
.brk
.id
, cmd
->data
.brk
.condition
, callback
, queue
, err
);
1201 case LIST_BREAK_COMMAND
:
1202 ret
= ianjuta_debugger_breakpoint_list (IANJUTA_DEBUGGER_BREAKPOINT (debugger
), callback
, queue
, err
);
1204 case INSPECT_COMMAND
:
1205 ret
= ianjuta_debugger_inspect (debugger
, cmd
->data
.watch
.name
, callback
, queue
, err
);
1207 case EVALUATE_COMMAND
:
1208 ret
= ianjuta_debugger_evaluate (debugger
, cmd
->data
.watch
.name
, cmd
->data
.watch
.value
, callback
, queue
, err
);
1210 case LIST_LOCAL_COMMAND
:
1211 ret
= ianjuta_debugger_list_local (debugger
, callback
, queue
, err
);
1213 case LIST_ARG_COMMAND
:
1214 ret
= ianjuta_debugger_list_argument (debugger
, callback
, queue
, err
);
1216 case LIST_THREAD_COMMAND
:
1217 ret
= ianjuta_debugger_list_thread (debugger
, callback
, queue
, err
);
1219 case SET_THREAD_COMMAND
:
1220 ret
= ianjuta_debugger_set_thread (debugger
, cmd
->data
.frame
.frame
, err
);
1222 case INFO_THREAD_COMMAND
:
1223 ret
= ianjuta_debugger_info_thread (debugger
, cmd
->data
.info
.id
, callback
, queue
, err
);
1225 case INFO_SIGNAL_COMMAND
:
1226 ret
= ianjuta_debugger_info_signal (debugger
, callback
, queue
, err
);
1228 case INFO_SHAREDLIB_COMMAND
:
1229 ret
= ianjuta_debugger_info_sharedlib (debugger
, callback
, queue
, err
);
1231 case INFO_FRAME_COMMAND
:
1232 ret
= ianjuta_debugger_info_frame (debugger
, 0, callback
, queue
, err
);
1234 case INFO_ARGS_COMMAND
:
1235 ret
= ianjuta_debugger_info_args (debugger
, callback
, queue
, err
);
1237 case INFO_TARGET_COMMAND
:
1238 ret
= ianjuta_debugger_info_target (debugger
, callback
, queue
, err
);
1240 case INFO_PROGRAM_COMMAND
:
1241 ret
= ianjuta_debugger_info_program (debugger
, callback
, queue
, err
);
1243 case INFO_UDOT_COMMAND
:
1244 ret
= ianjuta_debugger_info_udot (debugger
, callback
, queue
, err
);
1246 case INFO_VARIABLES_COMMAND
:
1247 ret
= ianjuta_debugger_info_variables (debugger
, callback
, queue
, err
);
1249 case SET_FRAME_COMMAND
:
1250 ret
= ianjuta_debugger_set_frame (debugger
, cmd
->data
.frame
.frame
, err
);
1252 case LIST_FRAME_COMMAND
:
1253 ret
= ianjuta_debugger_list_frame (debugger
, callback
, queue
, err
);
1255 case LIST_REGISTER_COMMAND
:
1256 ret
= ianjuta_debugger_register_list (IANJUTA_DEBUGGER_REGISTER (debugger
), callback
, queue
, err
);
1258 case UPDATE_REGISTER_COMMAND
:
1259 ret
= ianjuta_debugger_register_update (IANJUTA_DEBUGGER_REGISTER (debugger
), callback
, queue
, err
);
1261 case WRITE_REGISTER_COMMAND
:
1262 reg
.num
= cmd
->data
.watch
.id
;
1263 reg
.name
= cmd
->data
.watch
.name
;
1264 reg
.value
= cmd
->data
.watch
.value
;
1265 ret
= ianjuta_debugger_register_write (IANJUTA_DEBUGGER_REGISTER (debugger
), ®
, err
);
1267 case INSPECT_MEMORY_COMMAND
:
1268 ret
= ianjuta_debugger_memory_inspect (IANJUTA_DEBUGGER_MEMORY (debugger
), cmd
->data
.mem
.address
, cmd
->data
.mem
.length
, callback
, queue
, err
);
1270 case DISASSEMBLE_COMMAND
:
1271 ret
= ianjuta_debugger_instruction_disassemble (IANJUTA_DEBUGGER_INSTRUCTION (debugger
), cmd
->data
.mem
.address
, cmd
->data
.mem
.length
, callback
, queue
, err
);
1274 ret
= ianjuta_debugger_send_command (debugger
, cmd
->data
.user
.cmd
, err
);
1277 ret
= ianjuta_debugger_print (debugger
, cmd
->data
.print
.var
, callback
, queue
, err
);
1279 case HANDLE_SIGNAL_COMMAND
:
1280 ret
= ianjuta_debugger_handle_signal (debugger
, cmd
->data
.signal
.name
, cmd
->data
.signal
.stop
, cmd
->data
.signal
.print
, cmd
->data
.signal
.ignore
, err
);
1282 case DELETE_VARIABLE
:
1283 ret
= ianjuta_debugger_variable_destroy (IANJUTA_DEBUGGER_VARIABLE (debugger
), cmd
->data
.var
.name
, NULL
);
1285 case ASSIGN_VARIABLE
:
1286 ret
= ianjuta_debugger_variable_assign (IANJUTA_DEBUGGER_VARIABLE (debugger
), cmd
->data
.var
.name
, cmd
->data
.var
.value
, err
);
1288 case EVALUATE_VARIABLE
:
1289 ret
= ianjuta_debugger_variable_evaluate (IANJUTA_DEBUGGER_VARIABLE (debugger
), cmd
->data
.var
.name
, callback
, queue
, err
);
1291 case LIST_VARIABLE_CHILDREN
:
1292 ret
= ianjuta_debugger_variable_list_children (IANJUTA_DEBUGGER_VARIABLE (debugger
), cmd
->data
.var
.name
, callback
, queue
, err
);
1294 case CREATE_VARIABLE
:
1295 ret
= ianjuta_debugger_variable_create (IANJUTA_DEBUGGER_VARIABLE (debugger
), cmd
->data
.var
.name
, callback
, queue
, err
);
1297 case UPDATE_VARIABLE
:
1298 ret
= ianjuta_debugger_variable_update (IANJUTA_DEBUGGER_VARIABLE (debugger
), callback
, queue
, err
);
1306 dma_command_callback (DmaQueueCommand
*cmd
, const gpointer data
, GError
*err
)
1308 DmaDebuggerCommandType type
= cmd
->type
& COMMAND_MASK
;
1314 case ATTACH_COMMAND
:
1315 case UNLOAD_COMMAND
:
1320 case RUN_TO_COMMAND
:
1321 case STEP_IN_COMMAND
:
1322 case STEP_OVER_COMMAND
:
1323 case STEP_OUT_COMMAND
:
1324 case RUN_TO_ADDRESS_COMMAND
:
1325 case STEPI_IN_COMMAND
:
1326 case STEPI_OVER_COMMAND
:
1328 case INTERRUPT_COMMAND
:
1329 case SET_THREAD_COMMAND
:
1330 case SET_FRAME_COMMAND
:
1331 case WRITE_REGISTER_COMMAND
:
1333 case HANDLE_SIGNAL_COMMAND
:
1334 case DELETE_VARIABLE
:
1335 case ASSIGN_VARIABLE
:
1336 g_return_if_reached ();
1338 case CALLBACK_COMMAND
:
1339 case ENABLE_BREAK_COMMAND
:
1340 case IGNORE_BREAK_COMMAND
:
1341 case REMOVE_BREAK_COMMAND
:
1342 case BREAK_LINE_COMMAND
:
1343 case BREAK_FUNCTION_COMMAND
:
1344 case BREAK_ADDRESS_COMMAND
:
1345 case CONDITION_BREAK_COMMAND
:
1346 case LIST_BREAK_COMMAND
:
1347 case INSPECT_COMMAND
:
1348 case EVALUATE_COMMAND
:
1349 case LIST_LOCAL_COMMAND
:
1350 case LIST_ARG_COMMAND
:
1351 case LIST_THREAD_COMMAND
:
1352 case INFO_THREAD_COMMAND
:
1353 case INFO_SIGNAL_COMMAND
:
1354 case INFO_SHAREDLIB_COMMAND
:
1355 case INFO_FRAME_COMMAND
:
1356 case INFO_ARGS_COMMAND
:
1357 case INFO_TARGET_COMMAND
:
1358 case INFO_PROGRAM_COMMAND
:
1359 case INFO_UDOT_COMMAND
:
1360 case INFO_VARIABLES_COMMAND
:
1361 case LIST_FRAME_COMMAND
:
1362 case LIST_REGISTER_COMMAND
:
1363 case UPDATE_REGISTER_COMMAND
:
1364 case INSPECT_MEMORY_COMMAND
:
1365 case DISASSEMBLE_COMMAND
:
1367 case EVALUATE_VARIABLE
:
1368 case LIST_VARIABLE_CHILDREN
:
1369 case CREATE_VARIABLE
:
1370 case UPDATE_VARIABLE
:
1371 if (cmd
->callback
!= NULL
)
1373 cmd
->callback (data
, cmd
->user_data
, err
);
1380 dma_command_is_valid_in_state (DmaQueueCommand
*cmd
, IAnjutaDebuggerState state
)
1382 return cmd
->type
& 1 << (state
+ STATE_TO_NEED
- 1);
1385 IAnjutaDebuggerState
1386 dma_command_is_going_to_state (DmaQueueCommand
*cmd
)
1388 IAnjutaDebuggerState state
;
1390 switch (cmd
->type
& CHANGE_MASK
)
1393 state
= IANJUTA_DEBUGGER_STOPPED
;
1395 case START_DEBUGGER
:
1396 state
= IANJUTA_DEBUGGER_STARTED
;
1399 state
= IANJUTA_DEBUGGER_PROGRAM_LOADED
;
1402 state
= IANJUTA_DEBUGGER_PROGRAM_STOPPED
;
1405 state
= IANJUTA_DEBUGGER_PROGRAM_RUNNING
;
1408 state
= IANJUTA_DEBUGGER_BUSY
;
1415 dma_command_has_flag (DmaQueueCommand
*cmd
, DmaCommandFlag flag
)
1417 return cmd
->type
& flag
;
1421 dma_command_get_type (DmaQueueCommand
*cmd
)
1423 return (int)cmd
->type
;