diff options
Diffstat (limited to 'src/monkey/misc.c')
-rw-r--r-- | src/monkey/misc.c | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/src/monkey/misc.c b/src/monkey/misc.c new file mode 100644 index 000000000..5440ab0f0 --- /dev/null +++ b/src/monkey/misc.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /**[txh]******************************************************************** | ||
2 | |||
3 | Copyright (c) 2004 by Salvador E. Tropea. | ||
4 | Covered by the GPL license. | ||
5 | |||
6 | Module: Miscellaneous commands. | ||
7 | Comments: | ||
8 | GDB/MI commands for the "Miscellaneous Commands" section.@p | ||
9 | |||
10 | @<pre> | ||
11 | gdb command: Implemented? | ||
12 | |||
13 | -gdb-exit Yes | ||
14 | -gdb-set Yes | ||
15 | -gdb-show Yes | ||
16 | -gdb-version Yes | ||
17 | @</pre> | ||
18 | |||
19 | GDB Bug workaround for "-gdb-show architecture": gdb 6.1 and olders doesn't | ||
20 | report it in "value", but they give the output of "show architecture". In | ||
21 | 6.4 we observed that not even a clue is reported. So now we always use | ||
22 | "show architecture". | ||
23 | |||
24 | ***************************************************************************/ | ||
25 | |||
26 | #include <string.h> | ||
27 | #include "mi_gdb.h" | ||
28 | |||
29 | /* Low level versions. */ | ||
30 | |||
31 | void mi_gdb_exit(mi_h *h) | ||
32 | { | ||
33 | mi_send(h,"-gdb-exit\n"); | ||
34 | } | ||
35 | |||
36 | void mi_gdb_version(mi_h *h) | ||
37 | { | ||
38 | mi_send(h,"-gdb-version\n"); | ||
39 | } | ||
40 | |||
41 | void mi_gdb_set(mi_h *h, const char *var, const char *val) | ||
42 | { | ||
43 | mi_send(h,"-gdb-set %s %s\n",var,val); | ||
44 | } | ||
45 | |||
46 | void mi_gdb_show(mi_h *h, const char *var) | ||
47 | { | ||
48 | if (strcmp(var,"architecture")==0) | ||
49 | mi_send(h,"show %s\n",var); | ||
50 | else | ||
51 | mi_send(h,"-gdb-show %s\n",var); | ||
52 | } | ||
53 | |||
54 | /* High level versions. */ | ||
55 | |||
56 | /**[txh]******************************************************************** | ||
57 | |||
58 | Description: | ||
59 | Exit gdb killing the child is it is running. | ||
60 | |||
61 | Command: -gdb-exit | ||
62 | |||
63 | ***************************************************************************/ | ||
64 | |||
65 | void gmi_gdb_exit(mi_h *h) | ||
66 | { | ||
67 | mi_gdb_exit(h); | ||
68 | mi_res_simple_exit(h); | ||
69 | } | ||
70 | |||
71 | /**[txh]******************************************************************** | ||
72 | |||
73 | Description: | ||
74 | Send the version to the console. | ||
75 | |||
76 | Command: -gdb-version | ||
77 | Return: !=0 OK | ||
78 | |||
79 | ***************************************************************************/ | ||
80 | |||
81 | int gmi_gdb_version(mi_h *h) | ||
82 | { | ||
83 | mi_gdb_version(h); | ||
84 | return mi_res_simple_done(h); | ||
85 | } | ||
86 | |||
87 | /**[txh]******************************************************************** | ||
88 | |||
89 | Description: | ||
90 | Set a gdb variable. | ||
91 | |||
92 | Command: -gdb-set | ||
93 | Return: !=0 OK | ||
94 | |||
95 | ***************************************************************************/ | ||
96 | |||
97 | int gmi_gdb_set(mi_h *h, const char *var, const char *val) | ||
98 | { | ||
99 | mi_gdb_set(h,var,val); | ||
100 | return mi_res_simple_done(h); | ||
101 | } | ||
102 | |||
103 | /**[txh]******************************************************************** | ||
104 | |||
105 | Description: | ||
106 | Get a gdb variable. | ||
107 | |||
108 | Command: -gdb-show | ||
109 | Return: The current value of the variable or NULL on error. | ||
110 | |||
111 | ***************************************************************************/ | ||
112 | |||
113 | char *gmi_gdb_show(mi_h *h, const char *var) | ||
114 | { | ||
115 | mi_gdb_show(h,var); | ||
116 | return mi_res_value(h); | ||
117 | } | ||
118 | |||