1 /*
2  *  debug.h
3  *
4  *  Copyright 2012 Dimitar Toshkov Zhekov <dimitar.zhekov@gmail.com>
5  *
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.
10  *
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.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DEBUG_H
21 
22 typedef enum _DebugState
23 {
24 	DS_INACTIVE = 0x01,  /* gdb not loaded */
25 	DS_BUSY     = 0x02,
26 	DS_READY    = 0x04,  /* at prompt, has threads, none/running thread selected */
27 	DS_DEBUG    = 0x08,  /* at prompt, has threads, stopped thread selected */
28 	DS_HANGING  = 0x10,  /* at prompt, no threads */
29 	DS_VARIABLE = 0x18,
30 	DS_SENDABLE = 0x1C,
31 	DS_NOT_BUSY = 0x1D,
32 	DS_ACTIVE   = 0x1E,
33 	DS_BASICS   = 0x1F,
34 	DS_EXTRA_1  = 0x20,  /* also Assem */
35 	DS_EXTRA_2  = 0x40,  /* also Load */
36 	DS_EXTRA_3  = 0x80,
37 	DS_EXTRA_4  = 0x100,
38 	DS_EXTRAS   = 0x1E0
39 } DebugState;
40 
41 enum
42 {
43 	DS_INDEX_1 = 5,
44 	DS_INDEX_2,
45 	DS_INDEX_3,
46 	DS_INDEX_4
47 };
48 
49 DebugState debug_state(void);  /* single basic bit only */
50 
51 void on_debug_list_source(GArray *nodes);
52 void on_debug_error(GArray *nodes);
53 void on_debug_loaded(GArray *nodes);
54 void on_debug_load_error(GArray *nodes);
55 void on_debug_exit(GArray *nodes);
56 void on_debug_auto_run(GArray *nodes);
57 void on_debug_auto_exit(void);
58 
59 void on_debug_run_continue(const MenuItem *menu_item);
60 void on_debug_goto_cursor(const MenuItem *menu_item);
61 void on_debug_goto_source(const MenuItem *menu_item);
62 void on_debug_step_into(const MenuItem *menu_item);
63 void on_debug_step_over(const MenuItem *menu_item);
64 void on_debug_step_out(const MenuItem *menu_item);
65 void on_debug_terminate(const MenuItem *menu_item);
66 
67 enum { N, T, F };
68 void debug_send_command(gint tf, const char *command);
69 #define debug_send_thread(command) debug_send_command(T, (command))
70 void debug_send_format(gint tf, const char *format, ...) G_GNUC_PRINTF(2, 3);
71 char *debug_send_evaluate(char token, gint scid, const gchar *expr);  /* == locale(expr) */
72 
73 void debug_init(void);
74 void debug_finalize(void);
75 
76 #define DEBUG_H 1
77 #endif
78