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